diff --git a/[core]/esx_notify/Config.lua b/[core]/esx_notify/Config.lua new file mode 100644 index 00000000..90f6d653 --- /dev/null +++ b/[core]/esx_notify/Config.lua @@ -0,0 +1,3 @@ +Config = {} + +Config.notificationSoundEnabled = true \ No newline at end of file diff --git a/[core]/esx_notify/Notify.lua b/[core]/esx_notify/Notify.lua index a0503f6f..0061974e 100644 --- a/[core]/esx_notify/Notify.lua +++ b/[core]/esx_notify/Notify.lua @@ -1,5 +1,6 @@ local Debug = ESX.GetConfig().EnableDebug + ---@param notificatonType string the notification type ---@param length number the length of the notification ---@param message any the message :D @@ -35,7 +36,8 @@ local function Notify(notificatonType, length, message, title) type = notificatonType or "info", length = length or 5000, message = message or "ESX-Notify", - title = title or "New Notification" + title = title or "New Notification", + notificationSoundEnabled = Config.notificationSoundEnabled })) end diff --git a/[core]/esx_notify/fxmanifest.lua b/[core]/esx_notify/fxmanifest.lua index 55862551..b74403b2 100644 --- a/[core]/esx_notify/fxmanifest.lua +++ b/[core]/esx_notify/fxmanifest.lua @@ -8,7 +8,7 @@ description 'A beautiful and simple NUI notification system for ESX' shared_script '@es_extended/imports.lua' -client_scripts { 'Notify.lua' } +client_scripts { 'Config.lua', 'Notify.lua'} ui_page 'nui/index.html' diff --git a/[core]/esx_notify/nui/js/script.js b/[core]/esx_notify/nui/js/script.js index b2a24bd3..1152ed14 100644 --- a/[core]/esx_notify/nui/js/script.js +++ b/[core]/esx_notify/nui/js/script.js @@ -83,6 +83,7 @@ w.addEventListener("message", (event) => { title: event.data.title || "New Notification", message: event.data.message, length: event.data.length, + notificationSoundEnabled: event.data.notificationSoundEnabled, }) }) @@ -173,7 +174,10 @@ const notification = (data) => { width: "0%", }) - playNotificationSound(data.type) + if (data.notificationSoundEnabled) { + playNotificationSound(data.type) + } + setTimeout(() => { $(`#${id} .notify-progress`).css("width", "100%")