1
0
Fork 0
forked from Simnation/Main
Main/resources/[tools]/mt_lib/modules/interface/timer/client.lua
2025-06-25 00:04:15 +02:00

39 lines
No EOL
861 B
Lua

local currentTimerOnFinish = nil
---@param label string
---@param time number
---@param position string
---@param onFinish function
local showTimer = function(label, time, position, onFinish)
currentTimerOnFinish = onFinish
SendNUIMessage({
action = 'timer',
data = {
label = label,
time = time,
position = position,
}
})
SendNUIMessage({
action = 'setVisibleTimer',
data = true
})
end
exports("showTimer", showTimer)
local hideTimer = function()
SendNUIMessage({
action = 'setVisibleTimer',
data = false
})
currentTimerOnFinish = nil
end
exports("hideTimer", hideTimer)
RegisterNuiCallback('finishTimer', function(data, cb)
if currentTimerOnFinish then
currentTimerOnFinish()
hideTimer()
end
cb(true)
end)