[INFO]Loop - 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)
+--- Thread: [INFO]Loop (
/showthread.php?tid=279005)
[INFO]Loop -
TheBluec0de - 24.08.2011
Hello everyone, I could use a function to speed up the various loops?, As well as I did in the forward + public:
Код:
#define function%0(%1) forward%0(%1); public%0(%1)
Код:
function add(a, b) {
return a + b;
}
various loop
Код:
#define Loop(%0,%1) for(new %0; %0 != %1; %0++)
Re: [INFO]Loop -
TheBluec0de - 24.08.2011
bumping ?
Re: [INFO]Loop -
Toreno - 24.08.2011
Yes, you can.
Re: [INFO]Loop -
Bakr - 24.08.2011
Do not bump within 48 hours, learn to read the rules.
And if you would've taken those 1 hour and 16 minutes to actually test it yourself, which would take all of 3 minutes, you'd have your answer.
Re: [INFO]Loop -
TheBluec0de - 25.08.2011
if I create a loop with the # define ... how should I do?
Re: [INFO]Loop -
=WoR=Varth - 25.08.2011
pawn Код:
#define Loop(%0,%1) for(new %0;%0<%1;%0++)
Re: [INFO]Loop -
TheBluec0de - 25.08.2011
I asked if I do a for loop as I put it?
Re: [INFO]Loop -
DRIFT_HUNTER - 25.08.2011
pawn Код:
#define Loop(%0,%0) for(new %0 = 0; %0 < %1; %0++)
//Now you can use it as:
Loop( i, MAX_PLAYERS)
{
}
Re: [INFO]Loop -
iPLEOMAX - 25.08.2011
There is no difference in using
for(new i.. and
Loop() because it's just the exact same thing defined.
In order to avoid messy
"for(new i=0; i<MAX_PLAYERS; i++)", we define it and use
Loop(a, MAX) which looks neat and easier to do.
The real difference could be compared with
foreach() by ******.