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

get_players in client_disconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-06-2012 , 04:59   get_players in client_disconnect
Reply With Quote #1

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.
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 05-06-2012 at 05:01.
Backstabnoob is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-06-2012 , 05:02   Re: get_players in client_disconnect
Reply With Quote #2

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.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 05-06-2012 at 05:03.
ConnorMcLeod is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-06-2012 , 05:04   Re: get_players in client_disconnect
Reply With Quote #3

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.
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 05-06-2012 at 05:06.
Backstabnoob 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 09:51.


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