Bridge — client API
Every client-side bridge function — player data, notifications, lifecycle events, keys, fuel and dispatch.
Every client-side bridge function — player data, notifications, lifecycle events, keys, fuel and dispatch.
These functions run client-side, on lib.bridge.
| Function | Returns | Description |
|---|---|---|
getPlayerData() | BridgePlayerData? | The local player (source, identifier, name, job). |
getMoney(moneyType?) | number | Account balance (cash default, bank, black). |
getInventory() | BridgeInventoryItem[] | The local player's items. |
getGang() | BridgeGang? | Current gang (QBCore / QBox only; nil elsewhere). |
getPlayerData()BridgePlayerData?getMoney(moneyType?)numbercash default, bank, black).getInventory()BridgeInventoryItem[]getGang()BridgeGang?nil elsewhere).---@class BridgePlayerData
---@field source number
---@field identifier string
---@field name string
---@field job BridgeJobgetPlayerData() can return nil if called before the player has fully spawned. Use onPlayerLoaded to run at the right time instead of calling it at boot.
| Function | Returns | Description |
|---|---|---|
notify(data) | — | Show a notification — { type, content, title?, duration? }. |
notify(data){ type, content, title?, duration? }.| Function | Returns | Description |
|---|---|---|
onPlayerLoaded(cb) | — | Runs cb() once the player has spawned. |
onPlayerUnload(cb) | — | Runs cb() on logout. |
onJobUpdate(cb) | — | Runs cb(job) whenever the job changes. |
onCharacterSpawned() | — | Trigger (not a listener) — call it after character select to notify the framework. |
onPlayerLoaded(cb)cb() once the player has spawned.onPlayerUnload(cb)cb() on logout.onJobUpdate(cb)cb(job) whenever the job changes.onCharacterSpawned()onPlayerLoaded fires once per session. If you restart your resource after spawn, the callback won't run again — check your login state at boot to cover that case.
| Function | Returns | Description |
|---|---|---|
giveVehicleKeys(vehicle) | — | Give keys for vehicle (entity handle). |
removeVehicleKeys(vehicle) | — | Remove keys. |
hasVehicleKeys(vehicle) | boolean | Whether the player has keys (false with no system). |
giveVehicleKeys(vehicle)vehicle (entity handle).removeVehicleKeys(vehicle)hasVehicleKeys(vehicle)booleanfalse with no system).Routed through your see:keys system; the plate is derived internally.
| Function | Returns | Description |
|---|---|---|
getFuel(vehicle) | number | Current fuel level (0–100). |
setFuel(vehicle, level) | — | Set fuel; clamped 0–100, ignored if level isn't a number. |
getFuel(vehicle)numbersetFuel(vehicle, level)level isn't a number.ox_fuel is driven by a statebag; the native fallback is local to the client (no sync).
| Function | Returns | Description |
|---|---|---|
sendDispatch(data) | — | Send a dispatch alert through your see:dispatch system. |
sendDispatch(data)see:dispatch system.data is optional — every field has a default:
lib.bridge.sendDispatch({
message = 'Robbery in progress',
code = '10-90', -- default '10-35'
priority = 'high', -- default 'medium'
jobs = { 'police' }, -- default { 'police' }
coords = vec3(0, 0, 0), -- default: caller's position
blip = { sprite = 161, color = 1, scale = 1.0 },
})lib.bridge.onPlayerLoaded(function()
local data = lib.bridge.getPlayerData()
print(data.name, data.job.name)
end)
lib.bridge.onJobUpdate(function(job)
if job.name == 'police' then
enablePoliceTools()
end
end)Keys, fuel and dispatch adapters for third-party systems are written from public APIs but not yet verified in-game — see Detection & config.