> For the complete documentation index, see [llms.txt](https://docs.cuxial.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cuxial.com/scripts/core/cuxial-multichar/installation.md).

# Installation

Install Cuxial Multichar step by step: dependencies, convars, Discord bot and start order.

Follow these steps in order to get the character selection running without breaking your current setup.

{% stepper %}
{% step %}

## Check the dependencies

These resources must be installed and working before you start:

* OneSync enabled
* `ox_lib`
* `oxmysql`
* `cuxial_bridge`
* A supported framework: **QBox** or **QBCore**

{% hint style="warning" %}
Cuxial Multichar requires **QBox** or **QBCore**.
{% endhint %}

Optional resources (`cuxial_emotes`, `cuxial_license`, `cuxial_garages`, `av_weather`, `qbx_properties`) are detected on their own. Nothing breaks if they are missing.

The appearance resource is optional too. Cuxial Multichar uses `cuxial_appearance` and, if it is not running, `illenium-appearance`. With either one, the character look shows in the scene and the creator opens when a new character is created. With `illenium-appearance`, the look is read from the `playerskins` table (row with `active = 1`).

{% hint style="info" %}
Without an appearance resource, the character shows the base body (default model for the gender) and no creator opens when a character is created.
{% endhint %}

{% hint style="warning" %}
Do not run another character selection or another loading screen at the same time. Cuxial Multichar ships its own loading screen and handles the character login itself.
{% endhint %}
{% endstep %}

{% step %}

## Copy the resource

Place the `cuxial_multichar` folder inside your `resources` directory. Keep the folder name as it is.

The interface is already built in `web/build`. You do not need to compile anything.
{% endstep %}

{% step %}

## Database

Nothing to import. The `cuxial_family` table (minor characters) is created automatically when the resource starts with `family.enabled = true`, and missing columns are added on later updates.

If you prefer to create it by hand, the file is in `install/cuxial_family.sql`.
{% endstep %}

{% step %}

## Starter items

New characters receive the items listed in `starterItems`. By default: `phone`, `id_card` and `driver_license`.

Make sure those items exist in your inventory, or edit the list in `shared/config.lua`. An item that does not exist is reported in the server console at startup.
{% endstep %}

{% step %}

## Convars

Add the ones you need to your `server.cfg`. All of them are optional.

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

```cfg
# Extra character slots by Discord role
set cuxial_multichar_discord_token "YOUR_TOKEN_HERE"
set cuxial_multichar_discord_guild "YOUR_DISCORD_SERVER_ID"

# Discord logs
set cuxial_multichar_webhook "YOUR_WEBHOOK_HERE"
```

{% endcode %}

| Convar                           | Used for                                                                                                                 |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `cuxial_multichar_discord_token` | Token of the Discord bot that reads the roles of each player                                                             |
| `cuxial_multichar_discord_guild` | ID of your Discord server                                                                                                |
| `cuxial_multichar_webhook`       | Discord webhook that receives the logs                                                                                   |
| `cuxial_multichar_debug`         | `1` prints debug messages in the server console. To get them in the client console too, use `debug = true` in the config |

{% hint style="danger" %}
**The bot token is a secret.** Define these convars with `set`, never with `setr`: `setr` replicates the value to every connected client, and anyone could read your token. Do not paste the token in the config, in screenshots or in a public repository. If it leaks, regenerate it in the Discord Developer Portal right away.
{% endhint %}

{% hint style="info" %}
The interface language follows `ox_lib`. Set it with `setr ox:locale en` (or `es`).
{% endhint %}
{% endstep %}

{% step %}

## Discord slots (optional)

Skip this step if every player has the same number of characters.

1. Create a bot in the Discord Developer Portal and invite it to your Discord server.
2. Put its token and your server ID in the convars of the previous step.
3. Enable the feature and list your roles in `shared/config.lua`:

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

```lua
discordSlots = {
    enabled = true,
    roles = {
        { id = '123456789012345678', slots = 5 },
    },
    users = {
        ['123456789012345678'] = 4,
    },
},
```

{% endcode %}

Slots by user ID (`users`) work without the bot and without the convars. Details in [Configuration](/scripts/core/cuxial-multichar/configuration.md#discord-slots).
{% endstep %}

{% step %}

## Start order

Start Cuxial Multichar after its dependencies.

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

```cfg
ensure oxmysql
ensure ox_lib
ensure qbx_core            # or qb-core
ensure ox_inventory        # or qb-inventory
ensure cuxial_bridge

# Appearance (optional): one of the two
ensure cuxial_appearance   # or illenium-appearance

# Optional
ensure cuxial_emotes
ensure cuxial_license
ensure cuxial_garages

ensure cuxial_multichar
```

{% endcode %}
{% endstep %}

{% step %}

## Final check

1. Restart the server and connect.
2. The loading screen appears and ends on a **start** button.
3. The selection opens with your characters, or the creation form if you have none.
4. Create a character: you go through the appearance creator (if you run an appearance resource) and spawn with the starter items.

If something fails, see [Troubleshooting](/scripts/core/cuxial-multichar/troubleshooting.md).
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cuxial.com/scripts/core/cuxial-multichar/installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
