About y_iterate
#1

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.
Reply
#2

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)