loops - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: loops (
/showthread.php?tid=217794)
loops -
xir - 28.01.2011
can anyone show me how to make a loop which go trough all players expect admins?
Re: loops -
Mauzen - 28.01.2011
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!
Re: loops -
xir - 28.01.2011
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)
Re: loops -
Jefff - 28.01.2011
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," ");
Re: loops -
xir - 28.01.2011
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++)
Re: loops -
iFriSki - 28.01.2011
Did you even review what you just posted? You somehow managed to replace the function call with a bracket and a ']'.
Re: loops -
xir - 28.01.2011
nvm fixed