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



converting to foreach - RedFusion - 25.08.2012

How do i convert this:
pawn Код:
for(new i=0; i < sizeof(ZoneInfo); i++)
into a foreach line?


Re: converting to foreach - martin149 - 25.08.2012

https://sampforum.blast.hk/showthread.php?tid=157200


AW: converting to foreach - Nero_3D - 25.08.2012

You should not use foreach if you want to loop through all elements
foreach is there if you want to loop through parts of all available slots
As example if you want to loop only through the 20 connected players not through all 500 slots

But it seems that your code should loop through all elements


Re: converting to foreach - RedFusion - 25.08.2012

I rather have it explained than getting an url with someone who doesnt solve the problem..
Edit: Got it


Re: converting to foreach - Pangea - 25.08.2012

We rather have people search the forums before posting a new thread that has been posted before as well, but that's not gonna happen either.


Re: converting to foreach - clarencecuzz - 25.08.2012

Owned. ^^

I don't really use foreach for things other than player looping.
The thread really explains it clearly, more than most other people can.


Re: converting to foreach - RedFusion - 25.08.2012

Quote:
Originally Posted by Pangea
Посмотреть сообщение
We rather have people search the forums before posting a new thread that has been posted before as well, but that's not gonna happen either.
Yeah but posting an url with the same problem, with no sullotion isnt very smart.. duh.


Re: converting to foreach - RedFusion - 25.08.2012

Looked more carefully now. Thanks.