22.11.2015, 23:27
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).
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).