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 defines SetMethod, SetField, and GetCoreVersion. SetMethod and SetField
reject invalid names and existing keys; they do not overwrite an existing core entry.
Source: server/exports.luaΒ
Last updated on