Skip to content

Bridges ​

np_character talks to frameworks only through NpChar.Framework. Each bridge file calls NpChar.Bridge.shouldLoad('framework', name, resource) and returns early unless its resource is started and selected (Config.Framework, or 'auto'). Files are numbered, so auto tries qbx_core → qb-core → es_extended, and 9_standalone.lua claims the slot when nothing else loaded. Detection runs once at start, so start the framework before np_character.

Every bridge call goes through pcall, so a missing export or a failing query degrades instead of erroring.

Server contract ​

bridge/framework/server/. 0_common.lua holds shared helpers; qb and qbx share one implementation (qbFamily) because their database layout and Player API are the same.

Contract Used for
name 'qbx', 'qb', 'esx' or 'standalone'
getLicense(src) The identifier that owns characters and slots
listCharacters(license) Framework rows: cid, slot, name, birthdate, gender, nationality, job, cash, bank, phone, position, downed
createCharacter(src, slot, identity) Creates the framework character. qb / qbx / esx also log it in
login(src, cid) / logout(src) Framework login at spawn:choose, logout on /logout
deleteCharacter(cid) Hard delete after the grace period
addMoney / removeMoney Starter cash, store prices, rename cost
getJob(src) / setDuty(src, on) Job unlocks in the blacklist, the duty switch on job spawns
isDowned(cid) Forced hospital spawn
giveStarterItems(src, items) Starter pack and ID card
saveSkin(cid, model, appearance) / loadSkin(cid) Appearance write-through and import
nameTaken(first, last, exceptCid) / setName(cid, first, last) Unique names, staff renames

What each bridge does ​

Contract qbx (qbx_core) qb (qb-core) esx (es_extended) standalone
identifier license2, else license license license license
CID citizenid citizenid char<slot>:<license hex> (users.identifier) 8 random characters
list players by license (charinfo, money, job, position, metadata) same users where identifier LIKE 'char%:<license>', job labels from ESX.GetJobs() np_characters
create qbx_core:Login(src, nil, { cid, charinfo }) QBCore.Player.Login(src, false, { cid, charinfo }) esx:onPlayerJoined(src, 'char<slot>', data), waits up to 10 s for the xPlayer insert into np_characters (cash and bank 0, unemployed)
login qbx_core:Login(src, cid) QBCore.Player.Login(src, cid) esx:onPlayerJoined(src, 'char<slot>') nothing to do
logout qbx_core:Logout(src) QBCore.Player.Logout(src) esx:playerLogout, waits up to 5 s nothing to do
hard delete qbx_core:ForceDeleteCharacter, else Config.FrameworkTables.qbx Config.FrameworkTables.qb Config.FrameworkTables.esx delete from np_characters
money Player.Functions.AddMoney / RemoveMoney same addAccountMoney / removeAccountMoney (cash = ESX money) cash / bank columns
duty Player.Functions.SetJobDuty same xPlayer.setJob(name, grade, onDuty) (ESX Legacy 1.10+) job.onduty in np_characters
downed metadata.isdead / inlaststand same Player(src).state.isDead, users.is_dead metadata.isdead
starter items ox_inventory, else Player.Functions.AddItem same ox_inventory, else xPlayer.addInventoryItem ox_inventory only
skin playerskins playerskins users.skin our meta row only
rename charinfo via SetPlayerData (if online) + SQL JSON_SET same xPlayer.setName (if online) + users.firstname / lastname np_characters

Money removals check the balance first and only accept cash or bank.

Appearance ​

The appearance format is illenium-appearance / fivem-appearance (Exports → Appearance).

  • Write-through: every saved appearance (create, store, staff reset) goes to np_character_meta.appearance and to the framework skin store: on qb / qbx the old playerskins rows of that citizenid are deleted and one row is inserted with model (the model name, like illenium-appearance) and active = 1; on ESX users.skin is updated.
  • Import: when np_character sees a framework character without a meta row (an existing server), it creates the row with the identity from the framework and the appearance from loadSkin: the active playerskins row or users.skin. Only illenium-appearance tables (with components or headBlend) are imported; qb-clothing and skinchanger formats are skipped, and the character starts with the defaults.
  • Read order: np_character uses its meta row first and falls back to loadSkin when it has no appearance.
  • Every appearance is sanitised on the server before it is stored: numbers clamped, missing keys filled from the model's defaults, unknown keys dropped, the blacklist applied with the player's job, and non-freemode models only with the np_character.peds permission node.

Client side ​

bridge/framework/client/ defines name, onLoaded(), onUnloaded() and isDead() for each framework. onLoaded replays the events the stock multicharacter or spawn resource would send:

qbx / qb esx standalone
onLoaded QBCore:Server:OnPlayerLoaded (server) + QBCore:Client:OnPlayerLoaded esx:onPlayerSpawn (server and client), playerSpawned, esx:restoreLoadout playerSpawned
isDead metadata.isdead / inlaststand, or a dead ped esx:onPlayerDeath / esx:onPlayerSpawn, or a dead ped a dead ped

np_character calls onLoaded once per character, just before np_character:loaded fires (the ped stands at the chosen spawn), and onUnloaded on /logout. So resources that wait for QBCore:Client:OnPlayerLoaded or esx:onPlayerSpawn start the same way they would with the stock multicharacter.

Tables ​

np_character's own tables (sql/np_character.sql, created at start with Config.AutoCreateTables):

Table Holds
np_character_meta One row per character on every framework: cid, license, slot, identity (JSON: name, birthdate, gender, nationality, height, walk style, voice, backstory), appearance, is_default, last_location (JSON with street label and a crash flag), playtime, last_seen, created_at, deleted_at (soft delete), rename_request
np_character_slots Per-license slot override (setSlots, staff panel). Wins over Config.Slots.default, capped at max
np_character_looks Look codes: code → appearance without tattoos, plus the license that created it
np_characters Standalone only: cid, license, slot, name, birthdate, gender, nationality, cash, bank, job (JSON), metadata (JSON)

Framework tables that np_character reads or writes:

Framework Tables
qbx / qb players (list, downed, unique names, rename), playerskins (skin write-through and import), plus Config.FrameworkTables.qbx / .qb on purge
esx users (list, downed, skin, unique names, rename), plus Config.FrameworkTables.esx on purge