Cuxial Bridge lets one script run on QBox, QBCore or ESX without editing it. Scripts ask the bridge for players, money, jobs, items and target options; the bridge translates each request to whatever your server runs.
It is free and open source. Every Cuxial script requires it, and you install it once.
What it supports
| Layer | Supported | Detected by |
|---|---|---|
| Framework | QBox, QBCore, ESX | qbx_core, qb-core, es_extended |
| Inventory | ox_inventory, qb-inventory | Resource with that name |
| Target | sleepless_interact, ox_target, qb-target | Resource with that name |
Detection follows the order of each row. If two options are running, the first one wins: qbx_core over qb-core, ox_inventory over qb-inventory, sleepless_interact over ox_target.
If nothing is detected, the bridge falls back to QBox, ox_inventory and ox_target.
Some scripts require a specific framework: Cuxial Multichar requires QBox or QBCore. Each script's page lists its requirements.
Installation
Install the dependency
Cuxial Bridge needs ox_lib. Make sure it is installed and starts before the bridge.
Copy the resource
Download the latest release from GitHub and place the cuxial_bridge folder in your resources directory. Every version and its changes are listed on the releases page.
Keep the folder name cuxial_bridge. Every script loads it by that exact name and will fail to start if you rename it.
Start it after your framework
Add it below your framework, inventory and target, and above every Cuxial script.
ensure ox_lib
ensure qbx_core
ensure ox_inventory
ensure ox_target
ensure cuxial_bridgeReplace the framework, inventory and target lines with the ones your server uses.
Check the server console
On start, the bridge prints what it detected:
[cuxial_bridge] listo framework=qbox inventario=ox_inventory target=ox_target contexto=serverIf the three values match your server, you are done.
Configuration
Cuxial Bridge has no configuration file. You only need the convars below when detection picks the wrong option.
Forcing a choice
| Convar | Default | Values |
|---|---|---|
cuxial_bridge:framework | auto | auto, qbox, qbcore, esx |
cuxial_bridge:inventory | auto | auto, ox_inventory, qb-inventory |
cuxial_bridge:target | auto | auto, sleepless_interact, ox_target, qb-target |
setr cuxial_bridge:framework "esx"
setr cuxial_bridge:inventory "ox_inventory"
setr cuxial_bridge:target "ox_target"Use setr, not set. These values are read on the server and on each player's game; with set the two sides can disagree. Place the lines above ensure cuxial_bridge.
Custom database tables
Change these only if your framework stores characters or vehicles in tables with different names. They are read on the server only, so set is enough.
| Convar | QBox / QBCore default | ESX default | What it is |
|---|---|---|---|
cuxial_bridge:charTable | players | users | Characters table |
cuxial_bridge:charIdColumn | citizenid | identifier | Character identifier column |
cuxial_bridge:vehTable | player_vehicles | owned_vehicles | Owned vehicles table |
cuxial_bridge:vehOwnerColumn | citizenid | owner | Vehicle owner column |
set cuxial_bridge:charTable "players"For developers
Your own resources can use the bridge too. Add '@cuxial_bridge/init.lua' to their shared_scripts and call Bridge.*. These modules are the most useful outside the Cuxial scripts.
Bridge.Jobs (server)
Manage the members of any job, with the player online or offline, on QBox, QBCore and ESX. Built for boss menus that hire, fire and promote.
| Function | Returns | What it does |
|---|---|---|
Bridge.Jobs.Members(job) | table[] | { cid, name, grade, online, src? } of every member, online and offline. |
Bridge.Jobs.Grades(job) | table[] | { grade, name, isboss } from lowest to highest. |
Bridge.Jobs.Grade(cid, job) | number | nil | Grade of the character in that job, or nil if not a member. |
Bridge.Jobs.Hire(cid, job, grade) | ok, err | Gives the character that job as their main job. |
Bridge.Jobs.SetGrade(cid, job, grade) | ok, err | Changes the grade of a member. |
Bridge.Jobs.Remove(cid, job) | boolean | Removes the job, only if it is the character's job. |
Possible errors: params, no_job, no_grade, already, not_member, not_found, max_jobs, framework. On QBox, Hire respects qbx:setjob_replaces and qbx:max_jobs_per_player.
local ok, err = Bridge.Jobs.Hire(cid, 'mechanic', 0)
if not ok then print('hire failed', err) endBridge.Anim (client)
Locks the player's animations while a scene of your resource is running: sitting at a desk, a lift, a cutscene. While locked, Cuxial Emotes does not let the player start or cancel emotes, open the menu, raise hands, cross arms, point, ragdoll, lie down or crouch, and whatever the player was doing is released when the lock starts.
| Function | Returns | What it does |
|---|---|---|
Bridge.Anim.lock(reason) | — | Locks with a reason of your own ('seat', 'office'…). Repeating it does not count twice. |
Bridge.Anim.unlock(reason) | — | Releases that reason. |
Bridge.Anim.set(reason, locked) | — | lock or unlock depending on the boolean. |
Bridge.Anim.unlockAll() | — | Releases every reason of your resource. |
Bridge.Anim.isHeld(reason?) | boolean | Whether your resource holds that reason, or any reason without an argument. |
Bridge.Anim.isLocked() | boolean | Whether the player is locked by any resource. |
Bridge.Anim.lock('seat')
-- ... the scene ...
Bridge.Anim.unlock('seat')- Several resources and reasons add up: the player is free when none is left.
- If your resource stops, its locks are released. If Cuxial Emotes restarts, the active locks are applied again.
- The player state
animLockholds'resource:reason'of the first lock, ornil. Read it to avoid starting your own animation on top. It is written by the client: use it to block actions, never to grant them. - While a lock is active, the sd-phone phone is disabled and enabled again when it ends, unless another script had already disabled it.
sleepless_interacthides options with an animation while the lock lasts. - It requires Cuxial Emotes. Without it, the calls do nothing.
Bridge.Screens (server and client)
Adds screens and Cuxial OS apps from your resource to Cuxial Screens: registerScreen, removeScreen, registerApp, onCall, push, notify on the server, and open, close, isUsing on the client. They are registered again on their own if Cuxial Screens starts later or restarts. See Exports & events of Cuxial Screens.
Online players (server)
A list of connected players with a loaded character, kept in memory and updated by framework events (load, unload, job, gang, duty). Reading it does not call the framework for each player, so use it instead of looping over GetPlayers() with Bridge.GetPlayer.
| Function | Returns | What it does |
|---|---|---|
Bridge.OnlinePlayers() | table<src, entry> | Every entry: { src, cid, job, grade, duty, boss, gang, gangGrade }. Read it, do not modify it. |
Bridge.OnlineCount() | number | Players with a loaded character. |
Bridge.OnlineEntry(src) | entry | nil | The entry of one player. |
Bridge.OnlineSource(cid) | number | nil | Server id of the character, if online. |
Bridge.OnlineByJob(jobs, onDutyOnly?) | number[] | Server ids in that job. jobs is a name, a list of names or a set { police = true }. With onDutyOnly, only those on duty. |
Bridge.OnlineByGang(gang) | number[] | Server ids in that gang. |
Bridge.OnDutyChange(cb) | — | Calls cb(src, onDuty) when a player goes on or off duty. QBox and QBCore. |
for _, src in ipairs(Bridge.OnlineByJob({ 'police', 'sheriff' }, true)) do
Bridge.Notify(src, 'Robbery in progress', 'error')
endBridge.DB.GetVehicleOwners (server)
Bridge.DB.GetVehicleOwners(plates) returns the owner of several plates in a single query, as { [plate] = cid }. Plates without an owner are left out. It works on QBox, QBCore and ESX and follows the vehicle table convars.
local owners = Bridge.DB.GetVehicleOwners({ 'ABC123', 'XYZ789' })
print(owners['ABC123'])Bridge.Vehicles keys (server)
Vehicle keys from Cuxial Garages, the key item that carries the plate. Each function takes a plate or a vehicle entity. Without Cuxial Garages started, they return false.
| Function | Returns | What it does |
|---|---|---|
Bridge.Vehicles.GiveKeys(src, plateOrVehicle) | boolean | Gives the key. Does not duplicate it if the player already has it. |
Bridge.Vehicles.RemoveKeys(src, plateOrVehicle) | boolean | Removes every key of that plate from the player. |
Bridge.Vehicles.HasKeys(src, plateOrVehicle) | boolean | Whether the player has the key. |
if not Bridge.Vehicles.HasKeys(src, vehicle) then
Bridge.Vehicles.GiveKeys(src, vehicle)
endBridge.Fuel (server)
Reads and sets the fuel of a vehicle entity, from 0 to 100. It uses Cuxial Fuel when it is started and the vehicle's fuel state bag otherwise.
| Function | Returns | What it does |
|---|---|---|
Bridge.Fuel.Get(vehicle) | number | Current level. 0 if the entity does not exist. |
Bridge.Fuel.Set(vehicle, level) | boolean | Sets the level, clamped to 0-100. |
Bridge.Fuel.Set(vehicle, 100)Bridge.Target global options (client)
Adds options to every vehicle, ped or object in the world, on sleepless_interact, ox_target and qb-target.
| Function | What it does |
|---|---|
Bridge.Target.addGlobalVehicle(options) / removeGlobalVehicle(names) | Options on every vehicle. |
Bridge.Target.addGlobalPed(options) / removeGlobalPed(names) | Options on every ped. |
Bridge.Target.addGlobalObject(options) / removeGlobalObject(names) | Options on every object. |
Each option takes name, label, icon, distance, canInteract(entity) and onSelect(entity), plus bones (a bone name or a list) on targets that support it. names is a name or a list of names.
Bridge.Target.addGlobalVehicle({
{
name = 'myres:inspect',
label = 'Inspect',
icon = 'fa-solid fa-magnifying-glass',
bones = { 'boot' },
onSelect = function(vehicle) print('inspect', vehicle) end,
},
})Bridge.Media (server)
Live view of a player's screen, and optionally their microphone, for other players: the method Cuxial Admin uses to watch and listen. Sessions belong to the resource that opens them, one per player and resource. The bridge does not check permissions: your resource decides who watches whom.
| Function | Returns | What it does |
|---|---|---|
Bridge.Media.Open(src, opts?) | string | nil | Starts a session on that player and returns its id, or the id already open. opts: audio, maxViewers (0 = no limit), tag, onEnd(session, reason). |
Bridge.Media.AddViewer(id, viewerSrc) | boolean | Adds a viewer. |
Bridge.Media.RemoveViewer(id, viewerSrc) | — | Removes a viewer. |
Bridge.Media.SetAudio(id, on) | boolean | Turns the player's microphone on or off in the session. |
Bridge.Media.Close(id, reason?) | — | Ends the session. |
Bridge.Media.List(tag?) | table[] | Active sessions of your resource, oldest first: { id, src, tag, viewers, startedAt, audio }. |
Bridge.Media.Get(id) | table | nil | The session, read only. |
Bridge.Media.ByTarget(src) | string | nil | Id of the session on that player. |
Bridge.Media.IsViewer(id, src) | boolean | Whether that player is watching the session. |
Bridge.Media.ViewerCount(id) | number | Current viewers. |
When a session ends, onEnd is called and the local server event cuxial_bridge:mediaEnded fires with id, reason, tag, resource. Reasons: closed, host_left, failed, resource_stop. Filter by resource if you listen from another resource.
local id = Bridge.Media.Open(targetSrc, { audio = false, maxViewers = 4, tag = 'spectate' })
if id then Bridge.Media.AddViewer(id, staffSrc) end
AddEventHandler('cuxial_bridge:mediaEnded', function(sessionId, reason, tag, resource)
if resource ~= GetCurrentResourceName() then return end
print('session ended', sessionId, reason)
end)The picture is captured and shown by your resource's interface. Include the live kit from the bridge's webkit/ folder: the host in the interface every player loads, and the viewer where the session is watched.
Updates
A few seconds after the server starts, Cuxial Bridge checks the version of every Cuxial script you run, the bridge included, and prints a single block in the server console: one line per script with a newer version, with the new number and whether it is a major, minor or patch update. When everything is up to date it prints one short line. Nothing is downloaded or changed automatically. The check is a single request that sends no data about your server.
The current version of Cuxial Bridge is 2.26.0.
| Convar | What it does |
|---|---|
cuxial_versioncheck 0 | Turns the notice off. |
cuxial_versioncheck_quiet 1 | Hides the line shown when everything is up to date. |
cuxial_versioncheck_details 1 | Shows up to 3 changes per outdated script. |
cuxial_versioncheck_url "https://…" | Changes the address the check queries. |
set cuxial_versioncheck_details 1To update, download the latest release, replace the cuxial_bridge folder and restart the server.
Update the bridge before updating a script: new script versions can rely on the latest bridge. See Updating a script.
Common problems
The console shows a warning that no framework was detected
The warning reads [cuxial_bridge] aviso: no se detectó framework, usando fallback "qbox".
Cause. Your framework was not running when the bridge, or a script, loaded.
Fix. Move the framework ensure line above cuxial_bridge and above every Cuxial script. If the framework resource has a non-standard folder name, force it with setr cuxial_bridge:framework.
The wrong inventory or target is detected
Cause. Two options are running at the same time, or yours starts after the Cuxial scripts.
Fix. Check the start order first. If both resources must stay, force the right one with setr cuxial_bridge:inventory or setr cuxial_bridge:target.
A script fails to start with an error mentioning cuxial_bridge/init.lua
Cause. The bridge is missing, was renamed, or starts after the script.
Fix. Confirm the folder is named cuxial_bridge and that ensure cuxial_bridge appears before the script.
