Multicharacter
~Buy Here~
INSTALLATION GUIDE
Step 0 - First Steps
1. Download your resource from FiveM's Keymaster.
2. Unzip the cd_multicharacter.zip folder and place this folder in your server's resource folder.
3. Add the resource to your server start config (server.cfg): ensure cd_multicharacter. If you are using a framework, it must be placed anywhere below your framework resource e.g., es_extended, not above.
ensure es_extended
ensure cd_multicharacterStep 1 - Fxmanifest
Depending on your framework and dependencies, you may need to make some changes inside the [cd_multicharacter/fxmanifest.lua]. We have made this easier by commenting on the lines you possibly need to change.
Step 2 - Configure Resource
You MUST read all configurable options inside the [cd_multicharacter/configs/config.lua] file and configure them to suit your server's needs. Please read the "commented out help text" at the end of each line so you can understand what each config option does.
The most important sections are the options under the Frameworkand Importantsections at the top of the config.lua. Everything else is optional.
Introducing our new 'auto_detect' feature! It automatically identifies your framework and applies the appropriate default settings.
Step 3 - SQL Database
You MUST import the SQL file to your database. This SQL file is located inside theREAD_ME_AFTER_PURCHASING folder; the file is named SQL_main.sql. Watch this video if you are unsure how to do this HeidiSQL / PHPMyAdmin.
Step 4 - Install Dependencies
Where can I find these dependencies?
Open the [cd_multicharacter/dependencies] folder. The folders inside are the required dependencies. You will find a text file inside each folder that includes a GitHub download link. Alternatively, they are listed in the table below.
Where should I put these dependencies?
These resources should be placed in your resources folder like any other, but remember, you shouldn't put them in the cd_multicharacter folder.
Do I need to add them to the server start config?
No, it will start automatically because it is listed as a dependency for this resource.
| Resource Name | Download | Details |
|---|---|---|
| cd_drawtextui | Github | REQUIRED by default for the switch character locations if enabled but can be replaced/removed. |
Step 5 - ESX Client Edit
We need to do a small modification to stop your framework from registering our character instantly when you load into the server.
Step 6 - Player Skin Edit
We will be setting the skin of your chosen character directly from the cd_multicharacter or cd_identity, so we don't need your skin creator script to do this.
Step 7 - Multi-Peds Skin Edit
Now we need to copy and paste some code into your character skin creation script to set the skin of the peds. Currently, we support 3 different clothing scripts. However, we have 2 different methods for esx_skin as the first supports older versions and the second supports newer versions, but always try the older version first.
OPTIONAL FEATURES
This section is to help you understand how the built-in features of this resource work, and if applicable, how you can make them compatible with other resources. These features are not required, they are optional and can be configured in the [configs/config.lua].
Advanced multi-character method
DANGER
WARNING If you are not 100% sure what you are doing here we would not recommend doing this, but if you insist please read the information before implementing these changes. If you are unsure what this does, read more about it on our Web Store.
This is completely optional. We do not recommend using this option unless you have basic knowledge of Lua and you understand what needs to be done from reading the instructions below. This method is more complicated and more effort to install but is far more optimized than the standard esx_kashacters method.
Part 1: Set the Config.UseAdvancedMultiCharMethod in the config.lua to true.
Part 2: If you are switching from the standard multi-character version to the advanced multicharacter version you need to use this command in your server console below before any players join.
AdvancedMulticharPart 3: Replace the FiveM native method of getting a players identifier (steam id, license) GetPlayerIdentifiers(source)[1] or GetPlayerIdentifiers(source)[2] with xPlayer.identifier for every server-side resource which uses the identifier to fetch a character's data from the database. xPlayer of course needs to be defined before using it eg., local xPlayer = ESX.GetPlayerFromId(source).
Example 1: Do not change this.
Part 4: Follow the guide below for your version of ESX.
Switching Characters
Part 1: Copy and paste this block of code below into your character skin creator script, at the very bottom of the client-side main.lua.
Part 2: We need to add 2 events to your es_extended resource to tell the code that we are switching characters.
INFORMATION
Default Key Binds
These keys can be modified and/or disabled in the Keys and Commands section of the [configs/config.lua].
| Key | Description |
|---|---|
Enter / Left Mouse | Select a character. |
Left / Right Arrows | Cycle through the characters. |
Chat Commands
These chat commands can be renamed and/or disabled in the Keys and Commands section of the [configs/config.lua].
The exact usage for each command will be displayed in the chat suggestions when using the commands in-game.
| Command | Description |
|---|---|
/charslots | (staff command) To check/add/remove a player's character slots. |
/switchcharacter | If enabled, this will allow players to change characters in-game. |
/DatabaseCleaner | (console command) This will remove all of the unneeded rows in your database which ESX resources unnecessarily add. Should only be needed a couple of times per month. |
/SetAllMaxChars | (console command) This will set the max character slots for all player's in the database - if you ever need to change them all. |
/AdvancedMultichar | (console command) Read here before using. |
COMMON ISSUES
Please check out our Troubleshooting Guide before contacting our support.
Folder Name Make sure the name of the folder is cd_multicharacter.
Encrypted Files Do not edit the encrypted files in any way.
Always F8 Quit Make sure you and your players fully close FiveM before reconnecting to your server by either F8 quitting or force closing FiveM; this is a known issue with FiveM, not the multicharacter.
Always Restart Server Never restart the resource while the server is live; always restart the server to ensure no unforeseen issues.
SERVER-SIDE (database)
SQL Unknown Column Error?
eg., if you see an SQL error in the server console similar to this example - ER_BAD_FIELD_ERROR: Unknown colum 'max_chars' in 'where clause'.
You are missing one of the required database columns. The SQL file can be found in the "READ_ME_AFTER_PURCHASING" folder OR this specific column you have entered into the Config.Database table does not exist in the DatabaseTable.
SQL Table Doesn't Exist Error?
eg., if you see an SQL error in the server console similar to this example - ER_NO_SUCH_TABLE: Table 'exampletable' dosesn't exist'.
You have added this exampletable into the Config.Database table but it does not exist in your database. Remove it from the Config.DatabaseTable.
SQL Duplicate Entry Error? (datastore table)
eg., if you see an SQL error saying you have a duplicate entry in the datastore table similar to this: [ERROR] [MySQL] An error happens on MySQL for query "INSERT INTO datastore_data (name, owner, data) VALUES ('property', 'steam:111738473874', '{}')": ER_DUP_ENTRY: Duplicate entry 'property-steam:111738473874' for key 'index_datastore_data_name_owner'.
SERVER-SIDE
Characters not saving after re-logging?
eg., if your characters don't save after you create them or some data is not being saved in the database.
Then most likely the length of the columns in your database tables have not been automatically set to 50. You need to do this because if you are using the r* license identifier type, the length of this identifier along with the extra Char1: make the total length of the identifier more than the maximum default length of 40 characters. You can manually change the length of the identifier column in your HeidiSQL/PhpMyAdmin database viewer.
All of my characters are default peds with no character info?
eg., if you see default peds with no character information being display when you are certain you have characters saved in the database.
This is something to do with your characters identifiers in the users table. The identifier the script is using does not match your characters identifier in the users database table, you will need to compare the 2. This usually happens when you have a modified framework which uses steamid's (Char1:110000105bdca75) for example but the default framework uses rockstar license (Char1:23498202342384729830327487320) so the script can not find the identifier in the users database table.
UI not displaying the correct sex?
eg., if you see "Non-Binary" on the character selection UI, this means the script could not find one of the standard sex types eg., m, male, f, female in the sex column for this character in the users database table. And if you see "Autosexual" that means the sex column for one of your characters is empty.
This means your identity script is not adding the correct data to the database so you should check why. But a quick fix is to manually add m into the sex column which is currently empty.
CLIENT-SIDE
Ped visible on first spawn?
eg., if you see your ped when first loading into the server before the character selection screen activates.
This should not happen, there should be a black screen, so means another script is conflicting. This is most likely caused by 1 line of code in es_extended or essentialmode or spawnmanager. Search for DoScreenFadeIn in the client-side of either of these resources and remove it then restart your server. (It could be in other resources too but these are the common ones).
Ped in front of camera?
eg., if you see your player's ped standing in front of the camera during the character selection screen.
Modify the Config.Cam x, y, z coordinates of the camera in the config.lua. This will most likely be trial and error on your side to get the correct camera position.
No such export GetPedList in resource skinchanger?
eg., if you see an error similar to this in the client F8 console.
This could either mean you have not complete Step 7 correctly, or the name your skinchanger script has been changed. The easy fix is to make sure the name of your skinchanger script is skinchanger Or rename the export in the client_customise_me.lua to the name of your renamed skinchanger script.
Character floating in the sky
eg., if your character is floating in the sky (like this).
Remove this line from the fxmanifest.lua in your loading screen resource -loadscreen_manual_shutdown 'yes'.
Issues with skins not loading?
eg., if your peds skins are not loading.
This is caused by low end spec PC's or server hosting. There's two working solutions to solving this issue.
Fix 1: Add a Wait prior to the event that loads the skin to give ample time for it to load in correctly. Example below from the client_customise_me.lua of where the wait should be added:
if Config.SkinScript == 'esx_skin' then
Wait(3000)
TriggerEvent('skinchanger:loadSkin', skin)Fix 2: Remove the default ped integration within es_extended. It should look similar to the code blocks below. Example below needs this code block hashed out/removed from the main.lua of the client of es_extended:
if GetEntityModel(PlayerPedId()) == GetHashKey('PLAYER_ZERO') then
local defaultModel = GetHashKey('a_m_y_stbla_02')
RequestModel(defaultModel)
while not HasModelLoaded(defaultModel) do
Citizen.Wait(10)
end
SetPlayerModel(PlayerId(), defaultModel)
SetPedDefaultComponentVariation(PlayerPedId())
SetPedRandomComponentVariation(PlayerPedId(), true)
SetModelAsNoLongerNeeded(defaultModel)
endCharacters not showing but blue arrows do show
eg., if your character is not showing but the blue arrows are showing.
Replace the SetCoords function in the funtions.lua with the function below:
function SetCoords(coords)
local ped = PlayerPedId()
RequestCollisionAtCoord(coords.x, coords.y, coords.z) local timeout=0 while not HasCollisionLoadedAroundEntity(ped) and timeout <=1000 do RequestCollisionAtCoord(coords.x, coords.y, coords.z) Citizen.Wait(10) timeout=timeout+1 end
SetEntityCoords(ped, coords.x, coords.y, coords.z)
SetEntityHeading(ped, coords.h)
endERROR CODES
If you see an error code not listed below please open a script support ticket in the Codesign Discord.
FRESH TEST SERVER
INFO
PLEASE READ: The only purpose of the steps below is to help you debug the multicharacter script if you are having issues that are not common andunable to debug the cause of the issues.
We recommend you do this on a test server/local host.
Test Environment Setup
- Operating System: Windows 10
- MySQL Database Server: 10.4.13-MariaDB
- FiveM Server Artifacts: Latest Recommended (5562)
- Database Viewer: HeidiSQL Version 11.3.0.6295 (64 Bit)
- FiveM MySQL Resource: mysql-async Version 3.3.2
- Framework: ESX Legacy
- OneSync: Infinity
Guide
Step 1 - Download Server Files
Download our full FiveM Server folder from our GitHub.
Do you use esx_skin? Download this version.
Do you use cui_character? Download this version.
Step 2 - Add License Key
Open the server.cfg and add in your licenseKey.
Step 3 - Import Database
Watch this video if you are unsure how to do this.
Step 4 - Add Codesign Scripts
Make sure you download the latest versions of cd_multicharacter / cd_spawnselect / cd_identity and add them into the [Codesign] folder.
Now start the server, create a character, relog and choose your newly created character.
CHANGELOG
Files Changed
Not every update requires replacing the entire folder. To avoid redoing your configs, use the option that applies
| Key | Meaning |
|---|---|
| Full Re-Download Required | Delete the old folder and replace it with the latest version. Reuse your config.lua unless told otherwise. |
| Update Specific Files | Only the files listed below need to be replaced. |
| Config Update Required | Your config.lua must be updated for this version. |
| Requires Auto SQL Enabled | Enable Config.AutoInsertSQL in config.lua to apply required database updates. |
Skipping Updates
If you’ve skipped previous updates, it’s recommended to update all files to avoid issues.
For example, if you're on v4.0.1, skipped v4.0.2, and are updating to v4.0.3, use the Full Download option.