AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   CS:GO Remove Password (https://forums.alliedmods.net/showthread.php?t=316300)

raulGLD 05-16-2019 05:40

CS:GO Remove Password
 
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!

CliptonHeist 05-16-2019 09:14

Re: CS:GO Remove Password
 
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);




All times are GMT -4. The time now is 08:20.

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