Private createSFSgame without inviteelist

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

vinod11
Posts: 11
Joined: 30 Nov 2017, 18:34

Private createSFSgame without inviteelist

Postby vinod11 » 09 May 2018, 18:19

Hi is it possible to createSFSGame with password but not with invite user list? in my game I want to create game room which is open for anyone who knows the password.
Without invitee list I am getting following error:
java.lang.NullPointerException
at com.smartfoxserver.v2.api.SFSGameApi.populateInvitations(SFSGameApi.java:361)
at com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:153)
at common.BaseGameManager.createSFSGameRoom(BaseGameManager.java:201)
at common.BaseGameManager.createGameRoom1(BaseGameManager.java:153)
at com.zone.managers.GameManager.createGameRoom(GameManager.java:695)
at com.zone.managers.GameManager.manageAllGames(GameManager.java:154)
at com.zone.extension.LobbyExtension$GameManagerTask.run(LobbyExtension.java:367)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Private createSFSgame without inviteelist

Postby Lapo » 10 May 2018, 08:11

Hi,
with the SFSGame room you have two options:

1) public Room, allows people to join freely provided that they match certain criteria you provide (based on User Variables)
2) private Room, allows only invited people to join

If you're going to create a private Room and then give passwords to a group of people I think option #2 gives you the same result, and saves you some work.

You just need to provide the list of people you want in the Room and you don't need to worry about passing passwords around to everyone.

Makes sense?
Lapo
--
gotoAndPlay()
...addicted to flash games
vinod11
Posts: 11
Joined: 30 Nov 2017, 18:34

Re: Private createSFSgame without inviteelist

Postby vinod11 » 10 May 2018, 12:55

I am sorry seems I was not clear on my question , actually I dont have any specific userlist.. in my lobby I show rooms(created from server) some are password protected and some are not.. if anyone want to join a password protected room he must enter the password.
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Private createSFSgame without inviteelist

Postby Lapo » 10 May 2018, 14:29

Ok.
Normally private SFSGame rooms work with invitations.
You could create a private SFSGame and pass an empty list of invitees. This would work as well. Keep in mind that the password for SFSGame rooms is auto-generated from the server side, so you can't set a custom one.

What you can do is read the password via Room.getPassword() and send it to those you want to join.

hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 66 guests