# Usage Guide

### Triggering Notifications

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

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

***

### Basic Notification

```lua
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:

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

{% hint style="info" %}
Make sure that the type (bank in this case) exists in your config.
{% endhint %}

***

### Custom Display Time

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

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

***

### Advance Example

```lua
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.

{% code overflow="wrap" %}

```lua
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
```

{% endcode %}

***

### &#x20; 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://saka-store.gitbook.io/main/resources/notification/usage-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
