Turn a spectator inside a game room into a player.
All spectators have their player id property set to -1; when a spectator becomes a player, his player id gets a number > 0, representing the player number. The player id values are assigned by the server, based on the order in which the players joined the room.
If the user joined more than one room, the id of the room where the switch should occur must be passed to this method.
The switch operation is successful only if at least one player slot is available in the room.
All spectators have their player id property set to -1; when a spectator becomes a player, his player id gets a number > 0, representing the player number. The player id values are assigned by the server, based on the order in which the players joined the room.
If the user joined more than one room, the id of the room where the switch should occur must be passed to this method.
The switch operation is successful only if at least one player slot is available in the room.


- roomId (Int32)
- the id of the room where the spectator should be switched, in case of multi-room join (optional, default value: activeRoomId).

Sends:
SFSEvent..::.OnSpectatorSwitchedDelegate
Version:
SmartFoxServer Basic / Pro

The following example shows how to turn a spectator into a player.
CopyC#

SFSEvent.onSpectatorSwitched += OnSpectatorSwitched; smartFox.SwitchSpectator(); public void OnSpectatorSwitched(bool success, int newId, Room room) { if (success) Debug.WriteLine("You have been turned into a player; your player id is " + newId); else Debug.WriteLine("The attempt to switch from spectator to player failed"); }