> For the complete documentation index, see [llms.txt](https://code-universe.gitbook.io/codeuniverse/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-universe.gitbook.io/codeuniverse/free-releases/clear-notify-system.md).

# Clear Notify System

## 1. Introduction

{% hint style="info" %}
It's a free resource, so maybe we will not support it.
{% endhint %}

Clear Notify is an advanced, customizable notification system for FiveM servers. It provides a sleek, modern interface for displaying notifications with various types, durations, and interactive elements.

## 2. Installation

1. Download the latest release from the [releases page](https://github.com/code-universe-unit/clear-notify).
2. Extract the contents into your FiveM resources folder.
3. Add `ensure clear-notify` to your server.cfg file.

## 3. Configuration

Edit the `config.lua` file to customize the notification system:

```lua
Config = {}

Config.Types = {
    SUCCESS = { color = "#00BA88" },
    ERROR = { color = "#FF4B4B" },
    INFO = { color = "#0095FF" },
    WARNING = { color = "#FF8800" }
}

Config.DefaultDuration = 5000
Config.Position = "top-right"
Config.MaxNotifications = 4
```

## 4. Basic Usage

To display a notification, use the `ShowNotification` export:

```lua
exports['clear-notify']:ShowNotification({
    title = "Welcome",
    message = "Thanks for using Clear Notify!",
    type = "SUCCESS",
    duration = 5000
})
```

## 5. Advanced Usage

You can add an action button to your notification:

```lua
local notificationId = exports['clear-notify']:ShowNotification({
    title = "New Message",
    message = "You have a new message from John Doe.",
    type = "INFO",
    duration = 10000,
    action = "readMessage",
    actionLabel = "Read Now"
})
```

To remove a notification programmatically:

```lua
exports['clear-notify']:RemoveNotification(notificationId)
```

## 6. API Reference

**ShowNotification(data)**

Displays a new notification.

Parameters:

* `data` (table):
* `title` (string): The title of the notification.
* `message` (string): The main content of the notification.
* `type` (string): The type of notification (SUCCESS, ERROR, INFO, WARNING).
* `duration` (number): How long the notification should be displayed (in ms).
* `action` (string, optional): A unique identifier for the action button.
* `actionLabel` (string, optional): The text to display on the action button.

Returns:

* `id` (number): A unique identifier for the created notification.

**RemoveNotification(id)**

Removes a specific notification.

Parameters:

* `id` (number): The unique identifier of the notification to remove.

## 7. Replacing Standard Notifications

**QB-Core**

Replace the default QB-Core notifications in your `qb-core/client/functions.lua`:

```lua
function QBCore.Functions.Notify(text, texttype, length)
    exports['clear-notify']:ShowNotification({
        title = "Notification",
        message = text,
        type = texttype:upper(),
        duration = length
    })
end
```

**ESX**

Replace the default ESX notifications in your `es_extended/client/functions.lua`:

```lua
function ESX.ShowNotification(msg, type, length)
    exports['clear-notify']:ShowNotification({
        title = "Notification",
        message = msg,
        type = type or "INFO",
        duration = length or 5000
    })
end
```

## 8. Troubleshooting

(None)

## 9. Examples

(Will be soon.)

### Support

If you need help or have any questions, please open an issue in the GitHub repository or join our [Discord server](https://discord.gg/codeuniverse).

### Credits

Created with ❤️ by Code Universe
