foreach next iteration
#1

It is possible to find out what value is next in a foreach iteration?

For example, take the 'Player' iter, with the following IDs in:

1
5
7
8

Obviously if you did a foreach loop on this iter, you'd look through 1, 5, 8 and 9. What I need to be able to do, is find out what value comes after '5' (7). Is this at all possible? I'm talking about outside a foreach() loop.

I'm making a spectating system, and when you're spectating player ID 5, and you press the right arrow key, it needs to move on to ID 7 (next ID in the iter). I don't want to use a normal loop (MAX_PLAYERS).
Reply
#2

I have no idea but you can try:
pawn Код:
SpectatingPlayer[playerid] = Itter_Next(Player, SpectatingPlayer[playerid]);

PlayerSpectatePlayer(playerid, SpectatingPlayer[playerid]);
and same with Itter_Prev, in my opinion simply is normal loop + GetPlayerPoolSize
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)