forked from Simnation/Main
edit
This commit is contained in:
parent
be02d05ba8
commit
fc7ea910e9
35 changed files with 11992 additions and 1 deletions
39
resources/[tools]/mt_lib/modules/interface/timer/client.lua
Normal file
39
resources/[tools]/mt_lib/modules/interface/timer/client.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
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)
|
Loading…
Add table
Add a link
Reference in a new issue