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

# Notify

### SendAdvancedNotify (Client)

Shows a notification on the local player's screen.

**You can use it to display feedback messages from any client-side script — action results, warnings, system messages, and more.**

**Note:** If `title` is `nil` or an empty string, the title is automatically set based on the `notifyType`:

* `"success"` → `"SUCCESS"`
* `"error"` → `"ERROR"`
* `"warning"` → `"WARNING"`
* `"info"` → `"INFO"`

```lua
exports["s1h_uipack"]:SendAdvancedNotify(title, message, notifyType, duration)
```

**Parameters :**

| Name       | Type          | Description                                                                              |
| ---------- | ------------- | ---------------------------------------------------------------------------------------- |
| title      | string \| nil | Notification title. Pass `nil` to auto-generate from type                                |
| message    | string        | The body text shown in the notification                                                  |
| notifyType | string        | `"success"`, `"error"`, `"warning"`, `"info"` — or any alias from `Config.NotifyTypeMap` |
| duration   | number        | Display time in milliseconds. Defaults to `4000`                                         |

**Supported notify types :**

| Type          | Auto Title | Notes                                              |
| ------------- | ---------- | -------------------------------------------------- |
| `"success"`   | `SUCCESS`  | Green                                              |
| `"error"`     | `ERROR`    | Red                                                |
| `"warning"`   | `WARNING`  | Yellow / Orange                                    |
| `"info"`      | `INFO`     | Blue                                               |
| `"primary"`   | `INFO`     | Alias → mapped to `info` in `Config.NotifyTypeMap` |
| `"police"`    | `INFO`     | Alias → mapped to `info`                           |
| `"ambulance"` | `ERROR`    | Alias → mapped to `error`                          |

**Example — auto title (type name used) :**

```lua
exports["s1h_uipack"]:SendAdvancedNotify(nil, "Vehicle repaired successfully.", "success", 4000)
exports["s1h_uipack"]:SendAdvancedNotify(nil, "You don't have enough money.", "error", 4000)
exports["s1h_uipack"]:SendAdvancedNotify(nil, "You are entering a restricted area.", "warning", 5000)
exports["s1h_uipack"]:SendAdvancedNotify(nil, "Server will restart in 10 minutes.", "info", 6000)
```

**Example — custom title :**

```lua
exports["s1h_uipack"]:SendAdvancedNotify("BANK", "Transaction of $500 was successful.", "success", 4000)
exports["s1h_uipack"]:SendAdvancedNotify("SYSTEM", "You have been kicked by an admin.", "error", 8000)
exports["s1h_uipack"]:SendAdvancedNotify("POLICE", "You are wanted — 3 stars.", "warning", 5000)
```

**Example — short duration :**

```lua
-- Flash a quick 1.5 second message
exports["s1h_uipack"]:SendAdvancedNotify("FAST", "Action registered.", "info", 1500)
```

**Example — using a type alias :**

```lua
-- "police" and "ambulance" are aliases defined in Config.NotifyTypeMap
exports["s1h_uipack"]:SendAdvancedNotify(nil, "Dispatch signal sent to all units.", "police", 4000)
exports["s1h_uipack"]:SendAdvancedNotify(nil, "Medical team has been notified.", "ambulance", 4000)
```

**Example — triggering from a client event :**

```lua
RegisterNetEvent("myScript:client:actionResult", function(result)
    if result then
        exports["s1h_uipack"]:SendAdvancedNotify(nil, "Action completed successfully.", "success", 4000)
    else
        exports["s1h_uipack"]:SendAdvancedNotify(nil, "Action failed.", "error", 4000)
    end
end)
```

***

### SendAdvancedNotify (Server)

Sends a notification to a specific player or broadcasts to all players on the server.

**You can use it to send server-side triggered notifications without writing NUI messages manually — for example after a database operation, an admin action, or a global announcement.**

**Note:** Pass `-1` as the source to broadcast the notification to every connected player at once.

```lua
exports["s1h_uipack"]:SendAdvancedNotify(source, title, message, notifyType, duration)
```

**Parameters :**

| Name       | Type          | Description                                                  |
| ---------- | ------------- | ------------------------------------------------------------ |
| source     | number        | The player's server ID. Use `-1` to broadcast to all players |
| title      | string \| nil | Notification title. Pass `nil` to auto-generate              |
| message    | string        | The body text shown in the notification                      |
| notifyType | string        | `"success"`, `"error"`, `"warning"`, `"info"`                |
| duration   | number        | Display time in milliseconds. Defaults to `4000`             |

**Example — send to a specific player :**

```lua
-- After a successful server-side transaction
RegisterNetEvent("bank:server:transfer", function(amount)
    local src = source
    -- ... your transfer logic ...
    exports["s1h_uipack"]:SendAdvancedNotify(src, "BANK", "Transfer of $" .. amount .. " completed.", "success", 4000)
end)
```

**Example — send an error to a player :**

```lua
exports["s1h_uipack"]:SendAdvancedNotify(source, "DENIED", "You don't have permission to do that.", "error", 5000)
```

**Example — broadcast to ALL players (-1) :**

```lua
-- Announce server restart to everyone
exports["s1h_uipack"]:SendAdvancedNotify(-1, "SERVER", "Server will restart in 5 minutes. Please find a safe spot.", "warning", 10000)
```

**Example — admin action notification :**

```lua
RegisterCommand("adminwarn", function(source, args)
    local targetId = tonumber(args[1])
    local reason   = table.concat(args, " ", 2)

    if not GetPlayerName(targetId) then return end

    -- Warn the target player
    exports["s1h_uipack"]:SendAdvancedNotify(targetId, "WARNING", "You have been warned: " .. reason, "warning", 8000)

    -- Confirm to the admin who issued the command
    exports["s1h_uipack"]:SendAdvancedNotify(source, "ADMIN", "Warning sent to player " .. targetId, "info", 3000)
end, true)
```

**Example — auto-title with alias :**

```lua
-- notifyType is mapped through Config.NotifyTypeMap on the server side too
exports["s1h_uipack"]:SendAdvancedNotify(source, nil, "Dispatch received your signal.", "police", 4000)
```
