# installation

## Script Installation

Before starting, you must log in to the CFX portal to download the asset. You will be able to download it as many times as you want on the official CFX page. Just as you download it the first time, you will also download it multiple times in the future to get updates.

***

{% stepper %}
{% step %}

### Logging in to the CFX Portal

First, log in to the official CFX Portal by clicking here: <https://portal.cfx.re/assets/granted-assets>
{% endstep %}

{% step %}

### Find our Script

Once logged in, navigate to the **Granted Assets** section to access your purchased assets. You can download them by clicking the "Download" button. Find **sl-chat** and download it.
{% endstep %}

{% step %}

### Install Script

After downloading the script, open your server resources folder and extract the zip file you downloaded. Drag and drop into resources folder.

Make sure you're starting the script in your `server.cfg`:

{% code title="server.cfg" %}

```cfg
ensure sl-chat
```

{% endcode %}

{% hint style="warning" %}
⚠️ Important: Make sure `sl-chat` starts AFTER your framework and ox\_lib!
{% endhint %}
{% endstep %}
{% endstepper %}

***

## Dependencies

| Resource         | Required | Link                                          | Description          |
| ---------------- | -------- | --------------------------------------------- | -------------------- |
| **es\_extended** | Optional | <https://github.com/esx-framework/esx\\_core> | ESX Framework        |
| **ox\_lib**      | Optional | <https://github.com/overextended/ox\\_lib>    | Utility library      |
| **oxmysql**      | Optional | <https://github.com/overextended/oxmysql>     | MySQL async resource |

***

## Framework Configuration

The script comes pre-configured for **ESX**. To use with other frameworks, update the framework-specific client and server bridge files.

### Edit client bridge

Open `modules/editable_client.lua` and replace framework-specific code with your framework implementation.

### Edit server bridge

Open `modules/editable_server.lua` and replace framework-specific code with your framework implementation.

See [Framework Bridge](https://scriptlock.gitbook.io/script-lock-docs/resources/chat-system/framework-bridge) for complete examples for:

* **ESX** (Default)
* **QB-Core**
* **Custom Frameworks**

***

## Script Configuration

After installation, configure the script by editing files in the `shared` folder:

| File                     | Description                          |
| ------------------------ | ------------------------------------ |
| `commands.config.lua`    | Main chat configuration and commands |
| `suggestions.config.lua` | Additional command suggestions       |
| `logs.config.lua`        | Discord webhook logging              |
| `translate.config.lua`   | Language settings                    |

***

## Language Configuration

Open `shared/translate.config.lua` and set your preferred language:

{% code title="shared/translate.config.lua" %}

```lua
TranslateConfig = {}

TranslateConfig.Language = 'en' -- Available: 'en', 'pl'
TranslateConfig.FallbackLanguage = 'en'
```

{% endcode %}

***

## File Structure

```
sl-chat/
├── cl_main.lua                    # Client-side main script
├── sv_main.lua                    # Server-side main script
├── fxmanifest.lua                 # Resource manifest
├── data/
│   └── language/                  # Translation files
│       ├── en.json
│       └── pl.json
├── dist/                          # Built NUI files
│   ├── index.html
│   ├── dui_text.html
│   └── assets/
├── modules/
│   ├── editable_client.lua        # Framework bridge (client)
│   ├── editable_server.lua        # Framework bridge (server)
│   ├── client/
│   │   ├── cursor.lua             # Cursor system
│   │   ├── display.lua            # 3D text display
│   │   ├── images.lua             # Streamer mode
│   │   └── suggestions.lua        # Command suggestions
│   ├── server/
│   │   ├── logs.lua               # Discord logging
│   │   └── translate.lua          # Server translations
│   └── shared/
│       ├── translate.lua          # Shared translations
│       └── utils.lua              # Utility functions
└── shared/
    ├── commands.config.lua        # Commands configuration
    ├── suggestions.config.lua     # Additional suggestions
    ├── logs.config.lua            # Logging configuration
    └── translate.config.lua       # Translation settings
```

***

## Verification

{% stepper %}
{% step %}
Start your server
{% endstep %}

{% step %}
Join the server
{% endstep %}

{% step %}
Press `T` to open chat
{% endstep %}

{% step %}
Try typing `/me test action` - you should see styled message and 3D text above your head
{% endstep %}

{% step %}
Try `/report test` - admins should receive notification
{% endstep %}
{% endstepper %}

***

## Troubleshooting

<details>

<summary>Chat doesn't open</summary>

* Make sure `sl-chat` is starting after `ox_lib` and your framework
* Check server console for errors
* Verify all dependencies are installed

</details>

<details>

<summary>Commands don't work</summary>

* Check `commands.config.lua` for proper command setup
* Verify framework bridge is correctly configured
* Check server console for Lua errors

</details>

<details>

<summary>3D text doesn't appear</summary>

* Verify `displayTrigger` is configured in command config
* Check `Chat.Display` settings in `commands.config.lua`
* Make sure you're within the configured distance

</details>

***

## Support

If you have any issues with installation or find any error/bug, open a ticket on our Discord Server for Support:

Discord: <https://discord.gg/zZj4bNMuf7>

***

Enjoy using sl-chat!
