-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
59 lines (51 loc) · 1.58 KB
/
Copy pathclient.lua
File metadata and controls
59 lines (51 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local progressActive = false
local progressCallback = nil
RegisterNUICallback('finish', function(_, cb)
if progressActive and progressCallback then
progressCallback(true)
end
progressActive = false
SetNuiFocus(false, false)
cb('ok')
end)
function ShowProgressbar(text, time, cb, itemImage)
if progressActive then return end
progressActive = true
progressCallback = cb
SetNuiFocus(false, false)
local msg = {
action = 'show',
text = text,
time = time
}
if itemImage then
msg.itemImage = itemImage
end
SendNUIMessage(msg)
end
function HideProgressbar()
SendNUIMessage({action = 'hide'})
progressActive = false
end
exports('progressbar', ShowProgressbar)
exports('hideProgressbar', HideProgressbar)
RegisterNetEvent('infinity-progress:show')
AddEventHandler('infinity-progress:show', function(text, time, itemImage)
ShowProgressbar(text, time, nil, itemImage)
end)
RegisterNetEvent('infinity-progress:hide')
AddEventHandler('infinity-progress:hide', function()
HideProgressbar()
end)
RegisterNetEvent('infinity-progress:serverShow')
AddEventHandler('infinity-progress:serverShow', function(text, time, itemImage)
ShowProgressbar(text, time, nil, itemImage)
end)
-- Comando para testar o export no client
RegisterCommand('pc', function()
exports['infinity-progress']:progressbar('Testing client export...', 4000, function(success)
if success then
print('Client progress finished!')
end
end, '')
end)