getPlayerId()
Availability:
SmartFoxServer Lite / Basic / Pro
Usage:
smartFox.getPlayerId()
Description:
A number representing the id of the client as a player. Available only after the client joined a game room.
Once a client joins a game room he's automatically assigned a player slot or id, based on the player slots available in the room at the moment in which the
user entered.
Example #1: in a game room for 2 players the first user who
joins becomes player 1 (playerId = 1) and the second user who joins becomes
player two (player = 2)
Example #2: in a game room for 4 player where only player 3 is missing the next client who will join will be player 3 (playerId = 3)
Example #3: if the user logged in the game room as a "spectator"
his playerId will be always set to -1
The variable is available only after a successfull login in a game room.
Parameters:
none |
Returns:
Returns an integer representing the id of the client as a player.
Example:
put("I am player " & smartFox.getPlayerId())
See also:
login()