Hi !
I’m trying to make a notification with input key. All is ok for the display, but my notification never disappears…
I think it’s because the game wait the input pressed but nothing happen when i press the key.
If someone already uses this function, i would like to know how you delete notifications please
TriggerEvent('hud:NotifKey',"~INPUT_MP_TEXT_CHAT_TEAM~", "~g~Payer la facture")
TriggerEvent('hud:NotifKey',"~INPUT_REPLAY_ENDPOINT~", "~r~Refuser la facture")
RegisterNetEvent("hud:NotifKey")
AddEventHandler("hud:NotifKey", function(icon,text)
Citizen.CreateThread(function()
Wait(1)
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
Citizen.InvokeNative(0xDD6CB2CCE7C2735C,1,icon,text)
DrawNotification(false, true)
end)
end)
RegisterNetEvent('Notification')
AddEventHandler('Notification', function(msg, duration)
Citizen.CreateThread(function()
SetNotificationTextEntry("STRING")
AddTextComponentSubstringPlayerName(msg)
if duration then
local Notification = DrawNotification(true, true)
Citizen.Wait(duration)
RemoveNotification(Notification)
else DrawNotification(false, false) end
end)
end)
1 Like
I already tried and it don’t work.
Notifications stay on the screen. I think it’s because “0xDD6CB2CCE7C2735C” is very particular function. For example, with basic notification, it’s not possible to have the same message two times but with it, it’s possible.
Edit :
I found with your idea, thanks :
local Notif = {}
RegisterNetEvent("hud:NotifKey")
AddEventHandler("hud:NotifKey", function(icon,text)
Citizen.CreateThread(function()
Wait(1)
SetNotificationTextEntry("STRING")
local Notification = Citizen.InvokeNative(0xDD6CB2CCE7C2735C,1,icon,text)
table.insert(Notif,Notification)
end)
end)
RegisterNetEvent('hud:NotifDel')
AddEventHandler('hud:NotifDel', function()
for a,v in pairs(Notif) do
RemoveNotification(v)
end
Notif = {}
end)
how can i remove this notification from the hud?
1 Like