PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
public void OnPluginStart()
{
HookEvent("player_death", PlayerDeath);
}
public Action PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
int CtsIngame = GetTeamClientCount(CS_TEAM_CT);
if(CtsIngame >= 1)
return Plugin_Handled;
int client = GetClientOfUserId(GetEventInt(event, "userid"));
CreateTimer(1.5, respawntheplayer, GetClientUserId(client));
return Plugin_Continue;
}
public Action respawntheplayer(Handle timer, int userid)
{
int client = GetClientOfUserId(userid);
if(client == 0) return;
if(IsClientInGame(client) && !IsPlayerAlive(client) && GetClientTeam(client) > 1)
CS_RespawnPlayer(client);
}
__________________