SA-MP Forums Archive
foreach question. - 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: foreach question. (/showthread.php?tid=370218)



foreach question. - Shetch - 19.08.2012

Hey guys!
Umm, I wanted to know what exactly does these lines mean and what are they used for.
Would somebody be so kind and fully explain it to me? (and yes, i have read the foreach post)

Код:
new Iterator:Some<10>; // I do not know what does the '<10>' mean and why do I need it there.
Iter_Add(Some, 5);
Iter_Add(Some, 9);



Re: foreach question. - Shetch - 19.08.2012

Ahh, I get it now.

Thank you very much!


But let's say I want to loop through all the vehicles on the server, how would I do that?

Код:
new Iterator:Vehicles<MAX_VEHICLES>;
foreach (new i : Vehicles)
{
    printf("%d", i);
}
would that work?