SA-MP Forums Archive
About y_iterate - 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: About y_iterate (/showthread.php?tid=646796)



About y_iterate - None1337 - 23.12.2017

I want to use

Multi-Iterators

Something like: new Iterator:Job[MAX_JOB]<MAX_PLAYERS>;

But, where should I put Iter_Init(Job); ?

I really don't know.


Re: About y_iterate - Konstantinos - 24.12.2017

Iter_Init should be called once when the mode starts (in OnGameModeInit/OnFilterScriptInit). If you use the latest version of YSI 4, a player can belong to only 1 job so you can use the optimized version of multi-iterator:
pawn Код:
new Iterator:Job<MAX_JOB, MAX_PLAYERS>;
in this case, you do not need to use Iter_Init function. The only difference except the MAX_JOB + MAX_PLAYERS instead of MAX_JOBS * MAX_PLAYERS is the usage. In the old version, you would use:
pawn Код:
foreach (new i : Job[job_id])
which now becomes:
pawn Код:
foreach (new i : Job<job_id>)
For more information: https://sampforum.blast.hk/showthread.php?tid=571159