AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_players in client_disconnect (https://forums.alliedmods.net/showthread.php?t=184522)

Backstabnoob 05-06-2012 04:59

get_players in client_disconnect
 
So I'm trying to reset the server password when everyone lefts the server. The problem is it doesn't work for some reason.

PHP Code:

public client_disconnectid )
{
    new 
Players32 ], iNum
    get_players
PlayersiNum"ch" )
    
    if( !
iNum )
        
_e_AllPlayersLeftid )
}

public 
_e_AllPlayersLeftLastConnectedPlayer )
{
    
server_cmd"sv_password fuckoff" )


Nothing happens, the password still remains unchanged. What could be wrong?

Edit: Is the player still "in server" when get_players() gets called? I know you cannot execute anything on him though.

ConnorMcLeod 05-06-2012 05:02

Re: get_players in client_disconnect
 
Is client_disconnect, disconnecting player is still count as ingame, knowing that, consider (iNum-1).
You can use get_playersnum instead, still you have to consider result-1.
Else, yuo don't need to make _e_AllPlayersLeft function public, you don't even need a function.

Backstabnoob 05-06-2012 05:04

Re: get_players in client_disconnect
 
Awesome, I didn't even know get_playersnum exists.

Much appreciated.

Edit: It's public since I'm using it somewhere else as well w/ set_task().
Edit2: Looks like I'll still have to use get_players since I want to not count HLTV and bots and get_playersnum seems not to support pass flags.


All times are GMT -4. The time now is 00:27.

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