Overview
Qbox Core includes a built-in multicharacter system that allows players to create and manage multiple characters per FiveM license. Each character has its own unique identity, inventory, money, and progression.Character Registration
The character registration data structure defines the basic information needed to create a new character.types.lua
Character Slots
The number of character slots available to each player is configurable.Default Configuration
config.server.lua
Getting Character Limit
server/character.lua
Character Creation Flow
1. Fetch Available Characters
When a player connects, the client requests their character list:server/character.lua
- Array of existing
PlayerEntityobjects - Maximum number of characters allowed
2. Preview Character Appearance
Before selecting a character, the client can fetch their appearance:server/character.lua
3. Create New Character
When creating a new character:server/character.lua
- Receives character info (name, gender, birthdate, etc.)
- Calls
Login()withnilcitizenid (triggers new character creation) - Gives starter items via ox_inventory
- Returns the new character data
4. Load Existing Character
server/character.lua
Starter Items
New characters receive starter items defined in the configuration.server/character.lua
Example Starter Items Configuration
config.shared.lua
Character Data Initialization
When a character is created or loaded, theCheckPlayerData function initializes all default values.
server/player.lua
Character Deletion
Delete Character (Player Initiated)
server/character.lua
Force Delete Character (Admin)
server/commands.lua
Character Identifier (CID)
Each character has acid field representing their slot number (1, 2, 3, etc.).
types.lua
citizenid, which is a unique identifier for the character itself.
Storage Integration
Character data is managed through the storage layer:types.lua
Example: Custom Character Selection UI
Best Practices
Unique Identifiers
Unique Identifiers
Always use
citizenid as the unique identifier for characters in your database and scripts. The cid is just the slot number and can be reused.Character Limits
Character Limits
Use the
playersNumberOfCharacters config to grant VIP or donator players additional character slots.Starter Items
Starter Items
Configure starter items with metadata functions to include character-specific information (e.g., ID cards with names).
Character Deletion
Character Deletion
Always verify character ownership before allowing deletion. The built-in system handles this automatically.