SA-MP Forums Archive
What does this mean? - 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: What does this mean? (/showthread.php?tid=155340)



What does this mean? - Antonio [G-RP] - 18.06.2010

I've seen 3 of these, what do they each mean?

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
pawn Код:
for (new i = 0; i != MAX_PLAYERS; i++)
pawn Код:
for (new i = 0; i > MAX_PLAYERS; i++)



Re: What does this mean? - ihatetn931 - 18.06.2010

from what i know it's a way to do it when a callback dosen't have playerid, Where playerid would be you would put an i so for example

SetPlayerPos(i,x,y,z and so on

Instead of
SetPlayerPos(playerid,x,y,z and so on




Re: What does this mean? - Carlton - 18.06.2010

Quote:
Originally Posted by [SL~RP
ihatetn931 ]
from what i know it's a way to do it when a callback dosen't have playerid, Where playerid would be you would put an i so for example

SetPlayerPos(i,x,y,z and so on

Instead of
SetPlayerPos(playerid,x,y,z and so on

Not necessarily.

https://sampwiki.blast.hk/wiki/Loops


Re: What does this mean? - Antonio [G-RP] - 18.06.2010

I know but when would you use < MAX_PLAYERS and when would you use != MAX_PLAYERS


Re: What does this mean? - Carlton - 18.06.2010

https://sampwiki.blast.hk/wiki/Control_Structures#Operators
https://sampwiki.blast.hk/wiki/Loops

You can put it together yourself if you read them both.


Re: What does this mean? - Antonio [G-RP] - 18.06.2010

I know what the operators are.


Re: What does this mean? - -Rebel Son- - 18.06.2010

It s a loop for playerid, ok, so i = everyone. so..


Re: What does this mean? - Antonio [G-RP] - 18.06.2010

I know but when would you use < and when would you use !=


Re: What does this mean? - (SF)Noobanatior - 18.06.2010



for(new i=0;i<MAX_PLAYERS;i++)

right so while i =0 and is less then MAX_PLAYERS incress the value of i by ++ (1) each time the loop runs