Is it safe to edit SysHandler?
Posted: 14 Jul 2010, 18:38
I need to get a user variable from the player who just disconnected from a room. But the user gets disconnected before the onUserLeaveRoom event is fired so I can't get the user object. So will it mess up anything if I did this to the SysHandler code?
I added 2 lines to include the variable I need in the params of the event. Is this safe to do?
Code: Select all
public function handleUserLeaveRoom(o:Object):void
{
var userId:int = int(o.body.user.@id)
var roomId:int = int(o.body.@r)
// Get room
var theRoom:Room = sfs.getRoom(roomId)
// Get user name
var uName:String = theRoom.getUser(userId).getName()
// My custom code
var place:Number = theRoom.getUser (userId).getVariable ("place");
// Remove user
theRoom.removeUser(userId)
// Fire event!
var params:Object = {}
params.roomId = roomId
params.userId = userId
params.userName = uName
params.place = place;//My custom code
var evt:SFSEvent = new SFSEvent(SFSEvent.onUserLeaveRoom, params)
sfs.dispatchEvent(evt)
}