SA-MP Forums Archive
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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: foreach (/showthread.php?tid=190113)



foreach - ReVo_ - 14.11.2010

how to get total of elements in foreach iteration

Exemple i have iteration Player how to get total of players ?

If i have iteration 'Wef'

Iter_Add(Wef,0);
Iter_Add(Wef,1);
Iter_Add(Wef,2);
Iter_Add(Wef,3);


Exist function for get total of elements in the iteration ?

Exmple:
Код:
new total = Iter_Elements(Wef);
printf(" iteration have %d elements",total);
and return for exmple 4


Re: foreach - Simon - 14.11.2010

You should post in the foreach topic... the topic deserves more exposure by bumping.

Anyways, to answer your question you use Itter_Count(name) as documented in the foreach topic itself; so for example you would do Itter_Count(Wef).


Re: foreach - ReVo_ - 14.11.2010

Uhm, thx man