Internal Event :: roomLost

Availability:

SmartFoxServer PRO 1.2.1

Event name:

roomLost

Description:

This event is fired each time a room is destroyed in the Zone where the extension is attached to.
The event is available only for both Zone Level extensions.

NOTE: It is always reccomended to keep track of Rooms by using their unique id. For example you can keep a local list of rooms with their id as the key.
When a room is destroyed you will always receive its id.

Properties:

name   description type
roomId   The Room object object

Example:

// We handle the event and remove the room from our local list
function handleInternalEvent(evtObj)
{
	if (evtObj.name == "roomLost")
	{
		var rId = evt.roomId
		
		// Get the room
		var gameRoom = gameRooms[rId]
		
		// If the room is in our list
		// perform the necessary logic for your game/app here
		if (gameRoom != null)
		{
			// Game logic here...
		}
		
		// Finally delete the room from our local list
		delete gameRooms[rId]
		
	}
}

See also: