QBCore Frameworkqbcore.netCommunity docs
On this page

Updated 2026-09-27 · 3 min read

QBCore shared data

qb-core loads its shared definitions before client and server scripts. At the verified commit the manifest loads locale data, shared/main.lua, utility functions, items, jobs, vehicles, gangs, weapons, and locations.

Read a namespace

local policeJob = exports['qb-core']:GetShared('Jobs', 'police')
local allItems = exports['qb-core']:GetShared('Items')

GetShared(namespace, item) returns the whole namespace when item is omitted, one entry when it is supplied, and nil for an unknown namespace/key.

The source annotation currently names these namespaces:

NamespaceTypical value
Vehiclesvehicle definitions
VehicleHasheshash lookup generated by the vehicle data
Itemsitem definitions
Gangsgang definitions
Jobsjob definitions
Locationsshared coordinates/locations
Weaponsweapon definitions
StarterItemsstarter inventory definitions

Read through the core object

local QBCore = exports['qb-core']:GetCoreObject({ 'Shared' })
local water = QBCore.Shared.Items['water_bottle']

Treat these tables as framework-owned data. For supported server-side runtime mutations use the shared mutation exports rather than editing a cached client table.

Shared utility functions

Current shared/functions.lua exposes these functions on both sides:

FunctionSignatureReturn / behavior
RandomStrRandomStr(length)Random alphabetic string; empty string for non-positive length
RandomIntRandomInt(length)Random numeric string; empty string for non-positive length
SplitStrSplitStr(str, delimiter)Array of string segments
TrimTrim(value)Trimmed string, or nil for a falsy value
FirstToUpperFirstToUpper(value)String with first lowercase character uppercased, or nil
RoundRound(value, numDecimalPlaces)Rounded number
ChangeVehicleExtraChangeVehicleExtra(vehicle, extra, enable)Applies a vehicle-extra state; no return
IsFunctionIsFunction(value)Boolean for Lua/CFX function references
SetDefaultVehicleExtrasSetDefaultVehicleExtras(vehicle, config)Resets extras then applies the config; no return

The vehicle helpers call GTA natives, so although the file is shared, invoke them only in a context where those entity natives and handles are valid.

Starter items

At this commit QBCore.Shared.StarterItems contains phone, id_card, and driver_license, each with amount 1. Do not copy that list into a migration and assume it matches a fork; inspect the deployed shared file.

Runtime mutation boundary

The shared tables are ordinary Lua tables, but supported server exports exist for adding, updating, and removing jobs, gangs, and items. Those exports notify clients after a successful mutation. Runtime changes do not persist back into the source files, so maintain the deployed definitions as the source of truth across restarts.

Sources

Found an issue in this guide?

Send the page URL, the affected example, and a source or reproduction to the site maintainer. For a server or resource problem, use the support guide.

On this page

Leonida RP server website built with RPWebsite
RPWebsite

Advertisement · RPWebsite

Want a website for your server?

Launch a site with live player status, rules, and a join button in minutes.

Build your website