Menan AK47
MENAN AK47DOCS
DiscordStore
Navigation
Menu
Welcome
FAQ
ak47_lib
ak47_target
ak47_ambulancejob
ak47_banking
ak47_business
ak47_carboosting
ak47_cardealer
ak47_clothingshop
ak47_crafting
ak47_crime
ak47_crutch
ak47_deliveryjob
ak47_drugdealerv2
ak47_drugmanagerv3
ak47_drugmissions
ak47_ecommerce
ak47_farming
ak47_fishing
ak47_fraudsystem
ak47_fuelstations
ak47_gangs
ak47_garage
ak47_garbagejob
ak47_hookahloungev2
ak47_housing
ak47_hud
Postal Map
Chat Suggestions
Configuration Guide
Global Notifications Integration
Exports
ak47_iclothingv3
ak47_idcardv2
ak47_inventory
ak47_jobgarage
ak47_khusbites
ak47_khusland
ak47_leafnlatte
ak47_mafiasupply
ak47_mechanic
ak47_moneywash
ak47_multicharacter
ak47_npcmed
ak47_outfitbag
ak47_playershop
ak47_policejob
ak47_prospecting
ak47_radio
ak47_rentalcar
ak47_safezone
ak47_sitchair
ak47_smokingv2
ak47_supermarket
ak47_switch
ak47_territories
ak47_vehiclekeys
ak47_vipshop
Loaf
DocsMulti FrameworkGlobal Notifications Integration

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)
end

QBCore 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)
end

ox_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
end

Notes

  • Framework updates will overwrite these changes and require reapplication.
  • Calls fall back to default framework notifications when ak47_hud is stopped.
Previous
Configuration Guide
Next
Exports
On this page
ESX IntegrationQBCore Integrationoxlib IntegrationNotes