Hook the
player_death event and check its userid and attacker fields.
So, something like this:
PHP Code:
public OnPluginStart()
{
HookEvent("player_death", Event_PlayerDeath);
}
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
// if client is 0, the thing killed was a non-player AI.
// If attacker is 0, the killer is either the world (fall damage, etc...) or a non-player AI
if (client < 1 || attacker < 1)
return;
// client is the victim's client index, attacker is the killer's index
}
Depending on the game, player_death may have additional fields.
__________________