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

CS:GO Remove Password


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raulGLD
New Member
Join Date: May 2019
Old 05-16-2019 , 05:40   CS:GO Remove Password
Reply With Quote #1

Hello, is there a plugin for CS:GO that can automatically remove a password from a server if the server is empty? For ex some of my friends want to play a game on my server and they set a password on it, but they leave in a hurry and forget to remove the password, if no one is around to remove the password manually the server stays empty.. so I was wondering if there is a plugin to check if there are players on the server and if there are not any players, after 10 minutes for example, the password is removed.
Thank you very much for taking your time to read and answer!
Have a great day!
raulGLD is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 05-16-2019 , 09:14   Re: CS:GO Remove Password
Reply With Quote #2

Needs sv_hibernate_when_empty 0 or it won't work.
PHP Code:
Handle g_hTimer null;

public 
void OnClientDisconnect_Post(int client)
{
    
char sPass[64];
    
FindConVar("sv_password").GetString(sPasssizeof(sPass));
    if(
StrEqual(sPass"")) return;

    
bool bPlayers false;
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsValidClient(i))
        {
            
bPlayers true;
            break;
        }
    }

    if(
bPlayers) return;

    if(
g_hTimer != null)
    {
        
delete g_hTimer;
        
g_hTimer null;
    }

    
g_hTimer CreateTimer(600.0Timer_RemovePassword);
}

public 
void OnClientPutInServer(int client)
{
    if(
IsValidClient(client) && g_hTimer != null)
    {
        
delete g_hTimer;
        
g_hTimer null;
    }
}

public 
Action Timer_RemovePassword(Handle hTimer)
{
    
FindConVar("sv_password").SetString("");

    
delete g_hTimer;
    
g_hTimer null;
    return 
Plugin_Stop;
}

stock bool IsValidClient(int client)
{
    return 
client >= && 
    
client <= MaxClients && 
    
IsClientConnected(client) && 
    !
IsFakeClient(client);

CliptonHeist 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 10:54.


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