Dynamically create a new room in the current zone.
| C# | Visual Basic | Visual C++ |
public void CreateRoom( NewRoomDescriptor roomObj, int roomId )
Public Sub CreateRoom ( _ roomObj As NewRoomDescriptor, _ roomId As Integer _ )
public: void CreateRoom( NewRoomDescriptor^ roomObj, int roomId )
- roomObj (NewRoomDescriptor)
- a NewRoomDescriptor object with the properties described farther on.
- roomId (Int32)
- the id of the room from where the request is originated, in case the application allows multi-room join (optional, default value: activeRoomId).
Sends:
SFSEvent..::.OnRoomAddedDelegate
SFSEvent..::.OnCreateRoomErrorDelegate
NOTE:
if the newly created room is a game room, the user is joined automatically upon successful room creation.
Version:
SmartFoxServer Basic / Pro
The following example shows how to create a new room.
CopyC#
Hashtable roomObj = new Hashtable(); roomObj.Add("name", "The Cave"); roomObj.Add("isGame", true); roomObj.Add("maxUsers", 15); ArrayList variables = new ArrayList(); variables.Add( new RoomVariable("ogres", 5, true, false) ); variables.Add( new RoomVariable("skeletons", 4) ); roomObj.Add("vars", variables); smartFox.CreateRoom(roomObj);