AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] get_players without flags (https://forums.alliedmods.net/showthread.php?t=171217)

GalegO 11-03-2011 11:51

[SOLVED] get_players without flags
 
Hi, for exemple, I have this cobe below:

PHP Code:

public function()
{
        new 
playersT[32], numTplayersNum
        playersNum 
get_playersnum()
        
get_players(playersTnumT"che""TERRORIST")
        
        if ((
playersNum >= 2) && (numT == 0))
        {
            ... do 
something ...
        }


And I know the AMX MOD return wrong values when using get_players + flags, knowing this, I ask: What's the better way to do this same code without the flags?

Thanks!

Emp` 11-03-2011 12:19

Re: get_players without flags
 
Code:

        new players[32], pnum, numT, playersNum
        playersNum = get_playersnum()
        get_players(players, pnum, "ch")
       
        for ( new i; i<pnum; i++ )
        {
                if ( cs_get_user_team( players[i] ) == CS_TEAM_T )
                        numT++;
        }

        if ((playersNum >= 2) && (numT == 0))
        {
            ... do something ...
        }


ConnorMcLeod 11-03-2011 13:28

Re: get_players without flags
 
Emp`'s code is ok.
Flags are ok, excepted for "e" flag when "a" flag is not used.

fysiks 11-04-2011 01:40

Re: get_players without flags
 
We need to convince Bail to give us another christmas present this year!

GalegO 11-05-2011 15:53

Re: get_players without flags
 
Thank you Emp` and Connor!! :D


All times are GMT -4. The time now is 14:22.

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