_server.switchPlayer()

Availability:

SmartFoxServer PRO 1.6.6

Usage:

_server.switchPlayer(user, roomId, broadcastAll)

Description:

Switch a player into a spectator in a game room, provided that at least one free spectator slot is available. This method is the equivalent of the switchPlayer() request from the client side API.

Properties:

user   the user to switch
roomId   the id of the room where the switch should be done
broadcastAll   (optional) boolean flag. If true the onPlayerSwitched() event will be fired.

Returns:

Nothing

Example:

// Switch a player into a spectator
_server.switchPlayer(theUser, theRoomId)

See also: