Configuration

This script doesn't have a config.lua file however you will need to follow the below steps to replace the normal notifications on your framework.


Using qb-core

In order to replace your qb-core notifications you will need to add the following snippet into your core files as shown below. qb-core -> client -> functions.lua

function QBCore.Functions.Notify(text, texttype, length, icon)
local notificationType = 'info'

if texttype then
    local lowerType = string.lower(texttype)
    if lowerType == 'success' or lowerType == 'primary' then
        notificationType = 'success'
    elseif lowerType == 'error' or lowerType == 'danger' then
        notificationType = 'error'
    elseif lowerType == 'warning' or lowerType == 'alert' then
        notificationType = 'warning'
    elseif lowerType == 'money' then
        notificationType = 'money'
    else
        notificationType = 'info'
    end
end

local title = 'Notification'
local message = ''

if type(text) == 'table' then
    message = text.text or 'Placeholder'
    title = text.caption or 'Notification'
else
    message = text
end

-- Use the export
exports['SG_Notifications']:ShowNotification(notificationType, title, message, length or 5000)
end


Using q-box

In order to replace your ox_lib notifications you will need to add the following snippet into your core files as shown below. ox_lib -> resource -> interface -> client -> notify.lua

function lib.notify(data)
    local sound = settings.notification_audio and data.sound
    local type = data.type or 'info'
    local title = data.title or 'Notification'
    local message = data.description or data.message or ''
    local duration = data.duration or 5000

    -- Trigger SG_Notifications instead of ox_lib NUI
    TriggerEvent('SG_Notifications:client:show', type, title, message, duration)

    if not sound then return end

    -- Optional: Play sound if configured
    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

Changing Notification Image

Changing the Image that displays on the notification is easy as long as you have access to applications such as paint.net. You will find the files in the notification_images folder as PNG files.


Last updated