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

# Installation & Configuration

#### Installation Instructions for **cylex\_multichar**

{% hint style="info" %}
Remember to choose your own framework and install accordingly!
{% endhint %}

{% tabs %}
{% tab title="ESX" %}
{% stepper %}
{% step %}
**Download the Script**

* Log in to [keymaster.fivem.net](https://keymaster.fivem.net).
* Click on **"Granted Access"** on the left side of the page.
* Search for **cylex\_multichar**
* Download all the available options that appear.
  {% endstep %}

{% step %}
**Extract the Files**

* After downloading, unzip all the **cylex\_multichar** zip folders.
* Create a new folder named **\[cylex\_multichar]** in your **resources** directory.
* Move all the extracted files into the newly created **\[cylex\_multichar]** folder.
  {% endstep %}

{% step %}
**Update the Server Configuration:**

* open > es\_extended > config.lua
* set <kbd>**Config.Multichar = true**</kbd>
* Delete <kbd>**esx\_multicharacter**</kbd> and <kbd>**other multicharacter**</kbd> scripts
* Open the **server.cfg** file located in your server files.
* <kbd>**stop basic-gamemode**</kbd> in server.cfg (do not add this again, if you have this, replace ensure with stop)
* Add the following lines at the bottom of the file:

  ```lua
  start cylex_multichar_map
  start cylex_multichar
  ```

{% endstep %}

{% step %}
**Configure the Script**

* Open the **cylex\_multichar/shared/sh\_config.lua** file in the **\[cylex\_multichar]** folder.
* Modify the configuration options according to your server needs:

```lua
Config = {
    debug = true,  -- Set to 'false' for production
    
    core = 'auto',  -- Choose from 'auto', 'esx', 'qb', 'qbox', or 'bs' based on your server framework
    
    clothing = 'auto',  -- Set clothing system: 'auto', 'fivem-appearance', 'qb-clothing', etc.
    
    CustomSpawnSelector = false,  -- Set to 'false' to disable custom spawn selection
    spawn_selector = 'auto',  -- Choose spawn selector: 'qb-spawn', 'qb-apartments', 'cylex_spawn', etc.

    WeatherSync = true,  -- Set to 'true' if using weather sync scripts like qb-weathersync
    
    date_format = "MM-DD-YYYY",  -- Adjust date format if needed
    weekdays = "WWW",  -- Set the weekday format
    date_lang = "en",  -- Choose the language for the date

    IdentifierType = 'license',  -- Set to 'steam' or 'license' depending on your player identification method
    skinTable = 'playerskins',  -- Set the database table for skin data

    FirstSpawnLocation = vector4(-1041.05, -2742.34, 12.93, 323.49),  -- Set the spawn location for new characters

    SelectedLocation = 'random',  -- Choose spawn locations: 'random', 'apartment', 'beach', etc.

    DisableCharDelete = false,  -- Set to 'true' to disable the character deletion button

    StarterItems = {  -- Define the starter items players will receive when creating a new character
        {name = 'phone', amount = 1},
        {name = 'id_card', amount = 1},
        {name = 'driver_license', amount = 1},
    }
}
```

* **core**: Set this to your server framework. Use `'auto'` if you want the script to automatically detect it, or specify your core, e.g., `'esx'`, `'qb'`, `'qbox'`, `'bs'`.
* **clothing**: Choose the clothing system based on what your server uses (e.g., `'fivem-appearance'`, `'qb-clothing'`, etc.).
* **CustomSpawnSelector**: Set to `false` if you don't want a custom spawn selector. If `true`, you'll need to configure the spawn selector type.
* **spawn\_selector**: Choose from various options like `'qb-spawn'` or `'cylex_spawn'` to customize the spawn system.
* **WeatherSync**: Set to `true` if you have a weather sync script installed, such as `qb-weathersync`.
* **date\_format** and **weekdays**: Adjust the date and weekday formats to your preferred style.
* **FirstSpawnLocation**: This defines where a player will spawn when creating a new character. Set it to your desired location using a vector4 (X, Y, Z, Heading).
* **SelectedLocation**: Choose the spawn location (e.g., `'random'`, `'apartment'`, `'beach'`, etc.).
* **DisableCharDelete**: If set to `true`, players will not have the option to delete their characters.
* **StarterItems**: Customize the starting inventory items that each new character will receive (e.g., phone, ID card, driver license).
* **core**: Set this to your server framework. Use `'auto'` if you want the script to automatically detect it, or specify your core, e.g., `'esx'`, `'qb'`, `'qbox'`, `'bs'`.
* **clothing**: Choose the clothing system based on what your server uses (e.g., `'fivem-appearance'`, `'qb-clothing'`, etc.).
* **CustomSpawnSelector**: Set to `false` if you don't want a custom spawn selector. If `true`, you'll need to configure the spawn selector type.
* **spawn\_selector**: Choose from various options like `'qb-spawn'` or `'cylex_spawn'` to customize the spawn system.
* **WeatherSync**: Set to `true` if you have a weather sync script installed, such as `qb-weathersync`.
* **date\_format** and **weekdays**: Adjust the date and weekday formats to your preferred style.
* **FirstSpawnLocation**: This defines where a player will spawn when creating a new character. Set it to your desired location using a vector4 (X, Y, Z, Heading).
* **SelectedLocation**: Choose the spawn location (e.g., `'random'`, `'apartment'`, `'beach'`, etc.).
* **DisableCharDelete**: If set to `true`, players will not have the option to delete their characters.
* **StarterItems**: Customize the starting inventory items that each new character will receive (e.g., phone, ID card, driver license).
  {% endstep %}

{% step %}
**Configure Character Slots and Discord Role Integration (sv\_config.lua)**

* Open the **shared/sv\_config.lua** file in the script folder to manage character slots and set up Discord integration.
* **Config.DefaultMaxSlot**: This defines the default maximum number of character slots for players who don't have special role-based or identifier-based slot assignments.

  ```lua
  Config.DefaultMaxSlot = 7  -- Default max character slots for regular players
  ```
* **Config.BotToken**: Add your **Discord bot token** here. This will allow the script to interact with your Discord server for role-based slot assignments.

  ```lua
  Config.BotToken = "YOUR_DISCORD_BOT_TOKEN"
  ```
* **Config.GuildId**: Add your **Discord guild (server) ID** here to specify the server that the bot should connect to.

  ```lua
  Config.GuildId = "YOUR_DISCORD_GUILD_ID"
  ```
* **Config.RoleSlots**: This section allows you to assign additional character slots to players based on their Discord roles. You can use either **role ID** or **role name**. To enable this feature, uncomment and modify the following example lines:

  ```lua
  Config.RoleSlots = {
      -- ["1168918990945538068"] = 2,  -- This role will have 2 character slots
      -- ["Administrator"] = 4        -- This role will have 4 character slots
  }
  ```
* **Config.ServerRolesUpdateInterval**: This defines how often the script will check for updated roles in Discord. The value is in milliseconds (e.g., `60000` means every 60 seconds). This setting determines how frequently the server will update role-based character slot assignments.

  ```lua
  Config.ServerRolesUpdateInterval = 60000  -- Update interval for Discord role-based slot assignments
  ```
* **Config.IdentifierSlots**: If you want to assign custom character slots based on player identifiers, such as **Steam Hex** or **Discord ID**, you can modify this table. This allows you to give certain players more character slots based on their unique identifiers.

  Example:

  ```lua
  Config.IdentifierSlots = {
      -- ["license:b4a06f39d0987252d5c15c4548e83e48f8660b83"] = 5,  -- Assign 5 slots to a specific player by their Steam license
      -- ["license:a9cacd4d5ed8124ed46c390a1008a1f1ad35536d"] = 7,  -- Assign 7 slots to another specific player
  }
  ```
* With these settings, you can manage character slots efficiently by defining default limits, setting specific slots based on Discord roles, and assigning slots to specific players based on their unique identifiers. Ensure all values are correct for your server setup.
  {% endstep %}
  {% endstepper %}
  {% endtab %}

{% tab title="QBCORE" %}
{% stepper %}
{% step %}
**Download the Script**

* Log in to [keymaster.fivem.net](https://keymaster.fivem.net).
* Click on **"Granted Access"** on the left side of the page.
* Search for **cylex\_multichar**
* Download all the available options that appear.
  {% endstep %}

{% step %}
**Extract the Files**

* After downloading, unzip all the **cylex\_multichar** zip folders.
* Create a new folder named **\[cylex\_multichar]** in your **resources** directory.
* Move all the extracted files into the newly created **\[cylex\_multichar]** folder.
  {% endstep %}

{% step %}
**Update the Server Configuration:**

* Delete <kbd>**qb-multicharacter**</kbd> and <kbd>**other multicharacter**</kbd> scripts.
* Open the **server.cfg** file located in your server files.
* <kbd>**stop basic-gamemode**</kbd> in server.cfg (do not add this again, if you have this, replace ensure with stop)
* Add the following lines at the bottom of the file:

  ```lua
  start cylex_multichar_map
  start cylex_multichar
  ```

{% endstep %}

{% step %}
**Configure the Script**

* Open the **cylex\_multichar/shared/sh\_config.lua** file in the **\[cylex\_multichar]** folder.
* Modify the configuration options according to your server needs:

```lua
Config = {
    debug = true,  -- Set to 'false' for production
    
    core = 'auto',  -- Choose from 'auto', 'esx', 'qb', 'qbox', or 'bs' based on your server framework
    
    clothing = 'auto',  -- Set clothing system: 'auto', 'fivem-appearance', 'qb-clothing', etc.
    
    CustomSpawnSelector = false,  -- Set to 'false' to disable custom spawn selection
    spawn_selector = 'auto',  -- Choose spawn selector: 'qb-spawn', 'qb-apartments', 'cylex_spawn', etc.

    WeatherSync = true,  -- Set to 'true' if using weather sync scripts like qb-weathersync
    
    date_format = "MM-DD-YYYY",  -- Adjust date format if needed
    weekdays = "WWW",  -- Set the weekday format
    date_lang = "en",  -- Choose the language for the date

    IdentifierType = 'license',  -- Set to 'steam' or 'license' depending on your player identification method
    skinTable = 'playerskins',  -- Set the database table for skin data

    FirstSpawnLocation = vector4(-1041.05, -2742.34, 12.93, 323.49),  -- Set the spawn location for new characters

    SelectedLocation = 'random',  -- Choose spawn locations: 'random', 'apartment', 'beach', etc.

    DisableCharDelete = false,  -- Set to 'true' to disable the character deletion button

    StarterItems = {  -- Define the starter items players will receive when creating a new character
        {name = 'phone', amount = 1},
        {name = 'id_card', amount = 1},
        {name = 'driver_license', amount = 1},
    }
}
```

* **core**: Set this to your server framework. Use `'auto'` if you want the script to automatically detect it, or specify your core, e.g., `'esx'`, `'qb'`, `'qbox'`, `'bs'`.
* **clothing**: Choose the clothing system based on what your server uses (e.g., `'fivem-appearance'`, `'qb-clothing'`, etc.).
* **CustomSpawnSelector**: Set to `false` if you don't want a custom spawn selector. If `true`, you'll need to configure the spawn selector type.
* **spawn\_selector**: Choose from various options like `'qb-spawn'` or `'cylex_spawn'` to customize the spawn system.
* **WeatherSync**: Set to `true` if you have a weather sync script installed, such as `qb-weathersync`.
* **date\_format** and **weekdays**: Adjust the date and weekday formats to your preferred style.
* **FirstSpawnLocation**: This defines where a player will spawn when creating a new character. Set it to your desired location using a vector4 (X, Y, Z, Heading).
* **SelectedLocation**: Choose the spawn location (e.g., `'random'`, `'apartment'`, `'beach'`, etc.).
* **DisableCharDelete**: If set to `true`, players will not have the option to delete their characters.
* **StarterItems**: Customize the starting inventory items that each new character will receive (e.g., phone, ID card, driver license).
  {% endstep %}

{% step %}

* **core**: Set this to your server framework. Use `'auto'` if you want the script to automatically detect it, or specify your core, e.g., `'esx'`, `'qb'`, `'qbox'`, `'bs'`.
* **clothing**: Choose the clothing system based on what your server uses (e.g., `'fivem-appearance'`, `'qb-clothing'`, etc.).
* **CustomSpawnSelector**: Set to `false` if you don't want a custom spawn selector. If `true`, you'll need to configure the spawn selector type.
* **spawn\_selector**: Choose from various options like `'qb-spawn'` or `'cylex_spawn'` to customize the spawn system.
* **WeatherSync**: Set to `true` if you have a weather sync script installed, such as `qb-weathersync`.
* **date\_format** and **weekdays**: Adjust the date and weekday formats to your preferred style.
* **FirstSpawnLocation**: This defines where a player will spawn when creating a new character. Set it to your desired location using a vector4 (X, Y, Z, Heading).
* **SelectedLocation**: Choose the spawn location (e.g., `'random'`, `'apartment'`, `'beach'`, etc.).
* **DisableCharDelete**: If set to `true`, players will not have the option to delete their characters.
* **StarterItems**: Customize the starting inventory items that each new character will receive (e.g., phone, ID card, driver license).
  {% endstep %}

{% step %}
**Configure Character Slots and Discord Role Integration (sv\_config.lua)**

* Open the **shared/sv\_config.lua** file in the script folder to manage character slots and set up Discord integration.
* **Config.DefaultMaxSlot**: This defines the default maximum number of character slots for players who don't have special role-based or identifier-based slot assignments.

  ```lua
  Config.DefaultMaxSlot = 7  -- Default max character slots for regular players
  ```
* **Config.BotToken**: Add your **Discord bot token** here. This will allow the script to interact with your Discord server for role-based slot assignments.

  ```lua
  Config.BotToken = "YOUR_DISCORD_BOT_TOKEN"
  ```
* **Config.GuildId**: Add your **Discord guild (server) ID** here to specify the server that the bot should connect to.

  ```lua
  Config.GuildId = "YOUR_DISCORD_GUILD_ID"
  ```
* **Config.RoleSlots**: This section allows you to assign additional character slots to players based on their Discord roles. You can use either **role ID** or **role name**. To enable this feature, uncomment and modify the following example lines:

  ```lua
  Config.RoleSlots = {
      -- ["1168918990945538068"] = 2,  -- This role will have 2 character slots
      -- ["Administrator"] = 4        -- This role will have 4 character slots
  }
  ```
* **Config.ServerRolesUpdateInterval**: This defines how often the script will check for updated roles in Discord. The value is in milliseconds (e.g., `60000` means every 60 seconds). This setting determines how frequently the server will update role-based character slot assignments.

  ```lua
  Config.ServerRolesUpdateInterval = 60000  -- Update interval for Discord role-based slot assignments
  ```
* **Config.IdentifierSlots**: If you want to assign custom character slots based on player identifiers, such as **Steam Hex** or **Discord ID**, you can modify this table. This allows you to give certain players more character slots based on their unique identifiers.

  Example:

  ```lua
  Config.IdentifierSlots = {
      -- ["license:b4a06f39d0987252d5c15c4548e83e48f8660b83"] = 5,  -- Assign 5 slots to a specific player by their Steam license
      -- ["license:a9cacd4d5ed8124ed46c390a1008a1f1ad35536d"] = 7,  -- Assign 7 slots to another specific player
  }
  ```
* With these settings, you can manage character slots efficiently by defining default limits, setting specific slots based on Discord roles, and assigning slots to specific players based on their unique identifiers. Ensure all values are correct for your server setup.
  {% endstep %}
  {% endstepper %}
  {% endtab %}

{% tab title="QBX" %}
{% stepper %}
{% step %}
**Download the Script**

* Log in to [keymaster.fivem.net](https://keymaster.fivem.net).
* Click on **"Granted Access"** on the left side of the page.
* Search for **cylex\_multichar**
* Download all the available options that appear.
  {% endstep %}

{% step %}
**Extract the Files**

* After downloading, unzip all the **cylex\_multichar** zip folders.
* Create a new folder named **\[cylex\_multichar]** in your **resources** directory.
* Move all the extracted files into the newly created **\[cylex\_multichar]** folder.
  {% endstep %}

{% step %}
**Update the Server Configuration:**

* Open > qbx\_core > config > client.lua
* `useExternalCharacters = false` set **true**
* `startingApartment = true` set **false**<br>
* Open the **server.cfg** file located in your server files.
* Add the following lines at the bottom of the file:

  ```lua
  start cylex_multichar_map
  start cylex_multichar
  ```

{% endstep %}

{% step %}
**Configure the Script**

* Open the **cylex\_multichar/shared/sh\_config.lua** file in the **\[cylex\_multichar]** folder.
* Modify the configuration options according to your server needs:

```lua
Config = {
    debug = true,  -- Set to 'false' for production
    
    core = 'auto',  -- Choose from 'auto', 'esx', 'qb', 'qbox', or 'bs' based on your server framework
    
    clothing = 'auto',  -- Set clothing system: 'auto', 'fivem-appearance', 'qb-clothing', etc.
    
    CustomSpawnSelector = false,  -- Set to 'false' to disable custom spawn selection
    spawn_selector = 'auto',  -- Choose spawn selector: 'qb-spawn', 'qb-apartments', 'cylex_spawn', etc.

    WeatherSync = true,  -- Set to 'true' if using weather sync scripts like qb-weathersync
    
    date_format = "MM-DD-YYYY",  -- Adjust date format if needed
    weekdays = "WWW",  -- Set the weekday format
    date_lang = "en",  -- Choose the language for the date

    IdentifierType = 'license',  -- Set to 'steam' or 'license' depending on your player identification method
    skinTable = 'playerskins',  -- Set the database table for skin data

    FirstSpawnLocation = vector4(-1041.05, -2742.34, 12.93, 323.49),  -- Set the spawn location for new characters

    SelectedLocation = 'random',  -- Choose spawn locations: 'random', 'apartment', 'beach', etc.

    DisableCharDelete = false,  -- Set to 'true' to disable the character deletion button

    StarterItems = {  -- Define the starter items players will receive when creating a new character
        {name = 'phone', amount = 1},
        {name = 'id_card', amount = 1},
        {name = 'driver_license', amount = 1},
    }
}
```

* **core**: Set this to your server framework. Use `'auto'` if you want the script to automatically detect it, or specify your core, e.g., `'esx'`, `'qb'`, `'qbox'`, `'bs'`.
* **clothing**: Choose the clothing system based on what your server uses (e.g., `'fivem-appearance'`, `'qb-clothing'`, etc.).
* **CustomSpawnSelector**: Set to `false` if you don't want a custom spawn selector. If `true`, you'll need to configure the spawn selector type.
* **spawn\_selector**: Choose from various options like `'qb-spawn'` or `'cylex_spawn'` to customize the spawn system.
* **WeatherSync**: Set to `true` if you have a weather sync script installed, such as `qb-weathersync`.
* **date\_format** and **weekdays**: Adjust the date and weekday formats to your preferred style.
* **FirstSpawnLocation**: This defines where a player will spawn when creating a new character. Set it to your desired location using a vector4 (X, Y, Z, Heading).
* **SelectedLocation**: Choose the spawn location (e.g., `'random'`, `'apartment'`, `'beach'`, etc.).
* **DisableCharDelete**: If set to `true`, players will not have the option to delete their characters.
* **StarterItems**: Customize the starting inventory items that each new character will receive (e.g., phone, ID card, driver license).
  {% endstep %}

{% step %}

* **core**: Set this to your server framework. Use `'auto'` if you want the script to automatically detect it, or specify your core, e.g., `'esx'`, `'qb'`, `'qbox'`, `'bs'`.
* **clothing**: Choose the clothing system based on what your server uses (e.g., `'fivem-appearance'`, `'qb-clothing'`, etc.).
* **CustomSpawnSelector**: Set to `false` if you don't want a custom spawn selector. If `true`, you'll need to configure the spawn selector type.
* **spawn\_selector**: Choose from various options like `'qb-spawn'` or `'cylex_spawn'` to customize the spawn system.
* **WeatherSync**: Set to `true` if you have a weather sync script installed, such as `qb-weathersync`.
* **date\_format** and **weekdays**: Adjust the date and weekday formats to your preferred style.
* **FirstSpawnLocation**: This defines where a player will spawn when creating a new character. Set it to your desired location using a vector4 (X, Y, Z, Heading).
* **SelectedLocation**: Choose the spawn location (e.g., `'random'`, `'apartment'`, `'beach'`, etc.).
* **DisableCharDelete**: If set to `true`, players will not have the option to delete their characters.
* **StarterItems**: Customize the starting inventory items that each new character will receive (e.g., phone, ID card, driver license).
  {% endstep %}

{% step %}
**Configure Character Slots and Discord Role Integration (sv\_config.lua)**

* Open the **shared/sv\_config.lua** file in the script folder to manage character slots and set up Discord integration.
* **Config.DefaultMaxSlot**: This defines the default maximum number of character slots for players who don't have special role-based or identifier-based slot assignments.

  ```lua
  Config.DefaultMaxSlot = 7  -- Default max character slots for regular players
  ```
* **Config.BotToken**: Add your **Discord bot token** here. This will allow the script to interact with your Discord server for role-based slot assignments.

  ```lua
  Config.BotToken = "YOUR_DISCORD_BOT_TOKEN"
  ```
* **Config.GuildId**: Add your **Discord guild (server) ID** here to specify the server that the bot should connect to.

  ```lua
  Config.GuildId = "YOUR_DISCORD_GUILD_ID"
  ```
* **Config.RoleSlots**: This section allows you to assign additional character slots to players based on their Discord roles. You can use either **role ID** or **role name**. To enable this feature, uncomment and modify the following example lines:

  ```lua
  Config.RoleSlots = {
      -- ["1168918990945538068"] = 2,  -- This role will have 2 character slots
      -- ["Administrator"] = 4        -- This role will have 4 character slots
  }
  ```
* **Config.ServerRolesUpdateInterval**: This defines how often the script will check for updated roles in Discord. The value is in milliseconds (e.g., `60000` means every 60 seconds). This setting determines how frequently the server will update role-based character slot assignments.

  ```lua
  Config.ServerRolesUpdateInterval = 60000  -- Update interval for Discord role-based slot assignments
  ```
* **Config.IdentifierSlots**: If you want to assign custom character slots based on player identifiers, such as **Steam Hex** or **Discord ID**, you can modify this table. This allows you to give certain players more character slots based on their unique identifiers.

  Example:

  ```lua
  Config.IdentifierSlots = {
      -- ["license:b4a06f39d0987252d5c15c4548e83e48f8660b83"] = 5,  -- Assign 5 slots to a specific player by their Steam license
      -- ["license:a9cacd4d5ed8124ed46c390a1008a1f1ad35536d"] = 7,  -- Assign 7 slots to another specific player
  }
  ```
* With these settings, you can manage character slots efficiently by defining default limits, setting specific slots based on Discord roles, and assigning slots to specific players based on their unique identifiers. Ensure all values are correct for your server setup.
  {% endstep %}
  {% endstepper %}
  {% endtab %}
  {% endtabs %}

By following these steps and adjusting the settings in **config.lua**, **MultiCharacter Script** will be fully configured and ready to use on your server!
