If player_death event doesn't work, you can try use player_hurt event and detect
hitgroup
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
public Plugin myinfo =
{
name = "[L4D & L4D2] XXX",
author = "HarryPotter",
description = "<->",
version = "0.0",
url = ""
}
public void OnPluginStart()
{
HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Pre);
}
public void Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast)
{
int victim = GetClientOfUserId(event.GetInt("userid"));
int attacker = GetClientOfUserId(event.GetInt("attacker"));
int dmg = event.GetInt("dmg_health");
int eventhealth = event.GetInt("health");
if (attacker == 0 || victim == 0 || !IsClientInGame(attacker) || !IsClientInGame(victim)
|| GetClientTeam(attacker) != 2 || GetClientTeam(victim) != 3 ) {
return;
}
int zombieClass = GetEntProp(victim, Prop_Send, "m_zombieClass");
int hitgroup = event.GetInt("hitgroup");
if(zombieClass == 3 && eventhealth <= 0 ) //hunter infected player is going to die
{
switch (hitgroup)
{
case HITGROUP_HEAD:
{
PrintToChatAll("%N head-shot killed %N, dmg: %d", attacker, victim, dmg);
}
}
}
}
__________________