-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
38 lines (29 loc) · 933 Bytes
/
Copy pathclient.lua
File metadata and controls
38 lines (29 loc) · 933 Bytes
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
function openGui(color,message,time)
guiEnabled = true
SendNUIMessage({runProgress = true, colorsent = color, textsent = message, fadesent = time})
end
function closeGui()
guiEnabled = false
SendNUIMessage({closeProgress = true})
end
RegisterNetEvent("notifications:sendNotification")
AddEventHandler("notifications:sendNotification", function(color,message,time)
openGui(color,message,time)
end)
RegisterNetEvent("notifications:closeUI")
AddEventHandler("notifications:closeUI", function()
closeGui()
end)
RegisterCommand('testnotfy', function(source, args, raw)
local color = 1 -- success
local msg = 'Test notification from QB Notify'
local time = 5000
if args and #args > 0 then
local n = tonumber(args[1])
if n then color = n end
if #args > 1 then
msg = table.concat(args, ' ', 2)
end
end
openGui(color, msg, time)
end, false)