Need help in looping
#1

I need help in a loop that will go to all players exept the one who is [playerid].
Like a radius slap(slapping everyone exept the admin[slapper])
Reply
#2

pawn Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=0; i<GetMaxPlayers(); i++)
{
  if(i != playerid)
  {
    if(IsPlayerInRangeOfPoint(i, RANGE, x, y, z))
    {
      new Float:x2, Float:y2, Float:z2;
      GetPlayerPos(i, x2, y2, z2);
      SetPlayerPos(i, x2, y2, z2+20);
    }
  }
}
Reply
#3

pawn Код:
if (i == playerid)
{
    continue;
}
Assuming the excluded one is 'playerid' and the loop variable is 'i'.
Reply
#4

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)