Raised This Month: $ Target: $400
 0% 

get_playersnum exclude HLTV


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sparkey
Senior Member
Join Date: May 2010
Old 06-08-2010 , 18:13   get_playersnum exclude HLTV
Reply With Quote #1

Hi there,

Is there any way to exclude a hltv from being counted in the get_playersnum function or a similar function. Today i have a piece of coding looking kinda like this:

Code:
public client_disconnect(id)
{
    if (get_playersnum(1) <= 1)
    {
        remove_task(TASKID_RESET);
        reset();
    }
}
When all of the players are disconnected it stops the reset function.
My dilemma now is that it is ofcource counting the HLTV as a player and therefore it does not remove the task.

I know i can change it to if (get_playersnum(1) <= 2) but then everything depends on the HLTV being connected which it might not be all the time.

I'm very thankfull for your answers. Thx!
sparkey is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-08-2010 , 18:31   Re: get_playersnum exclude HLTV
Reply With Quote #2

PHP Code:
public client_disconnect(id)
{
    new 
PlayerCount
    
new iPlayers[32], iNum
    get_players
(iPlayers,iNum)
    for(new 
iiNumi++)
    {
        new 
tempid iPlayers[i]
        if(!
is_user_bot(tempid) && is_user_connected(tempid))
            
PlayerCount++
    }
    if(
PlayerCount == 0)
    {
        
remove_task(TASKID_RESET)
        
reset()
    }

That should work.
RedRobster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-08-2010 , 19:33   Re: get_playersnum exclude HLTV
Reply With Quote #3

PHP Code:
new iPlayers[32], iPlayerCount
get_players
(iPlayersiPlayerCount"h")

if( 
iPlayerCount ... 
__________________
fysiks is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-09-2010 , 00:14   Re: get_playersnum exclude HLTV
Reply With Quote #4

@Red:
PHP Code:
if(!is_user_bot(tempid) && !is_user_hltv(tempid) && is_user_connected(tempid)) 
__________________
Hi.
Kreation is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-09-2010 , 00:16   Re: get_playersnum exclude HLTV
Reply With Quote #5

Quote:
Originally Posted by Kreation View Post
@Red:
PHP Code:
if(!is_user_bot(tempid) && !is_user_hltv(tempid) && is_user_connected(tempid)) 
Did not know that there was a is_user_hltv(id) . Thanks
RedRobster is offline
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 06-09-2010 , 00:19   Re: get_playersnum exclude HLTV
Reply With Quote #6

Useful.

__________________
Hi.
Kreation is offline
Reply



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 05:19.


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