Error opening room

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Post Reply
Sharkguy95
Posts: 17
Joined: 02 Jun 2010, 16:25

Error opening room

Post by Sharkguy95 »

Hi, I am having trouble logging into my game. I have 3 different zones, and the one I use, connects to a database and retrieves usernames and passwords. The problem is, when I try to login to that zone, it says the room does not exist... Even though I know it does, because I check every time in the config file. When I switch over to simpleChat where it just needs a username, it works fine! So why is this? I think I know why but I dont know how to fix it.

In order to login using the usernames and passwords of players, there is a function for onExtentionResponce. This is where I think the problem is because when your not using accounts, it wont use that part. Here is the onExtentionResponce part:

Code: Select all

//----------------------------------------------------------
// The server must handle an extention response
//----------------------------------------------------------
smartfox.onExtensionResponse = function(resObj:Object) { 
        if (resObj._cmd == "logOK") { 
                // Login Success Example Code
	gotoAndPlay("chat")
	smartfox.joinRoom("The Hall")
                _global.myName = resObj.name 
        } else if (resObj._cmd == "logKO") { 
                // Login failed example code 
                _global.isBusy 	= true
	_root.status_txt.text = "Something has gone wrong. Please refresh the page and try logging in again.";
	redoLogin();
        } 
}

I also thought this would be helpful! Here is the output of me running the game:

Code: Select all

[Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='140' /></body></msg>

[Received]: <cross-domain-policy><allow-access-from domain="*" to-ports="9349" /></cross-domain-policy>
[Received]: <msg t="sys"><body action="apiOK" r="0" /></msg>
[Sending]: <msg t='sys'><body action='login' r='0'><login z='Island of Turtles'><nick><![CDATA[Billybob]]></nick><pword><![CDATA[********]]></pword></login></body></msg>

[Received]: <msg t="xt"><body action="xtRes" r="-1"><dataObj><var n=&apos;err&apos; t=&apos;s&apos;></var><var n=&apos;_cmd&apos; t=&apos;s&apos;>logOK</var></dataObj></body></msg>
SmartFoxError: requested room to join does not exist!
[Sending]: <msg t='sys'><body action='loadB' r='-1'></body></msg>

[Received]: <msg t="sys"><body action="bList" r="-1"><bList /></body></msg>
Does anyone know how to fix this? Because I know its not the rest of the coding becasue it all works fine on the zone simpleChat. And if anyone is wondering, the logOK is just saying that the user and pass are right.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

You are not sending the Room List to the client so when the user attempts to join a Room the client API complain that they know nothing about the Room.

Call the getRoomList() method after the login response and handle the onRoomListUpdate event. In the even you can join the Room
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply