# Installation

***

### Installation <a href="#installation" id="installation"></a>

## Step 1 - Drag And Drop <a href="#step-1-drag-and-drop" id="step-1-drag-and-drop"></a>

* Drag Codeo-Notification into your resources foder.

## Step 2 - SQL Configuration <a href="#step-2-sql-configuration" id="step-2-sql-configuration"></a>

* Select the sql you're using options are "<mark style="color:blue;">**oxmysql**</mark>, <mark style="color:purple;">**ghmattimysql**</mark>, <mark style="color:yellow;">**mysql-async**</mark>" from config.

<figure><img src="/files/scx1S0GiN5f2ZguiZss5" alt=""><figcaption></figcaption></figure>

***

## Integrating Notifications For ESX Framework <a href="#integrating-notifications-for-esx-framework" id="integrating-notifications-for-esx-framework"></a>

### Step 1 - Edit Functions Lua <a href="#step-1-edit-functions-lua" id="step-1-edit-functions-lua"></a>

* Go to "**es\_extended/client/functions.lua**"

### Step 2 - Find Function <a href="#step-2-find-function" id="step-2-find-function"></a>

* Find "`ESX.ShowNotification`" function.

### Step 3 - Replace Code <a href="#step-3-replace-code" id="step-3-replace-code"></a>

* Replace "`ESX.ShowNotification`" function with the code down below.

Copy

```lua
function ESX.ShowNotification(msg, texttype, length)
    local convert = {
        ["primary"] = 'info',
        ["police"] = 'police',
        ["ambulance"] = 'ambulance',
    }
    if not texttype then
        texttype = 'info'
    end
    if convert[texttype] then
        texttype = convert[texttype]
    end
    length = length or 5000
    TriggerEvent('codeo-notification:sendNotify', nil, msg, texttype, length)
end
```

***

## Integrating Nofitications For QB Framework <a href="#integrating-nofitications-for-qb-framework" id="integrating-nofitications-for-qb-framework"></a>

### Step 1 - Edit Functions Lua <a href="#step-1-edit-functions-lua-1" id="step-1-edit-functions-lua-1"></a>

* Go to "<mark style="color:blue;">**qb-core/client/functions.lua**</mark>"

### Step 2 - Find Function <a href="#step-2-find-function-1" id="step-2-find-function-1"></a>

* Find "`QBCore.Functions.Notify`" function.

### Step 3 - Replace Code <a href="#step-3-replace-code-1" id="step-3-replace-code-1"></a>

* Replace "`QBCore.Functions.Notify`" function with the code down below.

Copy

```lua
function QBCore.Functions.Notify(text, texttype, length)
    local convert = {
        ["primary"] = 'info',
        ["police"] = 'police',
        ["ambulance"] = 'ambulance',
    }
    if not texttype then
        texttype = 'info'
    end

    if convert[texttype] then
        texttype = convert[texttype]
    end

    if type(text) == "table" then
        local answer = text.text or 'Placeholder'
        local caption = text.caption or 'Placeholder'
        length = length or 5000
        TriggerEvent('codeo-notification:sendNotify', answer, caption, texttype, length)
    else
        length = length or 5000
        TriggerEvent('codeo-notification:sendNotify', nil, text, texttype, length)
    end
end
```

***

### Information <a href="#information" id="information"></a>

#### Information - 1 How to use events or exports <a href="#information-1-how-to-use-events-or-exports" id="information-1-how-to-use-events-or-exports"></a>

If you want to trigger the notification from the client side you can use the example down below According to this example.

* 1st parameter is the title of the notification.
* 2nd parameter is the text you want to display in the notification.
* 3rd parameter is the notification type (more types can be find in notification types category).
* 4th is how long time notification will be displayed on the screen.

```lua
TriggerEvent('codeo-notification:sendNotify', 'Header you want to display(you can set this to nil if you want to display default header)', 'the text you want to display', 'success', 3000)
```

* If you want to trigger the notification from server side use the example down below Only things change here are TriggerEvent needs to be replaced with TriggerClientEvent and source (id) of a player you want to show notification

```lua
TriggerClientEvent('codeo-notification:sendNotify', source, 'Header you want to display(you can set this to nil if you want to display default header)', 'the text you want to display', 'success', 3000)
```

***

### Notification types <a href="#notification-types" id="notification-types"></a>

* success
* server
* info
* error
* police
* ambulance

{% hint style="info" %}
Visit Setting notification types to set more notification types.
{% endhint %}


---

# 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://codeoscripts.gitbook.io/codeo-scripts/scripts/codeo-notification/installation.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.
