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,388
Reputation: 64
Default Re: Need help in looping

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);
    }
  }
}
__________________
FilterscriptsSgt's Driving License - Sgt's Debug - Sgt's RCON Addition - IpCheck - Advertisement
IncludesSgt's Vehicle Functions
FunctionsIsFloat
Searching for a team for a new server (Mapper/Admins/etc.).the website.
IP: 5.1.85.106

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

Code:
if (i == playerid)
{
    continue;
}
Assuming the excluded one is 'playerid' and the loop variable is 'i'.
__________________
New research by scientists at the University of Who Cares confirm that the San Andeas Multiplayer community forum is carcinogenic.

Stay tuned.
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 03:08 PM.


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