> For the complete documentation index, see [llms.txt](https://striga.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://striga.gitbook.io/docs/striga-notify/exports-and-events.md).

# Exports & Events

Show notifications from your own scripts.

{% hint style="success" %}
**Quick start**

Client: `exports['striga-notify']:Notify('Vehicle locked', 'success')`\
Server: `exports['striga-notify']:Notify(source, 'Not enough money', 'error')`
{% endhint %}

## Notification options

You can send plain text, or a table with these fields:

| Field         | Type   | Default    | What it does                                                    |
| ------------- | ------ | ---------- | --------------------------------------------------------------- |
| `description` | string | -          | The message                                                     |
| `title`       | string | -          | Heading above the message (optional)                            |
| `type`        | string | `'info'`   | `info`, `success`, `warning`, `error`                           |
| `duration`    | number | `5000`     | Time on screen in ms, 1000 to 30000                             |
| `id`          | string | -          | Same `id` updates this notification instead of adding a new one |
| `icon`        | string | type icon  | Icon name, see the list below                                   |
| `iconColor`   | string | type color | `#rrggbb`, replaces the type color                              |
| `sound`       | bool   | `true`     | `false` = no sound for this notification                        |

You need at least a `description` or a `title`.

{% hint style="info" %}
`inform`, `primary` (= info) and `warn` (= warning) also work, so ox\_lib and QBCore types need no change.
{% endhint %}

### Icons

Font Awesome style names work:

`check` `xmark` `car` `phone` `money-bill` `bank` `house` `key` `lock` `user` `bell` `gas-pump` `truck` `box` `heart` `shield` `clock` ...

An unknown name shows the icon of the type.

### Text

Text is always shown as plain text. HTML tags and color codes (`~r~`, `^1`) are removed, `<br>` keeps the line break.

***

## Client exports

### Notify

Shows a notification. Returns `true` if it was shown.

{% tabs %}
{% tab title="Text" %}

```lua
-- Notify(text, type?, duration?, icon?)
exports['striga-notify']:Notify('Vehicle locked', 'success', 5000)
exports['striga-notify']:Notify('Engine damaged', 'warning', 5000, 'car')
```

{% endtab %}

{% tab title="Table" %}

```lua
exports['striga-notify']:Notify({
    title = 'Bank',
    description = '$500 received',
    type = 'success',
    duration = 5000,
    icon = 'money-bill',
})
```

{% endtab %}

{% tab title="Update with id" %}

```lua
-- First call shows it, the next calls with the same id change it
exports['striga-notify']:Notify({ id = 'repair', description = 'Repairing 30%', type = 'info' })
exports['striga-notify']:Notify({ id = 'repair', description = 'Repairing 80%', type = 'info' })
exports['striga-notify']:Notify({ id = 'repair', description = 'Repair done', type = 'success' })
```

{% endtab %}
{% endtabs %}

### Hide

Removes one notification by its `id`.

```lua
exports['striga-notify']:Hide('repair')
```

### Clear

Removes all notifications.

```lua
exports['striga-notify']:Clear()
```

***

## Server exports

### Notify

Shows a notification to one player, or to everyone with `-1`. Returns `true` if it was sent.

```lua
-- Notify(playerId, text, type?, duration?)
exports['striga-notify']:Notify(source, 'Not enough money', 'error', 5000)

-- Notify(playerId, table)
exports['striga-notify']:Notify(source, {
    title = 'Bank',
    description = '$500 received',
    type = 'success',
})

-- Everyone
exports['striga-notify']:Notify(-1, 'Server restart in 5 minutes', 'warning', 10000)
```

{% hint style="warning" %}
Max **20 notifications per second** to the same player. More are dropped, so a loop can not flood a player.
{% endhint %}

***

## Through striga-core (recommended)

If your script already uses **striga-core**, use `Core.notify` (see [striga-core exports](/docs/striga-core/exports.md)). It works with whatever notify script the server owner picks, not only Striga Notify.

```lua
-- client
Core.notify('Vehicle locked', 'success', 5000)
Core.notify({ title = 'Bank', description = '$500 received', type = 'success' })

-- server
Core.notify(source, 'Not enough money', 'error', 5000)
Core.notify(source, { title = 'Bank', description = '$500 received', type = 'success' })
```

***

## Framework functions

After the [Integration](/docs/striga-notify/integration.md) step, the normal notify functions of ESX, QBCore, Qbox and ox\_lib also show in the Striga Notify design. No change in your scripts needed.

***

## Events

### striga-notify:client:show

Client event. Shows a notification on that player. Takes the same table as `Notify`.

```lua
-- server
TriggerClientEvent('striga-notify:client:show', source, {
    description = 'Package delivered',
    type = 'success',
})

-- client
TriggerEvent('striga-notify:client:show', { description = 'Package delivered', type = 'success' })
```

{% hint style="info" %}
On the server, prefer the `Notify` export: it checks the data and has the 20 per second limit.
{% endhint %}

***

## For HUD and layout scripts

These exports are for scripts that want to control the look, like a HUD menu.

{% hint style="info" %}
Striga Tokyo HUD does not need them anymore. It sends its theme through striga-core (`striga-core:client:theme`), and its `/hud` menu edits the Notify settings through the striga-core settings hub. These exports stay for older HUDs and your own scripts.
{% endhint %}

| Export                   | What it does                                                                                         |
| ------------------------ | ---------------------------------------------------------------------------------------------------- |
| `SetTheme(color)`        | Sets the theme color, e.g. `'#3b82f6'`. `nil` removes it. Removed by itself when your resource stops |
| `SetLayout(settings)`    | Changes the player's settings (saved on their PC)                                                    |
| `SetPreview(true/false)` | Keeps sample notifications on screen while your editor is open                                       |
| `GetSettings()`          | Returns the player's current settings                                                                |

```lua
exports['striga-notify']:SetTheme('#3b82f6')

exports['striga-notify']:SetLayout({
    style = 'tinted',       -- card / tinted / compact
    iconStyle = 'bar',      -- plain / tile / bar
    position = 'top-left',
    opacity = 80,           -- 30 to 100
    size = 110,             -- 80 to 140
    blur = 8,               -- 0 to 16
    progress = true,
    sound = false,
    accent = '#22d3ee',     -- player color, false = follow the HUD / config again
})

exports['striga-notify']:SetLayout({ reset = true }) -- back to config defaults

local settings = exports['striga-notify']:GetSettings()
print(settings.style, settings.position)
```

{% content-ref url="/pages/r57BAHdrw11lLdGFfbiH" %}
[Troubleshooting & FAQ](/docs/striga-notify/troubleshooting-and-faq.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://striga.gitbook.io/docs/striga-notify/exports-and-events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
