-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclient.lua
More file actions
41 lines (34 loc) · 852 Bytes
/
client.lua
File metadata and controls
41 lines (34 loc) · 852 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
38
39
40
41
RegisterNetEvent('ms-notify:sendAlert')
AddEventHandler('ms-notify:sendAlert', function(data)
SendAlert(data)
end)
RegisterNetEvent('ms-notify:removeAlert')
AddEventHandler('ms-notify:removeAlert', function(id)
RemoveAlert(id)
end)
RegisterCommand('testnotify', function()
SendAlert({ id = 'Test', text = 'This is a test normal notification!', type = 'normal', icon = 'fas fa-question-circle', align = 'top-center' })
end)
RegisterCommand('removenotif', function()
RemoveAlert('Test')
end)
function SendAlert(data)
SendNUIMessage({
id = data.id,
text = CleanText(data.text),
type = data.type,
icon = data.icon,
time = data.time,
align = data.align
})
end
function RemoveAlert(id)
SendNUIMessage({
id = id,
delete = true
})
end
function CleanText(text)
text = string.gsub(text, '(~[rbgypcmuonshw]~)', '')
return text
end