From 1d83a1f2f46c2ea324c0b4196310dcfac68435c1 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 15 Jan 2020 11:54:19 +0100 Subject: [PATCH] Updated native names, added optional values (read desc) Added flash and saveToBreif booleans to ESX.ShowNotification() and ESX.ShowHelpNotification() Added two optional booleans thisFrame, beep to ShowHelpNotification() and last new optional argument duration --- client/functions.lua | 39 +++++++++++++++++++++------------------ server/classes/player.lua | 8 ++++---- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index c5e2021d..854b0b40 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -44,25 +44,28 @@ ESX.SetPlayerData = function(key, val) ESX.PlayerData[key] = val end -ESX.ShowNotification = function(msg) +ESX.ShowNotification = function(msg, flash, saveToBrief) AddTextEntry('esxNotification', msg) - SetNotificationTextEntry('esxNotification') - DrawNotification(false, true) + BeginTextCommandThefeedPost('esxNotification') + EndTextCommandThefeedPostTicker(flash or false, saveToBrief or true) end -ESX.ShowAdvancedNotification = function(title, subject, msg, icon, iconType) +ESX.ShowAdvancedNotification = function(sender, subject, msg, textureDict, iconType, flash, saveToBrief) AddTextEntry('esxAdvancedNotification', msg) - SetNotificationTextEntry('esxAdvancedNotification') - SetNotificationMessage(icon, icon, false, iconType, title, subject) - DrawNotification(false, false) + BeginTextCommandThefeedPost('esxAdvancedNotification') + EndTextCommandThefeedPostMessagetext(textureDict, textureDict, false, iconType, sender, subject) + EndTextCommandThefeedPostTicker(flash, saveToBrief) end -ESX.ShowHelpNotification = function(msg) - --if not IsHelpMessageBeingDisplayed() then - AddTextEntry('esxHelpNotification', msg) +ESX.ShowHelpNotification = function(msg, thisFrame, beep, duration) + AddTextEntry('esxHelpNotification', msg) + + if thisFrame then + DisplayHelpTextThisFrame('esxHelpNotification', true) + else BeginTextCommandDisplayHelp('esxHelpNotification') - EndTextCommandDisplayHelp(0, false, true, -1) - --end + EndTextCommandDisplayHelp(0, false, beep or true, duration or -1) + end end ESX.TriggerServerCallback = function(name, cb, ...) @@ -1104,18 +1107,18 @@ AddEventHandler('esx:serverCallback', function(requestId, ...) end) RegisterNetEvent('esx:showNotification') -AddEventHandler('esx:showNotification', function(msg) - ESX.ShowNotification(msg) +AddEventHandler('esx:showNotification', function(msg, flash, saveToBrief) + ESX.ShowNotification(msg, flash, saveToBrief) end) RegisterNetEvent('esx:showAdvancedNotification') -AddEventHandler('esx:showAdvancedNotification', function(title, subject, msg, icon, iconType) - ESX.ShowAdvancedNotification(title, subject, msg, icon, iconType) +AddEventHandler('esx:showAdvancedNotification', function(sender, subject, msg, textureDict, iconType, flash, saveToBrief) + ESX.ShowAdvancedNotification(sender, subject, msg, textureDict, iconType, flash, saveToBrief) end) RegisterNetEvent('esx:showHelpNotification') -AddEventHandler('esx:showHelpNotification', function(msg) - ESX.ShowHelpNotification(msg) +AddEventHandler('esx:showHelpNotification', function(msg, thisFrame, beep, duration) + ESX.ShowHelpNotification(msg, thisFrame, beep, duration) end) -- SetTimeout diff --git a/server/classes/player.lua b/server/classes/player.lua index 851bb397..6909b5c8 100644 --- a/server/classes/player.lua +++ b/server/classes/player.lua @@ -531,12 +531,12 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, c return end - self.showNotification = function(msg) - self.triggerEvent('esx:showNotification', msg) + self.showNotification = function(msg, flash, saveToBrief) + self.triggerEvent('esx:showNotification', msg, flash, saveToBrief) end - self.showHelpNotification = function(msg) - self.triggerEvent('esx:showHelpNotification', msg) + self.showHelpNotification = function(msg, thisFrame, beep, duration) + self.triggerEvent('esx:showHelpNotification', msg, thisFrame, beep, duration) end return self