-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathhandler.lua
More file actions
29 lines (24 loc) · 882 Bytes
/
handler.lua
File metadata and controls
29 lines (24 loc) · 882 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
local USE_SOUND <const> = false -- Set to true if you want to use sound for notifications
--- @param data: table<{ message = string, type = string, duration = int }>
--- @return void
function sendNotification(data)
local _data <const> = {
message = data.message,
type = data.type or 'info',
duration = data.timeout or 5000,
title = data.title or 'Notification',
}
if USE_SOUND then
PlaySoundFrontend(-1, 'Click', 'DLC_HEIST_HACKING_SNAKE_SOUNDS', 0) -- Thanks to https://github.com/MrMillxr
end
SendNUIMessage({
createNew = true,
data = _data
})
end
-- ? Event To Send Notification
RegisterNetEvent("skeexsNotify:sendNotify", function(data)
sendNotification(data)
end)
exports('sendNotification', sendNotification)
exports('TriggerNotification', sendNotification)