Frameworks
Writing scripts for Qbox (qbx_core)
Learn Qbox scripting: how qbx_core differs from QBCore, the exports-based API (GetPlayer, AddMoney, SetJob, HasGroup, Notify), multi-job groups, QBX.PlayerData on the client, ox_lib and ox_inventory as the standard stack, and the QBCore compatibility bridge.
Overview
Qbox started as a fork of QBCore and became its own framework. It keeps QBCore’s data model — citizenid, PlayerData, jobs and gangs — but moves to an exports-based API, builds on ox_lib, ox_inventory and oxmysql, and adds multi-job support. If you know QBCore, Qbox is mostly new function names and cleaner patterns.
Qbox vs QBCore at a glance
| Topic | QBCore | Qbox |
|---|---|---|
| Core access | exports['qb-core']:GetCoreObject() | Direct exports: exports.qbx_core:GetPlayer() |
| Inventory | qb-inventory (or others) | ox_inventory |
| UI helpers | Own menus and notify | ox_lib |
| Jobs | One job, one gang | Multiple jobs and gangs, one primary |
| Old QB scripts | — | Mostly work through the built-in bridge |
01Resource setup
fx_version 'cerulean'
game 'gta5'
lua54 'yes'
shared_scripts {
'@ox_lib/init.lua',
'@qbx_core/modules/lib.lua',
}
client_scripts {
'@qbx_core/modules/playerdata.lua',
'client.lua',
}
server_script 'server.lua'
dependencies { 'qbx_core', 'ox_lib', 'ox_inventory' }modules/lib.lua adds the qbx helper table (string, math and table utilities, plate helpers); modules/playerdata.lua gives the client a live QBX.PlayerData.
Server API
| Task | Export |
|---|---|
| Get a player | exports.qbx_core:GetPlayer(source) |
| By citizen ID | exports.qbx_core:GetPlayerByCitizenId(cid) |
| Money | AddMoney(source, 'bank', n, reason), RemoveMoney, GetMoney |
| Jobs | SetJob(source, 'police', 2), AddPlayerToJob(cid, job, grade), SetJobDuty |
| Group checks | HasGroup(source, 'police'), HasPrimaryGroup, GetGroups |
| Duty count | GetDutyCountJob('police') |
| Notify | Notify(source, 'Saved', 'success') |
| Metadata | SetMetadata(source, key, value), GetMetadata |
local PRICE = 45
local MARKET = vec3(-1845.0, -1195.0, 14.3)
RegisterNetEvent('fishmarket:sell', function()
local src = source
if not exports.qbx_core:GetPlayer(src) then return end
if #(GetEntityCoords(GetPlayerPed(src)) - MARKET) > 5.0 then return end
local count = exports.ox_inventory:GetItemCount(src, 'fish')
if count < 1 then
return exports.qbx_core:Notify(src, 'You have no fish', 'error')
end
if exports.ox_inventory:RemoveItem(src, 'fish', count) then
exports.qbx_core:AddMoney(src, 'cash', count * PRICE, 'fish-market')
exports.qbx_core:Notify(src, ('Sold %d fish'):format(count), 'success')
end
end)Client side
RegisterCommand('myjob', function()
local job = QBX.PlayerData.job
lib.notify({ description = ('%s, grade %d'):format(job.label, job.grade.level) })
end, false)
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(job)
-- QBX.PlayerData is already updated; react here if needed
end)Items and usable items
Define items in ox_inventory/data/items.lua. Make them usable through ox_inventory (a server.export or client export on the item) rather than the old QBCore pattern; exports.qbx_core:CreateUseableItem still exists for compatibility. See inventory integration.
Running QBCore scripts on Qbox
qbx_core ships a QBCore bridge, so scripts calling exports['qb-core']:GetCoreObject() usually keep working. New code should use the exports directly — the bridge exists for migration, not as the main API. The QBCore version of this example is in the QBCore tutorial.
Frequently asked questions
What is Qbox?
A FiveM roleplay framework that grew out of QBCore, built on ox_lib, ox_inventory and oxmysql with an exports-based API.
Do QBCore scripts work on Qbox?
Most do, through qbx_core’s built-in QBCore bridge.
How do I get player data on the client in Qbox?
Add '@qbx_core/modules/playerdata.lua' to your client scripts and read QBX.PlayerData.
How do I add money in Qbox?
exports.qbx_core:AddMoney(source, 'cash', amount, reason).
Can a player have two jobs in Qbox?
Yes. Players can belong to several jobs and gangs, with one primary job.
Need this built, not just explained?
Ten years of FiveM work, from Lua to NUI
Custom resources, React NUI, ESX / QBCore / Qbox integration, OneSync performance audits and security reviews — plus the websites and SEO around your server brand.
Related guides
- FrameworksWriting your first QBCore scriptGet the core with local QBCore = exports['qb-core']:GetCoreObject(). On the server, QBCore.Functions.GetPlayer(source) returns the Player: read Player.PlayerData (citizenid, job, money) and change state with Player.Functions.AddMoney('cash', n), AddItem, RemoveItem, SetJob. Register usable items with QBCore.Functions.CreateUseableItem, commands with QBCore.Commands.Add. On the client use QBCore.Functions.GetPlayerData() and the QBCore:Client:OnPlayerLoaded / OnJobUpdate events.
- FrameworksGetting started with ox_libStart ox_lib before your resource, add shared_script '@ox_lib/init.lua' and lua54 'yes' to your fxmanifest, and the global lib becomes available. Use cache.ped/cache.vehicle instead of calling natives in loops, lib.callback for client↔server requests, lib.notify, lib.progressBar, lib.registerContext/lib.showContext, lib.inputDialog, lib.points and lib.zones for interaction, and lib.addCommand for commands with ACE restrictions.
- FrameworksWhat ox_core is and how scripts use itox_core manages users, characters, groups, bank accounts and persistent vehicles. In Lua, load it with local Ox = require '@ox_core.lib.init' and use Ox.GetPlayer(source) (an OxPlayer with charId, getGroup…), Ox.GetCharacterAccount(charId) for bank accounts (addBalance, removeBalance, transferBalance), and Ox.CreateVehicle for owned vehicles. JavaScript/TypeScript resources use the @overextended/ox_core npm package. Money in hand and items are ox_inventory items.