diff --git a/[core]/esx_notify/Notify.lua b/[core]/esx_notify/Notify.lua index a0503f6f..f0045251 100644 --- a/[core]/esx_notify/Notify.lua +++ b/[core]/esx_notify/Notify.lua @@ -1,5 +1,8 @@ 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 ---@param message any the message :D @@ -35,7 +38,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 = NotificationSoundEnabled })) end diff --git a/[core]/esx_notify/nui/js/script.js b/[core]/esx_notify/nui/js/script.js index b2a24bd3..73902b80 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%")