With one day until my game is releasing, I have found a major bug
All of the game (apart from login and connection) is based server side, including the item parsing, room joining etc...
The problem is that the player cannot join a room they just came from. The console outputs the user is already in this room. But on the server side, it is running a _server.joinRoom.
The problem is that the leaveRoom parameter is set to true.
To fix this, I tried to add _server.leaveRoom(user, fromRoom);
This, however, made absolutely no difference
Heres the code for the joinRoom event
Code: Select all
} else if (cmd == "j") {
var rID = params[0];
if (Number(rID) == -1) {
rID = chooseStartRoom();
}
var roomObj = _zone.getRoom(Number(rID));
if (roomObj != null) {
_server.leaveRoom(user,fromRoom);
if (_server.joinRoom(user, fromRoom, true, Number(rID), null, null, false)) {
user.properties.put("x",330);
user.properties.put("y",300);
var res = [];
res[0] = "j";
res[1] = roomObj.getId();
res[2] = roomObj.getName();
var userList = roomObj.getAllUsers();
res.push("0|ZobbieBot|1|0|0|0|0|0|0|1|330|300");
for (var i in userList) {
if (userList[i].properties.get("hidden") != false && userList[i].properties.get("id") != user.properties.get("id")) {
res.push(userList[i].properties.get("id") + "|" + userList[i].getName() + "|" + userList[i].properties.get("colour") + "|" + userList[i].properties.get("head") + "|" + userList[i].properties.get("face") + "|" + userList[i].properties.get("neck") + "|" + userList[i].properties.get("body") + "|" + userList[i].properties.get("hands") + "|" + userList[i].properties.get("feet") + "|" + userList[i].properties.get("rank") + "|" + userList[i].properties.get("x") + "|" + userList[i].properties.get("y"));
}
}
_server.sendResponse(res,-1,null,[user],"str");
var userStr = user.properties.get("id") + "|" + user.getName() + "|" + user.properties.get("colour") + "|" + user.properties.get("head") + "|" + user.properties.get("face") + "|" + user.properties.get("neck") + "|" + user.properties.get("body") + "|" + user.properties.get("hands") + "|" + user.properties.get("feet") + "|" + user.properties.get("rank") + "|" + user.properties.get("x") + "|" + user.properties.get("y");
_server.sendResponse(["ap", userStr],-1,null,userList,"str");
} else {
_server.sendResponse(["j", "0", "10"],-1,null,[user],"str");
}
} else {
_server.sendResponse(["j", "0", "3"],-1,null,[user],"str");
}
}In case they are needed, here are the errors that are represented by numbers
Error 3: System error, room not found
Error 10: Room Full, try again later
And the error that is returned is code 10, but the debug is that the user is already in the room.
Why isn't the leaveRoom function working?