Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <cstrike>
public OnPluginStart()
{
HookEvent("player_death", Event_PlayerDeath);
HookEvent("client_disconnect", Event_PlayerDeath);
HookEvent("player_team", Event_PlayerDeath);
}
public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
if (AllHumansDead())
{
CS_TerminateRound(GetConVarFloat(FindConVar("mp_round_restart_delay")), CSRoundEnd_TerroristWin);
}
}
bool:AllHumansDead()
{
new bool:result = true;
for (new i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT)
{
result = false;
}
}
return result;
}
This plugin works when a player leaves, dies, changes team but it does not work when I kick the remaining alive player or if they get banned (not ending the round), how would I hook that?