From 8edf223dc107cfaea3fa3962b58b620c4a5dd48a Mon Sep 17 00:00:00 2001 From: Greyscale Date: Wed, 20 May 2009 22:39:24 -0700 Subject: [PATCH] Moved more code from event.inc to appropriate modules, fixed kill bonus. --- src/zr/event.inc | 18 ++---------------- src/zr/infect.inc | 32 ++++++++++++++++++++++++++++++++ src/zr/napalm.inc | 11 +++++++++++ 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/src/zr/event.inc b/src/zr/event.inc index cd9705d..1f92e1c 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -241,29 +241,15 @@ public Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroad // Get all required event info. new index = GetClientOfUserId(GetEventInt(event, "userid")); new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); - - // Extinguish any flames to stop burning sounds. - ExtinguishEntity(index); - // If the attacker is valid, then continue. - if (ZRIsClientValid(attacker)) - { - // If the client is a zombie, then continue. - if (InfectIsClientInfected(index)) - { - // Add kill bonus to attacker's score. - new bonus = ClassGetKillBonus(attacker); - new score = ToolsClientScore(index, true, false); - ToolsClientScore(index, true, true, score + bonus); - } - } - // Forward event to modules. ClassOnClientDeath(index); RoundEndOnClientDeath(); + InfectOnClientDeath(); SEffectsOnClientDeath(index); SpawnProtectOnClientDeath(index); RespawnOnClientDeath(index, attacker, weapon); + NapalmOnClientDeath(index); ZSpawnOnClientDeath(index); ZTeleOnClientDeath(index); ZHPOnClientDeath(index); diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 7cd86a2..0d976c6 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -225,6 +225,38 @@ InfectOnClientSpawn(client) } } +/** + * Client has been killed. + * + * @param client The client index. + * @param attacker The attacker index. + */ +InfectOnClientDeath(client, attacker) +{ + // If attacker isn't valid, then stop. + if (!ZRIsValidClient(attacker)) + { + return; + } + + // If attacker isn't a human, then stop. + if (!InfectIsClientHuman(attacker)) + { + return; + } + + // If client isn't a zombie, then stop. + if (!InfectIsClientInfected(client)) + { + return; + } + + // Add kill bonus to attacker's score. + new bonus = ClassGetKillBonus(index); + new score = ToolsClientScore(attacker, true, false); + ToolsClientScore(attacker, true, true, score + bonus); +} + /** Client has been hurt. * * @param client The client index. diff --git a/src/zr/napalm.inc b/src/zr/napalm.inc index 2ff71ef..dbd95b1 100644 --- a/src/zr/napalm.inc +++ b/src/zr/napalm.inc @@ -47,6 +47,17 @@ NapalmOnClientHurt(client, const String:weapon[]) } } +/** + * Client has been killed. + * + * @param client The client index. + */ +NapalmOnClientDeath(client) +{ + // Extinguish any flames to stop burning sounds. + ExtinguishEntity(client); +} + /** * Weapon has been fired. *