addEvent | Multi Theft Auto: Wiki Skip to content

addEvent

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function allows you to register a custom event. Custom events function exactly like the built-in events. See event system for more information on the event system.

Syntax

addEvent ( )

Code Examples

server

This example will define a new event calledonSpecialEvent.

-- Add a new event called onSpecialEvent
addEvent ( "onSpecialEvent", true )
-- Define our handler function, that takes a "text" parameter and outputs it to the chatbox
function specialEventHandler ( text )
outputChatBox ( text )
end
-- Add it as a handler for our event
addEventHandler ( "onSpecialEvent", root, specialEventHandler )