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
This commit is contained in:
ElPumpo
2020-01-15 11:54:19 +01:00
parent b3a36747a3
commit 1d83a1f2f4
2 changed files with 25 additions and 22 deletions
+21 -18
View File
@@ -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
+4 -4
View File
@@ -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