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

# INSTALLATION

1️⃣ Dependencies \
This script requires oxmysql to function properly. \
2️⃣ Add Files to Your Server Place the janiel-notify folder inside resources/. \
Add the following line to your server.cfg:  \
`ensure janiel-notify`&#x20;

\
**SQL Table Structure**

The `notify.sql` file will automatically create the `notify_settings` table in your database, which will store player notification positions. Here's the table structure:

```sql
CREATE TABLE IF NOT EXISTS notify_settings (
    id INT AUTO_INCREMENT PRIMARY KEY,
    identifier VARCHAR(50) NOT NULL UNIQUE,
    position TEXT NOT NULL
);
```

\
🛠 **QBCore Integration**

#### **📌 Override QBCore Notifications**

Add the following code to **`qb-core/client/functions.lua`**:

```
function QBCore.Functions.Notify(text, texttype, length)
    exports['janiel-notify']:Notify(text, texttype, length)
end



--function QBCore.Functions.Notify(text, texttype, length)
--    if type(text) == "table" then
--        local ttext = text.text or 'Placeholder'
--        local caption = text.caption or 'Placeholder'
--        texttype = texttype or 'primary'
--        length = length or 5000
--        SendNUIMessage({
--            action = 'notify',
--            type = texttype,
--            length = length,
--            text = ttext,
--            caption = caption
--        })
--    else
--        texttype = texttype or 'primary'
--        length = length or 5000
--        SendNUIMessage({
--            action = 'notify',
--            type = texttype,
--            length = length,
--            text = text
--        })
--    end
--end
```

#### **📌 Usage Examples**

```lua
QBCore.Functions.Notify('Hello World', 'success')
QBCore.Functions.Notify('An error occurred!', 'error', 5000)
```

### 🛠 **ESX Integration**

#### **📌 Override ESX Notifications**

Add the following code to **`es_extended/client/main.lua`**:

```lua
CreateThread(function()
    ESX = exports["es_extended"]:getSharedObject()
    
    ESX.ShowNotification = function(msg, type)
        exports['janiel-notify']:Notify(msg, type or 'primary')
    end
    
    ESX.ShowAdvancedNotification = function(sender, subject, msg, textureDict, iconType)
        exports['janiel-notify']:Notify(msg, 'primary')
    end
    
    ESX.ShowHelpNotification = function(msg)
        exports['janiel-notify']:Notify(msg, 'primary')
    end
end)
```

#### **📌 Usage Examples**

```lua
ESX.ShowNotification('Hello World', 'success')
ESX.ShowAdvancedNotification('Title', 'Subject', 'Message', 'CHAR_BLANK', 1)
```
