You could just remove the index of the global variable if you want all players kills to be shown.
For hint:
PHP Code:
#include <sourcemod>
int g_iKills[MAXPLAYERS + 1];
public void OnPluginStart()
{
HookEvent("player_death", Event_Death);
HookEvent("round_end", Event_End);
}
public void OnGameFrame()
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsPlayerAlive(i))
{
int iCount = GetAlivePlayersCount();
PrintHintTextToAll("<font size = '20'>Remaining players: %s Kills: %s</font>", iCount, g_iKills[i]);
}
}
}
public Action Event_Death(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int iAttacker = hEvent.GetInt("attacker");
g_iKills[iAttacker]++;
}
public Action Event_End(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int iClient = GetClientOfUserId(hEvent.GetInt("userid"));
g_iKills[iClient] = 0;
}
stock int GetAlivePlayersCount()
{
int iCount;
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && IsPlayerAlive(i))
iCount++;
}
return iCount;
}
For hud:
PHP Code:
#include <sourcemod>
int g_iKills[MAXPLAYERS + 1];
public void OnPluginStart()
{
HookEvent("player_death", Event_Death);
HookEvent("round_end", Event_End);
}
public void OnGameFrame()
{
SetHudTextParams(0.5, 0.5, 1.0, 1, 1, 255, 1, 0);
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i))
{
int iCount = GetAlivePlayersCount();
ShowHudText(i, 1, "Remaining players: %s Kills: %s", iCount, g_iKills[i]);
}
}
}
public Action Event_Death(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int iAttacker = hEvent.GetInt("attacker");
g_iKills[iAttacker]++;
}
public Action Event_End(Event hEvent, const char[] sName, bool bDontBroadcast)
{
int iClient = GetClientOfUserId(hEvent.GetInt("userid"));
g_iKills[iClient] = 0;
}
stock int GetAlivePlayersCount()
{
int iCount;
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && IsPlayerAlive(i))
iCount++;
}
return iCount;
}