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

Removing pass get_playersnum()


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 01-13-2019 , 09:10   Removing pass get_playersnum()
Reply With Quote #1

PHP Code:
//AMXX 1.8.2
#define TAG "PASS"
new emptypass;

public 
plugin_init()
{
    
//pass check
    
emptypass get_cvar_pointer"sv_password" );
}

public 
client_disconnect(id)
{
set_task(5.0"aremovepass"___"a"1);
}

public 
aremovepass()
{
    new 
curpass[32];
    
get_pcvar_string(emptypasscurpass31);
    if((
get_playersnum() == 0) && (strlen(curpass)<1)) 
    {
        
set_cvar_string("sv_password","");
        
ColorChat(0RED"%s Password has been removed."TAG);
    }

My objective: Setting cvar sv_password to "" when the last player has disconnected from a password protected server!

I tried learning from some old sources, but I failed miserably each time, I tried also with get_players() and getting players from CT/T/SPECTATOR/UNASSIGNED, created a variable summing all the 4 teams up. The same result, the password does NOT get removed.


Any tips are appreciated, thanks!

UMM(EDIT): I also tried using client_remove
__________________

Last edited by deprale; 01-13-2019 at 09:15. Reason: Some formatting and some useful info!
deprale is offline
 



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 00:28.


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