I can see that the only variable sent to this event is the error message generated by the server, but would it be possible to add extra information both onJoinRoomError and onCreateRoomError? Currently the only way I can tell in which case things went wrong is if I set a variable before the room creation, and check which room caused the error by checking that variable behavior.
Solution:
onJoinRoomError(roomId: number, errorMsg: String)
onCreateRoomError(roomId: number, errorMsg: String)
If that is not possible, would that be a better way then what I'm doing right now?
onJoinRoomError handler
- mistermind
- Posts: 131
- Joined: 15 Sep 2007, 01:33
- Contact:
- mistermind
- Posts: 131
- Joined: 15 Sep 2007, 01:33
- Contact:
Hey Lapo
Yea that makes total sense. In fact my code handles join and creation one step at the time, which made the internal client variable control a lot easier. The only problem is that it gets a little unsafe to handle these scenarios based on internal variables instead of server responses. I mean, I got to a point where onJoinRoomError and onCreateRoomError are the key to handle concurrency, but in order to do that I had to make two variables called "joiningRoom" and "creatingRoom", that is basically fired when a user tries to join a room. Here is an example of trying to create a clan room, and if exists, he joins it.
The example above is a general idea on how I'm taking advantage of both events, but since there is no extra information on them, I'm forced to handle these issues client side, making it unsafe, highly buggy and crackable.
Yea that makes total sense. In fact my code handles join and creation one step at the time, which made the internal client variable control a lot easier. The only problem is that it gets a little unsafe to handle these scenarios based on internal variables instead of server responses. I mean, I got to a point where onJoinRoomError and onCreateRoomError are the key to handle concurrency, but in order to do that I had to make two variables called "joiningRoom" and "creatingRoom", that is basically fired when a user tries to join a room. Here is an example of trying to create a clan room, and if exists, he joins it.
Code: Select all
_root.creatingRoom = "clan";
var room:Object = new Object;
room.name = clan;
room.password = "";
room.exitCurrentRoom = false;
room.maxUsers = 10000;
smartfox.createRoom(room);
// If some other member have already created it, just join.
smartfox.onCreateRoomError = function(errorMsg){
if (creatingRoom == "clan"){
var clanRoom:Room = smartfox.getRoom(clan);
smartfox.joinRoom(clanRoom.getId(),"",false,true);
delete clanRoom;
delete creatingRoom;
}
}
The example above is a general idea on how I'm taking advantage of both events, but since there is no extra information on them, I'm forced to handle these issues client side, making it unsafe, highly buggy and crackable.
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 51 guests