Thread: [Solved] Respawn
View Single Post
LenHard
Senior Member
Join Date: Jan 2016
Old 05-24-2018 , 21:14   Re: Respawn
Reply With Quote #4

Quote:
Originally Posted by Zyten View Post
thx works,

Mutes all who respawn can that be bypassed somehow? (jailbreak server)
PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma newdecls required
#pragma semicolon 1

ConVar gCV_Respawn null;

public 
void OnPluginStart()
{
    
gCV_Respawn FindConVar("mp_respawn_on_death_t");    
    
    if (
gCV_Respawn == null)
        
SetFailState("The cvar 'mp_respawn_on_death_t' isn't valid (Not CS:GO?)");
    
    
HookEvent("player_spawn"Event_PlayerSpawnEventHookMode_Post);
    
HookEvent("player_death"Event_CheckStatusEventHookMode_Post);    
    
HookEvent("round_start"Event_CheckStatusEventHookMode_Post);
}

public 
void OnClientDisconnect_Post(int client)
{
    if (!
gCV_Respawn.BoolValue && GetTeamClientCount(3) == 0)
        
gCV_Respawn.SetInt(1);
}

public 
void Event_PlayerSpawn(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    if (
gCV_Respawn.BoolValue)
    {
        
int client GetClientOfUserId(hEvent.GetInt("userid"));
        
        if (
client <= MaxClients && IsClientInGame(client)) {
            
SetClientListeningFlags(clientVOICE_NORMAL);
        }
    }
}

public 
void Event_CheckStatus(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{    
    if (
GetTeamClientCount(3) == 0)
    {
        if (!
gCV_Respawn.BoolValue)
            
gCV_Respawn.SetInt(1);
    }
    else 
    {
        if (
gCV_Respawn.BoolValue)
            
gCV_Respawn.SetInt(0);
    }

Assuming this is for CS:GO
__________________

Last edited by LenHard; 05-24-2018 at 21:24.
LenHard is offline