Usage Guide

Triggering Notifications

You can trigger a notification from any client-side script using the following event:

TriggerEvent('saka_notify:notify', {
    title = 'Your Title',
    description = 'Your description goes here.',
    type = 'success' -- or info / error / bank / etc.
})

Basic Notification

TriggerEvent('saka_notify:notify', {
    title = 'Welcome',
    description = 'You’ve joined the server.',
    type = 'info'
})

Using Custom Notification Types

If you’ve defined a new type in Config.notificationTypes (e.g., "warning" or "bank"), just use it directly:

TriggerEvent('saka_notify:notify', {
    title = 'Bank Update',
    description = 'Your deposit has been received.',
    type = 'bank'
})

Make sure that the type (bank in this case) exists in your config.


Custom Display Time

You can override the default duration using the duration field (in ms):

TriggerEvent('saka_notify:notify', {
    title = 'Quick Tip',
    description = 'This message will vanish quickly.',
    type = 'info',
    duration = 3000
})

Advance Example

TriggerEvent('saka_notify:notify', {
    title = 'Error 404',
    description = 'The requested resource was not found.',
    type = 'error',
    duration = 7000
})

OX_lib Usage

Here is the usage to bridge OX_lib notifys to Saka's.

function lib.notify(data)
    local sound = settings.notification_audio and data.sound
    data.sound = nil 

    if sound then
        if sound.bank then
            lib.requestAudioBank(sound.bank)
        end

        local soundId = GetSoundId()
        if soundId then
            PlaySoundFrontend(soundId, sound.name or "DEFAULT", sound.set or "HUD_FRONTEND_DEFAULT_SOUNDSET", true)
            ReleaseSoundId(soundId)
        end

        if sound.bank then
            ReleaseNamedScriptAudioBank(sound.bank)
        end
    end
    
    TriggerEvent('saka-notification:client:Notification', {
        header = data.title or 'Notification',
        text = data.description or '',
        type = data.type or 'info',
        time = data.duration or 5000,
    })
end

Tips

• You don’t need a server event; this is purely client-side.

• Works in any framework – just make sure the script is ensured and the event is called from the client.

• Customize notification sounds or icons via config.lua.

Last updated