Page 1 of 1

Close Game Room

Posted: 07 Jan 2018, 17:18
by KVADRO
Hello!
How to close game room from extension to prevent players join through 'quickJoinGame' ?

Re: Close Game Room

Posted: 08 Jan 2018, 08:50
by Lapo
Under SFS2X you can do this:

Code: Select all

theRoom.setActive(false);

This will deny access to all players, until the "active" flag is set back to true.

If you're asking for the old SFS PRO, there isn't a similar mechanism, but it can be "emulated". Can you explain what you're trying to do?

Cheers

Re: Close Game Room

Posted: 08 Jan 2018, 10:43
by KVADRO
Hi Lapo.

I need somehow to prevent players to join room when some conditions went true. And i think 'setActive' will fit my requirements.
But you said that room will become 'inactive', it means that this room will not receive any events/requests?

Thanks!

Re: Close Game Room

Posted: 08 Jan 2018, 14:39
by Lapo
Yeah, the inactivation of a Room is useful when no one is inside.
Otherwise I'd recommend using a server-side check. Either:

1) Send you join requests to your Extension and perform the "check logic" there, before joining
or
2) Implement a request filter, which works in a similar manner: by running your custom code before a system request (such as joinRoom) is executed. More on this here:
http://docs2x.smartfoxserver.com/Advanc ... er-filters

Hope it helps