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 f0045251..0061974e 100644 --- a/[core]/esx_notify/Notify.lua +++ b/[core]/esx_notify/Notify.lua @@ -1,7 +1,5 @@ local Debug = ESX.GetConfig().EnableDebug ----@type boolean Whether the notification sound should be played. -local NotificationSoundEnabled = true ---@param notificatonType string the notification type ---@param length number the length of the notification @@ -39,7 +37,7 @@ local function Notify(notificatonType, length, message, title) length = length or 5000, message = message or "ESX-Notify", title = title or "New Notification", - NotificationSoundEnabled = NotificationSoundEnabled + notificationSoundEnabled = Config.notificationSoundEnabled })) end diff --git a/[core]/esx_notify/fxmanifest.lua b/[core]/esx_notify/fxmanifest.lua index 55862551..39492e81 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 { 'Notify.lua', 'Config.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 73902b80..1152ed14 100644 --- a/[core]/esx_notify/nui/js/script.js +++ b/[core]/esx_notify/nui/js/script.js @@ -83,7 +83,7 @@ w.addEventListener("message", (event) => { title: event.data.title || "New Notification", message: event.data.message, length: event.data.length, - NotificationSoundEnabled: event.data.NotificationSoundEnabled, + notificationSoundEnabled: event.data.notificationSoundEnabled, }) }) @@ -174,7 +174,7 @@ const notification = (data) => { width: "0%", }) - if (data.NotificationSoundEnabled) { + if (data.notificationSoundEnabled) { playNotificationSound(data.type) }