Thread: [Solved] Respawn
View Single Post
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 05-21-2018 , 15:48   Re: Respawn
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>

public void OnPluginStart()
{
    
HookEvent("player_death"PlayerDeath);
}

public 
Action PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int CtsIngame GetTeamClientCount(CS_TEAM_CT);
    if(
CtsIngame >= 1)
        return 
Plugin_Handled;

    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
CreateTimer(1.5respawntheplayerGetClientUserId(client));
    return 
Plugin_Continue;
}


public 
Action respawntheplayer(Handle timerint userid)
{
   
int client GetClientOfUserId(userid);
   if(
client == 0) return;

   if(
IsClientInGame(client) && !IsPlayerAlive(client) && GetClientTeam(client) > 1)
      
CS_RespawnPlayer(client);

__________________

Last edited by PinHeaDi; 05-21-2018 at 15:50.
PinHeaDi is offline