PHP Code:
#include <sourcemod>
#pragma semicolon 1
int g_iKills[MAXPLAYERS + 1];
public void OnPluginStart()
{
HookEvent("player_death", Event_Death);
}
public void OnMapEnd()
{
for (int i = 1; i <= MaxClients; i++)
{
g_iKills[i] = 0;
}
}
public Action Event_Death(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int iAttacker = GetClientOfUserId(hEvent.GetInt("attacker"));
if (IsValidClient(iAttacker))
{
g_iKills[iAttacker]++;
if (g_iKills[iAttacker] == DesiredAmountOfKills)
{
/* Perform an action here */
}
}
}
stock bool IsValidClient(int iClient)
{
if (!(0 < iClient <= MaxClients) || !IsClientInGame(iClient) || IsFakeClient(iClient))
{
return false;
}
return true;
}