Raised This Month: $12 Target: $400
 3% 

Solved Respawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zyten
Senior Member
Join Date: Jan 2018
Old 05-21-2018 , 15:10   Respawn
Reply With Quote #1

Auto Respawn if there is no one on ct side

Last edited by Zyten; 06-11-2018 at 12:11.
Zyten is offline
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
Zyten
Senior Member
Join Date: Jan 2018
Old 05-21-2018 , 17:14   Re: Respawn
Reply With Quote #3

thx works,

Mutes all who respawn can that be bypassed somehow? (jailbreak server)

Last edited by Zyten; 05-22-2018 at 18:21.
Zyten is offline
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
Zyten
Senior Member
Join Date: Jan 2018
Old 06-06-2018 , 22:10   Re: Respawn
Reply With Quote #5

Thx lendhart that saved me. i Started use a plugin and old .sp didnt work well with it
Zyten is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode