Returns the indicated player number. This function guarantees that for values from 0 to GetPlayerCount()-1 a valid player number will be returned (notice that there may be "gaps" between player numbers in case some players have left the game). This makes it easier to process all players in a loop.
Syntax
int GetPlayerByIndex(int index, int player_type);
Parameters
index:
Index in the player table.
player_type:
[opt]
If specified, the indicated player of the specified type is returned. This can be used e.g. to walk only through the list of human players or only through the list of script players. For a list of all player types see GetPlayerType.