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(emptypass, curpass, 31);
if((get_playersnum() == 0) && (strlen(curpass)<1))
{
set_cvar_string("sv_password","");
ColorChat(0, RED, "%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
__________________