SA-MP Forums Archive
Need help in looping - 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: Need help in looping (/showthread.php?tid=254432)



Need help in looping - tal4840 - 10.05.2011

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])


Re: Need help in looping - Sascha - 10.05.2011

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



Re: Need help in looping - admantis - 10.05.2011

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


Re: Need help in looping - tal4840 - 10.05.2011

thanks