ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. removeEventHandler

Function

removeEventHandler

Server and clientEventsIdentical to MTA:SA

Detaches a function from an event. You must pass the same name, element and the same function (the same variable) as in addEventHandler - an anonymous function written again is a different function.

Syntax

bool removeEventHandler(string eventName, element attachedTo, function functionVar)

Arguments

eventNamestring
Event name.
attachedToelement
The element the function is attached to.
functionVarfunction
The same function.

Returns

true when detached; false when it was not attached.

Example

local function drawSpeed()
    dxDrawText("Predkosc", 20, 20)
end
addEventHandler("onClientRender", root, drawSpeed)
setTimer(function() removeEventHandler("onClientRender", root, drawSpeed) end, 10000, 1)

See also