Engine.AddEventHandler
Jump to navigation
Jump to search
Function
function bool Engine.AddEventHandler(eventName, handler);
Arguments
- eventName
- The name of the event to listen for. See Server Scripting Events for some events you can listen for.
- handler
- The function to call when the event happens.
Description
This function will add a handler for the event you specify.
Returns
The function returns true if the handler was successfully added, false otherwise.
Example
// Add a handler for when a player joins the server to give them a nice greeting.
//
Engine.AddEventHandler("OnPlayerJoin",function(player){
Engine.OutputChatBox("Hello " + Engine.GetPlayerName(player) + ", thanks for joining!",player);
});
Notes
Take care with event names as they could be case sensitive in future versions, currently as of 0.1.3 event names are not case sensitive. This could change in the future.