AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_playersnum(1) without bots help. (https://forums.alliedmods.net/showthread.php?t=95171)

zacky 06-20-2009 12:13

get_playersnum(1) without bots help.
 
How can i do like get_playersnum(1) >= 2 and it only returns the numbers of players that is not bots?

Thanks
-zacky

biscuit628 06-20-2009 12:50

Re: get_playersnum(1) without bots help.
 
Quote:

Originally Posted by zacky (Post 852942)
How can i do like get_playersnum(1) >= 2 and it only returns the numbers of players that is not bots?

Thanks
-zacky

PHP Code:

    for (new id 1id <= g_maxplayersid++)
    {
        if(!
is_user_bot(id))
        {
            
totalplayer++
        }
    } 


xPaw 06-20-2009 13:07

Re: get_playersnum(1) without bots help.
 
Use get_players()

There is flag to skip bots, so you will know num of real players

zacky 06-20-2009 16:24

Re: get_playersnum(1) without bots help.
 
Can you show an example?

I want to detect if there is like 2 people connected or three which is not bots.

Let me explain what i'm going to do.

I am going to do that if there is 1 player connected (not bot) i am going to do something in there, if there is 2 players connected (not bots) do something else.

xPaw 06-20-2009 16:49

Re: get_playersnum(1) without bots help.
 
http://www.amxmodx.org/funcwiki.php?go=func&id=174
PHP Code:

    new iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ch" );
    
    if( 
iNum >= ) {
        
// your stuff -.-
    


That hard to watch funcwiki ?!

zacky 06-20-2009 16:51

Re: get_playersnum(1) without bots help.
 
Thanks xPaw

tpt 06-20-2009 17:10

Re: get_playersnum(1) without bots help.
 
Quote:

Originally Posted by xPaw (Post 853088)
http://www.amxmodx.org/funcwiki.php?go=func&id=174
PHP Code:

    new iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ch" );
    
    if( 
iNum >= ) {
        
// your stuff -.-
    


That hard to watch funcwiki ?!

Quote:

"We don't really support get_players() with flags anymore. It was a bad idea and if it was our choice, it would have never been added to the original AMX Mod." - BAILOPAN

xPaw 06-20-2009 17:13

Re: get_playersnum(1) without bots help.
 
The comment is not really true :mrgreen: the flags work fine

tpt 06-20-2009 17:14

Re: get_playersnum(1) without bots help.
 
Quote:

Originally Posted by xPaw (Post 853099)
The comment is not really true :mrgreen: the flags work fine

@Zacky:
PHP Code:

stock bool:IsTwoOrMore( ) {
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ch" );
    
    if( 
iNum >= )
        return 
true;
    
    return 
false;



Comment from: http://www.amxmodx.org/funcwiki.php?go=func&id=174

Even if it works it doesn't mean that you should use it. ;)

Exolent[jNr] 06-20-2009 17:47

Re: get_playersnum(1) without bots help.
 
Quote:

Originally Posted by tpt (Post 853100)
Comment from: http://www.amxmodx.org/funcwiki.php?go=func&id=174

Even if it works it doesn't mean that you should use it. ;)

You act like you know about the function.
get_players() works for most flags, but a few flags such as team can be a bit buggy.
That is why they say it shouldn't be used.


All times are GMT -4. The time now is 15:35.

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