The current user's id as a player in a game room.
The playerId is available only after the user successfully joined a game room. This id is 1-based (player 1, player 2, etc.), but if the user is a spectator or the room is not a game room, its value is -1.
When a user joins a game room, a player id (or "slot") is assigned to him/her, based on the slots available in the room at the moment in which the user entered it; for example:
The playerId is available only after the user successfully joined a game room. This id is 1-based (player 1, player 2, etc.), but if the user is a spectator or the room is not a game room, its value is -1.
When a user joins a game room, a player id (or "slot") is assigned to him/her, based on the slots available in the room at the moment in which the user entered it; for example:
- in a game room for 2 players, the first user who joins it becomes player one (playerId = 1) and the second user becomes player two (player = 2);
- in a game room for 4 players where only player three is missing, the next user who will join the room will be player three (playerId = 3);


NOTE:
if multi-room join is allowed, this property contains only the last player id assigned to the user, and so it's useless.
In this case the GetMyPlayerIndex()()() method should be used to retrieve the player id for each joined room.
Version:
SmartFoxServer Basic / Pro

The following example shows how to retrieve the user's own player id.
CopyC#

Debug.WriteLine("I'm player " + smartFox.playerId);