SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 10/05/2011, 07:47 PM   #1
tal4840
Little Clucker
 
Join Date: Oct 2008
Posts: 8
Reputation: 0
Default Need help in looping

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])
tal4840 is offline  
Old 10/05/2011, 07:50 PM   #2
Sascha
High-roller
 
Sascha's Avatar
 
Join Date: Jul 2009
Location: Germany
Posts: 1,266
Reputation: 57
Default Re: Need help in looping

pawn Code:
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);
    }
  }
}
__________________
Filterscripts
Sgt's Driving License - Sgt's Debug - Sgt's RCON Addition - IpCheck - Advertisement
Includes
Sgt's Vehicle Functions
Functions
IsFloat

Trick to get faster and better help: Use (more or less) correct english and explain the problem detailed (and a "please" and "thank you" always helps).

check it out!
Sascha is offline  
Old 10/05/2011, 07:50 PM   #3
admantis
High-roller
 
admantis's Avatar
 
Join Date: Sep 2009
Posts: 2,278
Reputation: 234
Default Re: Need help in looping

pawn Code:
if (i == playerid)
{
    continue;
}
Assuming the excluded one is 'playerid' and the loop variable is 'i'.
admantis is offline  
Old 10/05/2011, 07:55 PM   #4
tal4840
Little Clucker
 
Join Date: Oct 2008
Posts: 8
Reputation: 0
Default Re: Need help in looping

thanks
tal4840 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping :/ Lorenc_ Help Archive 2 13/04/2011 10:16 AM
[Map] [MAP] Big Speed Looping Dollar Maps 8 15/04/2010 07:58 PM
Looping Pvars Dark_Kostas Help Archive 4 06/04/2010 07:18 AM
Looping cu MOA Alxxie Română/Romanian 4 03/04/2010 06:56 PM
Looping OnPlayerRequestClass cmg4life Help Archive 2 02/02/2010 04:07 AM


All times are GMT. The time now is 02:19 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.