Forum Multiplayer How do I manually close a room?

Discussion and help relating to the PlayerIO Multiplayer API.

How do I manually close a room?

Postby Vania » May 12th, 2010, 4:28 pm

I want to close the room as soon as everybody leaves.
In the documentation about userLeft it says the following:

public virtual void UserLeft (P player)
Called whenever a client leaves the group. If the return value is true, the group is closed.


But that method has no return value. So how do I close the room?
Also, how do I set a maximum number of players if I want for example just 2 players per room?
Vania
 
Posts: 198
Joined: March 24th, 2010, 9:01 pm

Re: How do I manually close a room?

Postby Oliver » May 13th, 2010, 11:36 am

Hi again vania :)

Woops, that's an oversight in the documentation; as you point out, there is no return value... It's been changed now to
"Called whenever a client leaves the room. The room is closed when the last person leaves the room."

If you want to have a room with only two players, override the AllowUserJoin(P player) method, and return false when there are two players in the room already.

Btw, Love the level of engagement you've got going! Keep 'em coming!

- Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: How do I manually close a room?

Postby Vania » May 13th, 2010, 10:09 pm

Thanks Oliver!

If you want to have a room with only two players, override the AllowUserJoin(P player) method, and return false when there are two players in the room already.


Yup, figured that one out and its working.
Vania
 
Posts: 198
Joined: March 24th, 2010, 9:01 pm


Return to Multiplayer