SA-MP Forums Archive
Can I apply this to more than one player at once?? - 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: Can I apply this to more than one player at once?? (/showthread.php?tid=70876)



Can I apply this to more than one player at once?? - cyber_punk - 28.03.2009

Code:
		for(new i, m = GetMaxPlayers(); i < m; i++)
			{
			if(IsPlayerInRangeOfPoint(i, 7, xa, ya, za) || IsPlayerInRangeOfPoint(i, 7, xb, yb, zb) || IsPlayerInRangeOfPoint(i, 7, xc, yc, zc) || IsPlayerInRangeOfPoint(i, 7, xd, yd, zd) || IsPlayerInRangeOfPoint(i, 7, xe, ye, ze)) 
				{
				ApplyAnimation(i, "blahblah", "blahblahblah", 4.0, 0, 0, 0, 0, 0);
				Tblah=SetTimerEx("blah", 1500, 0, "d", i);
				return 1;
				}
			}
Ok So this code works and it does what I want it to do but the problem is it only sets the animation to the first person it gets, I thought that loop should call anyone who is online and then check if they are in the RangeOfPoint then apply the animation. Is it due to the animation why only one player gets effected or is my loop not right. I thought about a timer to run over the loop again but I have read Alex ****** thread about timers and loops >.< so am I at a lose to this or.....

[Edit] Is it because I am return 1; after I apply the animation? Therefore stopping the Loop?!?!?!


Re: Can I apply this to more than one player at once?? - matrix_smq - 11.05.2009

Quote:

[Edit] Is it because I am return 1; after I apply the animation? Therefore stopping the Loop?!?!?!

Yes.
A return stops the loop.