cancelLatentEvent
Client-side
Server-side
Shared
Stops a latent event from completing.
Client Syntax
bool cancelLatentEvent ( int handle )Required Arguments
- handle: A handle previous got from getLatentEventHandles.
Returns
- bool: result
Returns a true if the latent event was successfully cancelled, otherwise false.
Server Syntax
bool cancelLatentEvent ( player thePlayer, int handle )Required Arguments
- thePlayer: The player who is receiving the event.
- handle: A handle previous got from getLatentEventHandles.
Returns
- bool: result
Returns a true if the latent event was successfully cancelled, otherwise false.
Code Examples
client
-- *****************************************************************************-- CLIENT CODEaddCommandHandler("cancelLatentEvent", function() triggerLatentServerEvent("exampleEvent", 3000, false, localPlayer) 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) endend)
-- *****************************************************************************-- SERVER CODEaddEvent("exampleEvent", true)addEventHandler("exampleEvent", root, function() outputChatBox("Warning! The triggerLatentServerEvent wasn't cancelled!", client, 255, 0, 0) -- warn the user.end)