createRoom - Game Room

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

arun8483
Posts: 33
Joined: 15 Dec 2010, 02:35
Contact:

createRoom - Game Room

Postby arun8483 » 16 Mar 2012, 13:05

Room newRoom = helper.createRoom(zone, map, user, roomVars, null, true, true, true);
As per document, assigning a valid user as the creator make the user as the owner of this room and the room will be destroyed when the last user leaves the room.
But whats the purpose of the 5th argument, "varsOwner".
is it for setting the roomVariables owner???
If so how long the room variables will live????
will it get destroyed when the owner leaves the room??? or when the last user leaves the room. ie when room gets destroyed???
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: createRoom - Game Room

Postby rjgtav » 18 Mar 2012, 22:09

Hello.
Well, the owner parameter is for specifying the owner of that variable. If you specify null as the owner, the server will be the owner of those variables.
If a variable is private, only its owner can modify it. If it isn't, then any user can modify it, and the owner value changes to the last user who edited the variable.
Now regarding a variable's lifetime. If the variable is not persistent, then it will be removed when the owner leaves the room. But if the variable is persistent, then it will only get removed after that user disconnects from the server. Of course that if you specify null as the owner and set the variable to persistent, then it will get removed.

Note: When a room is removed, all of its room variables are destroyed, even if their owner is still connected.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 57 guests