Moved more code from event.inc to appropriate modules, fixed kill bonus.

This commit is contained in:
Greyscale 2009-05-20 22:39:24 -07:00
parent bb05cbccd0
commit 8edf223dc1
3 changed files with 45 additions and 16 deletions

View File

@ -241,29 +241,15 @@ public Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroad
// Get all required event info. // Get all required event info.
new index = GetClientOfUserId(GetEventInt(event, "userid")); new index = GetClientOfUserId(GetEventInt(event, "userid"));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker")); 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. // Forward event to modules.
ClassOnClientDeath(index); ClassOnClientDeath(index);
RoundEndOnClientDeath(); RoundEndOnClientDeath();
InfectOnClientDeath();
SEffectsOnClientDeath(index); SEffectsOnClientDeath(index);
SpawnProtectOnClientDeath(index); SpawnProtectOnClientDeath(index);
RespawnOnClientDeath(index, attacker, weapon); RespawnOnClientDeath(index, attacker, weapon);
NapalmOnClientDeath(index);
ZSpawnOnClientDeath(index); ZSpawnOnClientDeath(index);
ZTeleOnClientDeath(index); ZTeleOnClientDeath(index);
ZHPOnClientDeath(index); ZHPOnClientDeath(index);

View File

@ -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. /** Client has been hurt.
* *
* @param client The client index. * @param client The client index.

View File

@ -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. * Weapon has been fired.
* *