#1

can anyone show me how to make a loop which go trough all players expect admins?
Reply
#2

pawn Code:
for(new i = 0; i < GetMaxPlayers(); i ++)
{
    if(IsPlayerAdmin(i)) continue; // skip the cycle if the player is an admin
    // ... your code
}
Here it is!
Reply
#3

ok thanks, but I got a question, example when an admin clear the chat box, only the players will get their chat box cleared, but not the admins.

so how can I make that work with this

pawn Code:
for(new i = 0; i < 100; i++)
    SendClientMessageToAll(White," ");
also i dont use rcon but my own admin variable

this
pawn Code:
if(PlayerInfo[playerid][pAdminLevel] >=1)
Reply
#4

pawn Code:
for(new d,g=GetMaxPlayers(); d < g; d++)
    if(IsPlayerConnected(d) && !PlayerInfo[d][pAdminLevel])
        for(new i; i < 100; i++)
            SendClientMessage(d,White," ");
Reply
#5

pawn Code:
E:\GTA San Andreas\DM\gamemodes\xir.pwn(1522) : error 028: invalid subscript (not an array or too many subscripts): "GetMaxPlayers"
E:\GTA San Andreas\DM\gamemodes\xir.pwn(1522) : warning 215: expression has no effect
E:\GTA San Andreas\DM\gamemodes\xir.pwn(1522) : error 001: expected token: ")", but found ";"
E:\GTA San Andreas\DM\gamemodes\xir.pwn(1522) : error 036: empty statement
E:\GTA San Andreas\DM\gamemodes\xir.pwn(1522) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
this line
pawn Code:
for(new d,g=GetMaxPlayers{]; d < g; d++)
Reply
#6

Did you even review what you just posted? You somehow managed to replace the function call with a bracket and a ']'.
Reply
#7

nvm fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)