Fixed account module giving money to zombies hurting themself with self-inflicted damage.

This commit is contained in:
Greyscale 2010-01-11 17:43:06 -08:00
parent d8e3a6e62f
commit c11d1af486
2 changed files with 14 additions and 2 deletions

View File

@ -74,7 +74,7 @@ AccountOnClientSpawn(client)
* @param attacker The attacker index. * @param attacker The attacker index.
* @param dmg The amount of damage inflicted. * @param dmg The amount of damage inflicted.
*/ */
AccountOnClientHurt(attacker, dmg_health) AccountOnClientHurt(client, attacker, dmg_health)
{ {
// If attacker isn't valid, then stop. // If attacker isn't valid, then stop.
if (!ZRIsClientValid(attacker)) if (!ZRIsClientValid(attacker))
@ -89,6 +89,18 @@ AccountOnClientHurt(attacker, dmg_health)
return; 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. // Get current cash, add the damage done to it, then set new value.
new cash = AccountGetClientCash(attacker); new cash = AccountGetClientCash(attacker);
AccountSetClientCash(attacker, cash + dmg_health); AccountSetClientCash(attacker, cash + dmg_health);

View File

@ -239,7 +239,7 @@ public Action:EventPlayerHurt(Handle:event, const String:name[], bool:dontBroadc
// Forward event to modules. // Forward event to modules.
ClassAlphaUpdate(index); ClassAlphaUpdate(index);
InfectOnClientHurt(index, attacker, weapon); InfectOnClientHurt(index, attacker, weapon);
AccountOnClientHurt(attacker, dmg_health); AccountOnClientHurt(index, attacker, dmg_health);
SEffectsOnClientHurt(index); SEffectsOnClientHurt(index);
KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health); KnockbackOnClientHurt(index, attacker, weapon, hitgroup, dmg_health);
NapalmOnClientHurt(index, attacker, weapon); NapalmOnClientHurt(index, attacker, weapon);