Global Notifications Integration
Route default framework notifications through ak47_hud by modifying framework client notification functions.
ESX Integration
File: es_extended/client/functions.lua
Replace ESX.ShowNotification and ESX.ShowAdvancedNotification with:
function ESX.ShowNotification(message, notifyType, length, title, position)
if GetResourceState('ak47_hud') == 'started' then
return exports['ak47_hud']:Notify(message, notifyType, length, title)
end
return IsResourceFound('esx_notify') and exports['esx_notify']:Notify(notifyType or "info", length or 5000, message, title, position)
end
function ESX.ShowAdvancedNotification(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex)
if GetResourceState('ak47_hud') == 'started' then
return exports['ak47_hud']:Notify(msg, 'info', 7000, sender)
end
AddTextEntry("esxAdvancedNotification", msg)
BeginTextCommandThefeedPost("esxAdvancedNotification")
if hudColorIndex then
ThefeedSetNextPostBackgroundColor(hudColorIndex)
end
EndTextCommandThefeedPostMessagetext(textureDict, textureDict, false, iconType, sender, subject)
EndTextCommandThefeedPostTicker(flash, saveToBrief == nil or saveToBrief)
endQBCore Integration
File: qb-core/client/functions.lua
Replace QBCore.Functions.Notify with:
function QBCore.Functions.Notify(text, texttype, length, icon)
if GetResourceState('ak47_hud') == 'started' then
exports['ak47_hud']:Notify(text, texttype, length, icon)
return
end
local message = {
action = 'notify',
type = texttype or 'primary',
length = length or 5000,
}
if type(text) == 'table' then
message.text = text.text or 'Placeholder'
message.caption = text.caption or 'Placeholder'
else
message.text = text
end
if icon then
message.icon = icon
end
SendNUIMessage(message)
endox_lib Integration
File: ox_lib/resource/interface/client/notify.lua
Replace lib.notify with:
function lib.notify(data)
if GetResourceState('ak47_hud') == 'started' then
exports['ak47_hud']:Notify(data.description, data.type, data.duration, data.title)
return
end
local sound = settings.notification_audio and data.sound
local payload = table.clone(data)
payload.sound = nil
payload.position = payload.position or settings.notification_position
SendNUIMessage({
action = 'notify',
data = payload
})
if not sound then return end
if sound.bank then lib.requestAudioBank(sound.bank) end
local soundId = GetSoundId()
PlaySoundFrontend(soundId, sound.name, sound.set, true)
ReleaseSoundId(soundId)
if sound.bank then ReleaseNamedScriptAudioBank(sound.bank) end
endNotes
- Framework updates will overwrite these changes and require reapplication.
- Calls fall back to default framework notifications when
ak47_hudis stopped.
On this page