[HELP] Room Creation

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

Moderators: Lapo, Bax

Post Reply
reecedogcp78
Posts: 71
Joined: 12 Dec 2010, 18:16

[HELP] Room Creation

Post by reecedogcp78 »

Okay so im coding houses for my game and I have a problem,

How do I check if a room already exists?
~Reecedog,

Experienced blogger with 100 thousand hits gathered.

New to SFS But also very good with it :)
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post by rjgtav »

Hi. You can check it in the client-side or in the server-side:

[Client-Side]

You can get a room by its id (http://www.smartfoxserver.com/docs/docP ... ml#getRoom), or you can loop through all the rooms inside the roomList and check its names.

[Server-Side]

You can get a room by its name (or by its id), in the Zone class:

http://www.smartfoxserver.com/docs/docP ... s/Zone.htm

Then, if it returns null, its because the room doesn't exist, if not, the room exists.
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.
Post Reply