Forum Multiplayer Setting the max players in a room to 6

Discussion and help relating to the PlayerIO Multiplayer API.

Setting the max players in a room to 6

Postby Jhonybhai » June 21st, 2019, 11:41 am

Hello everyone,,
Newbie question. I just started looking into Player.io and I've got a test script connecting to the server, but I want to set a limit on the number of players that can join a room. I know the default is 45, but I'm only looking for 6 max players.

Is there a way to configure this or do I have to do a search for rooms with less than 6 players in them before joining/creating.
youporn.wiki/ xhamster.vip/ redtube.onl/
Any help is much appreciated!!!!
Last edited by Jhonybhai on June 26th, 2019, 6:10 pm, edited 1 time in total.
Jhonybhai
 
Posts: 1
Joined: June 21st, 2019, 11:34 am

Re: Setting the max players in a room to 6

Postby robscherer123 » June 21st, 2019, 4:15 pm

There are probably a few ways to go about this. How exactly do you want the situation to go? For example are you showing a list of available rooms to the client, and letting them choose which one to join? If that's the case, you could put a simple if() statement on the client that displays a message if they try to join a room with 6 or more players. Whenever you make a call to the ListRooms() method, it gives you an array of RoomInfo objects. RoomInfo objects have a property called onlineUsers, which you can use that.

Then, on the server you could also put a check inside the AllowUserJoin() method which disconnects the player if there are already 6 or more in the room. Optionally, you could hide rooms if they are 6 or players in them already as well, by setting a rooms visible property to false. If you need further help I can post how.


*note to staff: The documentation page for RoomInfo for the Unity and Javascript client doesn't exist.
robscherer123
Paid Member
 
Posts: 304
Joined: December 12th, 2012, 8:46 pm


Return to Multiplayer



cron