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

# Installation

### Requirements

* A working QBCore / Qbox / ESX / Standalon Server.
* (Optional, only if you want MySQL persistence) [oxmysql](https://github.com/overextended/oxmysql) installed, configured, and **started above this resource** in `server.cfg`.

***

{% stepper %}
{% step %}

## Remove Default FiveM Chat

Before installing this chat resource, you must remove the default FiveM chat resource to prevent conflicts.

### Windows

Navigate to your FiveM server artifacts folder:

`artifact path\citizen\system_resources\chat`

Delete or remove the `chat` folder.

### Linux / Alpine

Navigate to:

`/opt/cfx-server/citizen/system_resources/chat`

Delete or remove the `chat` folder.

> **Important:** Make sure the default FiveM `chat` resource is completely removed before starting the server with this custom chat system.

After removing the default chat, install and start the custom chat resource as instructed in the installation guide.
{% endstep %}

{% step %}

## QBox Configuration

If you are using **QBox**, you do **not** need to delete the default chat resource.

Simply add or update the following line in your `server.cfg`:

```cfg
# Chat config
set resources_useSystemChat false
```

Setting this value to `false` will disable the default system chat and prevent it from conflicting with this custom chat resource.
{% endstep %}

{% step %}

## Download the Resource

Download **Project07\_Chat** from the [**CFX Portal**](https://portal.cfx.re/).&#x20;
{% endstep %}

{% step %}

###

## Extract the Files

After downloading the resource, extract the downloaded archive.

Make sure the resource folder is named correctly:

```lua
Project07_Chat
```

{% endstep %}

{% step %}

## Add the Resource to Your Server

Move or upload the `Project07_Chat` folder into your FiveM server's `resources` directory.
{% endstep %}

{% step %}
Add to `server.cfg`

Open your `server.cfg` and add:

```cfg
ensure Project07_Chat
```

Then restart your server.

> **Important:** Make sure the resource is started correctly and avoid running multiple custom chat systems at the same time.
> {% endstep %}

{% step %}

## Grant Admin Tablet Access

The `/chatadmin` command opens the **Project07\_Chat Admin Tablet**.

Access is protected using a **FiveM ACE permission**, meaning it does not depend on QB-Core, QBox, ESX, or any other framework admin system.

Add one of the following options to your `server.cfg`.

#### Option 1 — Allow the Admin Group

```cfg
add_ace group.admin project07.admin allow
```

This is the recommended option if your permission system already uses the `group.admin` ACE group.
{% endstep %}

{% step %}

## Allow a Specific Player

You can also grant access directly using a player's FiveM license identifier:

```cfg
add_principal identifier.license:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX project07.admin
```

Replace the `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX` section with the player's actual license identifier.

After configuring permissions, use the following command in-game:

```
/chatadmin
```

If you do not have permission, the chat system will notify you.
{% endstep %}

{% step %}

## Optional — Enable MySQL Persistence

By default, **Project07\_Chat** stores its data locally using JSON files inside:

```
Project07_Chat/data/
```

This includes data such as:

* Admin tablet settings
* Chat history
* Admin-only chat data
* Saved resource settings

### Local JSON storage works perfectly for most servers.

However, if your hosting provider automatically wipes, redeploys, or replaces your resource files, you may want to use MySQL persistence.

#### Step 1 — Install oxmysql

Install and configure `oxmysql`.

Make sure it starts **before** `Project07_Chat`:

```cfg
ensure oxmysql
ensure Project07_Chat
```

#### Step 2 — Enable the Database

Open `Config.lua` and configure:

```lua
Config.Database = {
    Enabled = true,
    AutoSetup = true, -- Creates the required tables automatically
}
```

With `AutoSetup` enabled, the required database tables will automatically be created when the resource starts for the first time.

{% endstep %}

{% step %}

## Restart the Resource

Restart your server or resource.

If everything is configured correctly, you should see:

```
[Project07_Chat] Loaded settings/history from MySQL.
```

{% endstep %}
{% endstepper %}
