SA-MP Forums Archive
Question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question (/showthread.php?tid=481383)



Question - Jimmy0wns - 15.12.2013

Hey,

I'm looking for a code that selects all the players that have the same value, so for example it selects all players that have admin level 5.

Tried searching but couldn't find it.


Re: Question - niels44 - 15.12.2013

pawn Код:
for( new i= 0; i < GetMaxPlayers( ); i++ )
{
    if( PlayerInfo[ i ][ adminlevel ] == 5 )
    {
        // do something here
    }
}
for the PlayerInfo[ i ][ adminlevel ], use your own variable ofc

basically this loops through the players, and if someone has the admin lvl 5 it does something, what it should do, is up to you, add it at the green line.

^^ is untested btw, but it should work.


Re: Question - Jimmy0wns - 15.12.2013

Quote:
Originally Posted by niels44
Посмотреть сообщение
pawn Код:
for( new i= 0; i < GetMaxPlayers( ); i++ )
{
    if( PlayerInfo[ i ][ adminlevel ] == 5 )
    {
        // do something here
    }
}
for the PlayerInfo[ i ][ adminlevel ], use your own variable ofc

basically this loops through the players, and if someone has the admin lvl 5 it does something, what it should do, is up to you, add it at the green line.
Thanks alot!

EDIT: I'm getting some errors:
Код:
-chase.pwn(41) : error 028: invalid subscript (not an array or too many subscripts): "eChase"
-chase.pwn(41) : warning 215: expression has no effect
-chase.pwn(41) : error 001: expected token: ";", but found "]"
-chase.pwn(41) : error 029: invalid expression, assumed zero
-chase.pwn(41) : fatal error 107: too many error messages on one line
My Enum:
pawn Код:
enum eChase
{
   pJoined
};