From c11d1af4867a66e91faec86d4c84815398ac9ead Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 11 Jan 2010 17:43:06 -0800 Subject: [PATCH] Fixed account module giving money to zombies hurting themself with self-inflicted damage. --- src/zr/account.inc | 14 +++++++++++++- src/zr/event.inc | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/zr/account.inc b/src/zr/account.inc index 191d23c..0a29579 100644 --- a/src/zr/account.inc +++ b/src/zr/account.inc @@ -74,7 +74,7 @@ AccountOnClientSpawn(client) * @param attacker The attacker index. * @param dmg The amount of damage inflicted. */ -AccountOnClientHurt(attacker, dmg_health) +AccountOnClientHurt(client, attacker, dmg_health) { // If attacker isn't valid, then stop. if (!ZRIsClientValid(attacker)) @@ -89,6 +89,18 @@ AccountOnClientHurt(attacker, dmg_health) return; } + // If attacker is hurting themself, then stop. + if (client == attacker) + { + return; + } + + // If attacker isn't a human, then stop. + if (!InfectIsClientHuman(attacker)) + { + return; + } + // Get current cash, add the damage done to it, then set new value. new cash = AccountGetClientCash(attacker); AccountSetClientCash(attacker, cash + dmg_health); diff --git a/src/zr/event.inc b/src/zr/event.inc index 8e38db6..c666693 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -239,7 +239,7 @@ public Action:EventPlayerHurt(Handle:event, const String:name[], bool:dontBroadc // Forward event to modules. ClassAlphaUpdate(index); InfectOnClientHurt(index, attacker, weapon); - AccountOnClientHurt(attacker, dmg_health); + AccountOnClientHurt(index, attacker, dmg_health); SEffectsOnClientHurt(index); KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health); NapalmOnClientHurt(index, attacker, weapon);