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

[CSGO REQ] No Late Spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
trickgod
Junior Member
Join Date: Jun 2018
Old 06-21-2018 , 12:41   [CSGO REQ] No Late Spawn
Reply With Quote #1

https://forums.alliedmods.net/showthread.php?p=1543700
Can someone make this CS: GO version?

But I use Redie Plugin on my server. Should Not Damage This Redie Plugin
The players who use the !redie command have to be no affected.
trickgod is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 06-21-2018 , 13:29   Re: [CSGO REQ] No Late Spawn
Reply With Quote #2

Quote:
Originally Posted by trickgod View Post
https://forums.alliedmods.net/showthread.php?p=1543700
Can someone make this CS: GO version?

But I use Redie Plugin on my server. Should Not Damage This Redie Plugin
The players who use the !redie command have to be no affected.
Not tested:
PHP Code:
#include <sourcemod>

bool g_bStarted;

bool g_bImmune[MAXPLAYERS 1];

ConVar g_cSeconds;

float g_fSeconds;

public 
void OnPluginStart()
{
    
AddCommandListener(Cmd_Redie"sm_redie");
    
    
HookEvent("round_start"Event_Start);
    
    
HookEvent("round_end"Event_End);
    
    
HookEvent("player_team"Event_Team);
    
    
g_cSeconds CreateConVar("sm_seconds""15.0""Choose the desired ammount of seconds, before spawning is disallowed.");
    
    
AutoExecConfig(true"SomeRandomCfg");
}

public 
Action Cmd_Redie(int iClient, const char[] sCommandint iArgs)
{
    
g_bImmune[iClient] = true;
}

public 
Action Event_Start(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
g_fSeconds GetConVarFloat(g_cSeconds);
    
    
CreateTimer(g_fSecondsTimer_Disallow);
}

public 
Action Event_End(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid")); 
    
    
g_bStarted false;
    
    
g_bImmune[iClient] = false;
}

public 
Action Event_Team(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid"));
    
    if (
g_bStarted)
    {
        if (
IsClientInGame(iClient))
        {
            if (
IsPlayerAlive(iClient))
            {
                if (
g_bImmune[iClient])
                {
                    return 
Plugin_Handled;
                }
                
                else
                {
                    
ClientCommand(iClient"Kill");
                            
                    
PrintToChat(iClient"Unfortunately the round has already started.")
                }
            }
        }
    }
    
    return 
Plugin_Handled;
}

public 
Action Timer_Disallow(Handle hTimer)
{
    
g_bStarted true;


Last edited by mug1wara; 06-21-2018 at 16:26.
mug1wara is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 06-21-2018 , 14:15   Re: [CSGO REQ] No Late Spawn
Reply With Quote #3

Quote:
Originally Posted by mug1wara View Post
Not tested:
PHP Code:
#include <sourcemod>

bool g_bStarted;

bool g_bImmune[MAXPLAYERS 1];

ConVar g_cSeconds;

float g_fSeconds;

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_redie"Cmd_Redie);
    
    
HookEvent("round_start"Event_Start);
    
    
HookEvent("round_end"Event_End);
    
    
HookEvent("player_team"Event_Team);
    
    
g_cSeconds CreateConVar("sm_seconds""15.0""Choose the desired ammount of seconds, before spawning is disallowed.");
    
    
AutoExecConfig(true"SomeRandomCfg");
}

public 
Action Cmd_Redie(int iClientint iArgs)
{
    
g_bImmune[iClient] = true;
}

public 
Action Event_Start(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
g_fSeconds GetConVarFloat(g_cSeconds);
    
    
CreateTimer(g_fSecondsTimer_Disallow);
}

public 
Action Event_End(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid")); 
    
    
g_bStarted false;
    
    
g_bImmune[iClient] = false;
}

public 
Action Event_Team(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iClient GetClientOfUserId(hEvent.GetInt("userid"));
    
    if (
g_bStarted)
    {
        if (
g_bImmune[iClient])
        {
            return 
Plugin_Handled;
        }
        
        else
        {        
            if (
IsClientInGame(iClient))
            {
                if (
IsPlayerAlive(iClient))
                {
                    
ClientCommand(iClient"Kill");
                    
                    
PrintToChat(iClient"Unfortunately the round has already started.")
                }
            }
        }
    }
    
    return 
Plugin_Handled;
}

public 
Action Timer_Disallow(Handle hTimer)
{
    
g_bStarted true;

Use
Code:
AddCommandListener(...);
to hook for already existing plugins rather than using
Code:
RegConsoleCmd(...)
and that wont work properly since the hook would fire even if the player use /redie while alive.

Finally, there is no "userid" on the round end event, you should do a loop instead.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 06-21-2018 , 16:26   Re: [CSGO REQ] No Late Spawn
Reply With Quote #4

Updated the code above, looks better now. Thank you for pointing it out!
mug1wara is offline
Reply



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 11:59.


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