forked from multitheftauto/wiki.multitheftauto.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetLatentEventHandles-1.lua
More file actions
19 lines (18 loc) · 881 Bytes
/
getLatentEventHandles-1.lua
File metadata and controls
19 lines (18 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- *****************************************************************************
-- CLIENT CODE
local lastTriggerd = false
addCommandHandler("trigger",function()
local triggers = getLatentEventHandles() -- get all latent events
if triggers[lastTriggerd] then -- you can use (getLatentEventStatus) too!
outputChatBox("Wait until the trigger ("..lastTriggerd..") ends!",255,0,0)
return
end
triggerLatentServerEvent("LatentEventsCheck",20000,resourceRoot,localPlayer)
lastTriggerd = #getLatentEventHandles() -- set the lastTriggerd with the id for last event triggerd
end)
-- *****************************************************************************
-- SERVER CODE
addEvent("LatentEventsCheck",true)
addEventHandler("LatentEventsCheck",root,function (thePlayer)
outputChatBox("Latent trigger done from: " .. getPlayerName(thePlayer), root,math.random(255),0,0)
end)