Multicharacter
Database
Resource tables, automatic schema repair, framework tables, saving, and character deletion.
On this page6 sections
Automatic repair
Config.AutoFixDatabase = trueOn start, the resource compares the database with the columns it actually uses.
- Enabled: creates missing resource tables and adds missing columns. An
Unknown columnerror after an update fixes itself. - Disabled: prints the exact
CREATEandALTERstatements to run.
The repair never drops, renames, or retypes columns. It does not touch existing rows or create framework tables. It only adds new nullable columns to framework tables.
Run scfixdb to check manually.
Resource tables
sc_slots
Slots set with setslots. A row here replaces the calculated limit.
| Column | Type | Description |
|---|---|---|
license | VARCHAR(60), PK | Player identifier |
slots | INT UNSIGNED | Slot count |
set_by | VARCHAR(60) | Who set it |
updated_at | DATETIME | Change date |
sc_character_locks
Character locks from lockchar.
| Column | Type | Description |
|---|---|---|
citizenid | VARCHAR(60), PK | Character |
reason | VARCHAR(128) | Reason shown to the player |
locked_by | VARCHAR(60) | Who locked it |
locked_at | DATETIME | Lock date |
Framework tables
Characters are saved in the native framework table, so other resources see full character data.
| Framework | Table | Key | Added columns |
|---|---|---|---|
| ESX | users | identifier (char<N>:<license>) | metadata, height |
| QBCore | players | citizenid | cid, metadata |
| Qbox | players | citizenid | cid, metadata |
| ox_core | characters | charId | nationality, height, weight |
Manual install
sql/install.sql contains the resource tables. Import it when Config.AutoFixDatabase = false.
Saving characters
Characters are saved:
- every 5 minutes
- on
/relog - when the player leaves
- when the resource stops
Deleting characters
Deletion by a player or with forcedeletechar is immediate. On ox_core it is a soft delete (deleted = curdate()), like ox_core itself.
If your resources keep their own character data, clean it up in the OnCharacterDeleted hook.