cancelLatentEvent | Multi Theft Auto: Wiki Skip to content

cancelLatentEvent

Client-side
Server-side
Shared

Manual Review Required

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


Stops a latent event from completing

Syntax

bool cancelLatentEvent ( int handle )
Required Arguments
  • handle: A handle previous got from getLatentEventHandles .

Returns

  • bool: value

Returns a true if the latent event was successfully cancelled, or false if it was not

Code Examples

client
-- Cancel triggerLatentServerEvent directly after execution.
addCommandHandler("cancelLatentEvent",
function ()
triggerLatentServerEvent("exampleEvent",3000,false,localPlayer)
-- Get all your active handles, when you executed the command: /cancelLatentEvent
local handles = getLatentEventHandles() -- Returns a table.
local handle = handles[#handles] -- Get the latest handle.
if cancelLatentEvent(handle) then -- Cancel it!
outputChatBox("Successfully cancelled!",0,200,0)
end
end)