Fixed invalid client index error when player_death event was sent with bad userid. Should prevent some issues with bugs in other mods.

This commit is contained in:
Richard Helgeby 2012-08-20 22:57:35 +02:00
parent be06436e29
commit 5ccc735fd8
1 changed files with 8 additions and 0 deletions

View File

@ -271,6 +271,14 @@ public Action:EventPlayerDeath(Handle:event, const String:name[], bool:dontBroad
new index = GetClientOfUserId(GetEventInt(event, "userid"));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
// Validate client.
if (!ZRIsClientValid(index))
{
// If the client isn't a player, a player really didn't die now. Some
// other mods might sent this event with bad data.
return;
}
// Forward event to modules.
ClassOnClientDeath(index);
InfectOnClientDeath(index, attacker);