getEventHandlers | Multi Theft Auto: Wiki Skip to content

getEventHandlers

Client-side
Server-side
Shared

This function gets the attached functions from the event and attached element from current lua script.

Important

This function only checks the current script.

Syntax

table getEventHandlers ( ​string eventName, ​element attachedTo )
Required Arguments
  • eventName: The name of the event.
  • attachedTo: The element attached to.

Returns

  • table: result

Returns table with attached functions, otherwise empty table.

Code Examples

client

This example removes all onClientMarkerHit event.

local events = getEventHandlers("onClientMarkerHit", resourceRoot)
for i, v in ipairs(events) do
removeEventHandler("onClientMarkerHit", resourceRoot, v)
end