QBCore Frameworkqbcore.netCommunity docs
On this page

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.

NamespaceAddAdd manyUpdateRemove
JobsAddJobAddJobsUpdateJobRemoveJob
GangsAddGangAddGangsUpdateGangRemoveGang
ItemsAddItemAddItemsUpdateItemRemoveItem

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))
end

Validate 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:

ExportSignatureReturn / boundary
SetMethodSetMethod(methodName, handler)Success boolean + status; rejects existing/invalid names
SetFieldSetField(fieldName, data)Success boolean + status; rejects existing/reserved fields
GetCoreVersionGetCoreVersion(invokingResource)Core version string; also logs the request
ExploitBanExploitBan(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.

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