Dispatched in response to the SwitchPlayer(Int32) request.
The request to turn a player into a spectator may fail if another user did the same before your request, and there was only one spectator slot available.
The request to turn a player into a spectator may fail if another user did the same before your request, and there was only one spectator slot available.
Version:
SmartFoxServer Pro
The following example shows how to check the handle the player switch.
CopyC#
SFSEvent.onPlayerSwitched += OnPlayerSwitched; smartFox.SwitchPlayer(); public void OnPlayerSwitched(bool success, int newId, Room room) { if (success) Trace.WriteLine("You have been turned into a spectator; your id is " + newId); else Trace.WriteLine("The attempt to switch from player to spectator failed"); }