Get Player By Id
public Player GetPlayerById(byte playerId)
Returns a Player object with information about the player whose number id matches the playerId input parameter. From this object you can get the player’s resources and other info about this player. Throws ArgumentOutOfRangeException, if there is no player with such an id ingame.
Example
[Inject] PlayersService players;
// this example code can be run from any script
Player player = players.GetPlayerById(2); // getting player with id 2. Note that this can cause an error, if there
// are fewer players ingame than the id you entered as a parameter of this method.
Debug.Log("Player 3 name: " + player.UserName); // log the name of this player to the console. This is player 3,
// because numbering starts from 0, and index 2 is the 3rd player.