From 60fd7e317ba6aa363f152429e4f918a9e2b7b8d9 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 15 Jan 2020 12:18:39 +0100 Subject: [PATCH] Added optional notification background color arugment Co-Authored-By: WolfShy1 --- client/functions.lua | 14 ++++++++------ server/classes/player.lua | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index ec5e3b29..c14e9643 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -44,16 +44,18 @@ ESX.SetPlayerData = function(key, val) ESX.PlayerData[key] = val end -ESX.ShowNotification = function(msg, flash, saveToBrief) +ESX.ShowNotification = function(msg, flash, saveToBrief, hudColorIndex) if saveToBrief == nil then saveToBrief = true end AddTextEntry('esxNotification', msg) BeginTextCommandThefeedPost('esxNotification') + if hudColorIndex then ThefeedNextPostBackgroundColor(hudColorIndex) end EndTextCommandThefeedPostTicker(flash or false, saveToBrief) end -ESX.ShowAdvancedNotification = function(sender, subject, msg, textureDict, iconType, flash, saveToBrief) +ESX.ShowAdvancedNotification = function(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex) AddTextEntry('esxAdvancedNotification', msg) BeginTextCommandThefeedPost('esxAdvancedNotification') + if hudColorIndex then ThefeedNextPostBackgroundColor(hudColorIndex) end EndTextCommandThefeedPostMessagetext(textureDict, textureDict, false, iconType, sender, subject) EndTextCommandThefeedPostTicker(flash, saveToBrief) end @@ -1109,13 +1111,13 @@ AddEventHandler('esx:serverCallback', function(requestId, ...) end) RegisterNetEvent('esx:showNotification') -AddEventHandler('esx:showNotification', function(msg, flash, saveToBrief) - ESX.ShowNotification(msg, flash, saveToBrief) +AddEventHandler('esx:showNotification', function(msg, flash, saveToBrief, hudColorIndex) + ESX.ShowNotification(msg, flash, saveToBrief, hudColorIndex) end) RegisterNetEvent('esx:showAdvancedNotification') -AddEventHandler('esx:showAdvancedNotification', function(sender, subject, msg, textureDict, iconType, flash, saveToBrief) - ESX.ShowAdvancedNotification(sender, subject, msg, textureDict, iconType, flash, saveToBrief) +AddEventHandler('esx:showAdvancedNotification', function(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex) + ESX.ShowAdvancedNotification(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex) end) RegisterNetEvent('esx:showHelpNotification') diff --git a/server/classes/player.lua b/server/classes/player.lua index 6909b5c8..f612d74c 100644 --- a/server/classes/player.lua +++ b/server/classes/player.lua @@ -531,8 +531,8 @@ function CreateExtendedPlayer(player, accounts, inventory, job, loadout, name, c return end - self.showNotification = function(msg, flash, saveToBrief) - self.triggerEvent('esx:showNotification', msg, flash, saveToBrief) + self.showNotification = function(msg, flash, saveToBrief, hudColorIndex) + self.triggerEvent('esx:showNotification', msg, flash, saveToBrief, hudColorIndex) end self.showHelpNotification = function(msg, thisFrame, beep, duration)