Question
#1

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.
Reply
#2

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.
Reply
#3

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
};
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)