SmartFoxServer Unity/.NET API
CreateRoom Method (roomObj, roomId)
NamespacesSmartFoxClientAPISmartFoxClientCreateRoom(Hashtable, Int32)
Dynamically create a new room in the current zone.
Declaration Syntax
C#Visual BasicVisual C++
public void CreateRoom(
	Hashtable roomObj,
	int roomId
)
Public Sub CreateRoom ( _
	roomObj As Hashtable, _
	roomId As Integer _
)
public:
void CreateRoom(
	Hashtable^ roomObj, 
	int roomId
)
Parameters
roomObj (Hashtable)
a Hashtable 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).
Remarks

*DEPRECATED*
Use object based CreateRoom instead of hashtable based

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

Examples
The roomObj parameter is an object containing the following properties:
termdescription
name
(string) the room name.
password
(string) a password to make the room private (optional, default: none).
maxUsers
(int) the maximum number of users that can join the room.
maxSpectators
(int) in game rooms only, the maximum number of spectators that can join the room (optional, default value: 0).
isGame
if true, the room is a game room (optional, default value: false).
exitCurrentRoom
(bool) if true and in case of game room, the new room is joined after creation (optional, default value: true).
uCount
(bool) if true, the new room will receive the SFSEvent..::.OnUserCountChangeDelegate notifications (optional, default recommended value: false).
vars
(Hashtable) an hashtable of Room Variables, as described in the SetRoomVariables(ArrayList, Int32, Boolean) method documentation (optional, default: none).
extension
(Hashtable) which extension should be dynamically attached to the room, as described farther on (optional, default: none).

A Room-level extension can be attached to any room during creation; the extension property in the roomObj parameter is an object with the following properties:
termdescription
name
(string) the name used to reference the extension (see the SmartFoxServer server-side configuration).
script
(string) the file name of the extension script (for Actionscript and Python); if Java is used, the fully qualified name of the extension must be provided. The file name is relative to the root of the extension folder ("sfsExtensions/" for Actionscript and Python, "javaExtensions/" for Java).

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);
See Also

Assembly: SmartFoxClient (Module: SmartFoxClient) Version: 1.2.4.0 (1.2.4.0)