Room destroy

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:

Room destroy

Postby arun8483 » 19 Mar 2012, 10:18

Hi,
Is it possible to change the owner of room, after creating the room with server as the owner...??????.
I have tried setting setCreator()..But even after all players left the room, room didn't destroy.....
ie,
1) I've created a room with server as the owner( passed null for owner)
2) I am changing the owner using setCreator to a randoom User when game starts in that particular room.
3) FInally, when game ends, I am expecting the room to be destroyed automatically according to the docs...
But the room is not getting destroyed.....
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Room destroy

Postby rjgtav » 19 Mar 2012, 22:11

Hello.
Yes, if you specify null as the owner, the room will only get removed after a server restart. In this scenario, I suggest you to create those rooms with a null owner and then have an extension controlling the rooms. When the game ends, you can simply destroy the room from the extension (using the destroyRoom() method if you'r using an AS Extension - or ExtensionHelper.destroyRoom() in case of a Java extension).
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.
arun8483
Posts: 33
Joined: 15 Dec 2010, 02:35
Contact:

Re: Room destroy

Postby arun8483 » 20 Mar 2012, 07:29

Hi,
I have to consider one more scenario...
1) How to find out If room is empty???
a) I have two scenarios, when a player press leave table button, I am calling leaveRoom in the server side, this call inturn calls handleInternalEvent. Now I am checking the total players length in this room, I am getting the total as 0 in this case.
b) When I close flash player(browser), userLost is getting called in handleInternalEvent, now the total length of the room is "1".

So where to decide the room destruction???????????
How to find out the room is empty????????
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Room destroy

Postby rjgtav » 20 Mar 2012, 19:44

Well, are you using the getUserCount() method of the room object? If you instead use getUserList() (which returns an array) and then get that array's length, doesn't it either work? And are you using a Zone-Level or a Room-Level extension to handle those events?
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.
arun8483
Posts: 33
Joined: 15 Dec 2010, 02:35
Contact:

Re: Room destroy

Postby arun8483 » 21 Mar 2012, 06:22

Yea...both are not working....when last player leaves the room....I am getting the count as "1" not 0. is that how it works?????
Room Level extension....

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 48 guests