2 min read
Shared mutation exports
At the verified commit, server/exports.lua exposes runtime mutation helpers for jobs, gangs,
and items. These exports run on the server and notify clients after a successful change.
| Namespace | Add | Add many | Update | Remove |
|---|---|---|---|---|
| Jobs | AddJob | AddJobs | UpdateJob | RemoveJob |
| Gangs | AddGang | AddGangs | UpdateGang | RemoveGang |
| Items | AddItem | AddItems | UpdateItem | RemoveItem |
Each operation returns a success boolean followed by a status string. Bulk operations can also return the value that caused validation to fail.
local ok, reason = exports['qb-core']:AddItem('example_item', {
name = 'example_item',
label = 'Example item',
weight = 100,
type = 'item',
image = 'example_item.png',
unique = false,
useable = false,
shouldClose = true,
combinable = nil,
description = 'Example only'
})
if not ok then
print(('AddItem failed: %s'):format(reason))
endValidate table data against current upstream definitions and test dependent resources after every mutation. Runtime changes are not a substitute for maintaining the deployed source definitions.
The same file also exports:
| Export | Signature | Return / boundary |
|---|---|---|
SetMethod | SetMethod(methodName, handler) | Success boolean + status; rejects existing/invalid names |
SetField | SetField(fieldName, data) | Success boolean + status; rejects existing/reserved fields |
GetCoreVersion | GetCoreVersion(invokingResource) | Core version string; also logs the request |
ExploitBan | ExploitBan(playerId, origin) | Security/ban helper used by core integrations; not a general gameplay API |
ExploitBan is exported because other QBCore resources can invoke the core's exploit-ban path.
Do not use it as an application-level authorization substitute; validate server events before a
reward or privileged state change.
Source: server/exports.lua
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.
