Skip to main content

Player Data

GetPlayerData

Returns the current player’s data.
local playerData = exports.qbx_core:GetPlayerData()
playerData
PlayerData?
The player’s data object, or nil if not logged in
Example:
local playerData = exports.qbx_core:GetPlayerData()
if playerData then
    print("Player name: " .. playerData.charinfo.firstname .. " " .. playerData.charinfo.lastname)
    print("Job: " .. playerData.job.name)
end

Group Functions

HasPrimaryGroup

Checks if the player has a specific primary group (job or gang).
local hasPrimary = exports.qbx_core:HasPrimaryGroup(filter)
filter
string | string[] | table<string, number>
The group(s) to check for. Can be a single group name, array of names, or table with grade requirements
hasPrimary
boolean
True if the player has the primary group, false otherwise
Example:
-- Check single group
if exports.qbx_core:HasPrimaryGroup('police') then
    print("Player is a police officer")
end

-- Check multiple groups
if exports.qbx_core:HasPrimaryGroup({'police', 'ambulance'}) then
    print("Player is police or ambulance")
end

-- Check with grade requirement
if exports.qbx_core:HasPrimaryGroup({police = 2}) then
    print("Player is police with grade 2 or higher")
end

HasGroup

Checks if the player has a specific group (job or gang), not necessarily as primary.
local hasGroup = exports.qbx_core:HasGroup(filter)
filter
string | string[] | table<string, number>
The group(s) to check for. Can be a single group name, array of names, or table with grade requirements
hasGroup
boolean
True if the player has the group, false otherwise
Example:
if exports.qbx_core:HasGroup('police') then
    print("Player has police group")
end

GetGroups

Returns all groups the player belongs to.
local groups = exports.qbx_core:GetGroups()
groups
table<string, integer>
A table of group names and their corresponding grades
Example:
local groups = exports.qbx_core:GetGroups()
for groupName, grade in pairs(groups) do
    print(groupName .. ": " .. grade)
end

Job & Gang Functions

GetJobs

Returns all available jobs in the server.
local jobs = exports.qbx_core:GetJobs()
jobs
table<string, Job>
A table of all jobs indexed by job name
Example:
local jobs = exports.qbx_core:GetJobs()
for jobName, jobData in pairs(jobs) do
    print(jobName .. ": " .. jobData.label)
end

GetJob

Returns data for a specific job.
local job = exports.qbx_core:GetJob(name)
name
string
required
The name of the job to retrieve
job
Job?
The job data, or nil if not found
Example:
local policeJob = exports.qbx_core:GetJob('police')
if policeJob then
    print("Police label: " .. policeJob.label)
end

GetGangs

Returns all available gangs in the server.
local gangs = exports.qbx_core:GetGangs()
gangs
table<string, Gang>
A table of all gangs indexed by gang name
Example:
local gangs = exports.qbx_core:GetGangs()
for gangName, gangData in pairs(gangs) do
    print(gangName .. ": " .. gangData.label)
end

GetGang

Returns data for a specific gang.
local gang = exports.qbx_core:GetGang(name)
name
string
required
The name of the gang to retrieve
gang
Gang?
The gang data, or nil if not found
Example:
local ballas = exports.qbx_core:GetGang('ballas')
if ballas then
    print("Ballas label: " .. ballas.label)
end

Vehicle Functions

GetVehiclesByName

Returns vehicle data by name or all vehicles.
local vehicles = exports.qbx_core:GetVehiclesByName(key)
key
string
The vehicle name to retrieve. If omitted, returns all vehicles
vehicles
table<string, Vehicle> | Vehicle
Either a specific vehicle or all vehicles indexed by name
Example:
-- Get all vehicles
local allVehicles = exports.qbx_core:GetVehiclesByName()
for name, vehicle in pairs(allVehicles) do
    print(name .. ": " .. vehicle.brand .. " " .. vehicle.name)
end

-- Get specific vehicle
local adder = exports.qbx_core:GetVehiclesByName('adder')
if adder then
    print("Adder brand: " .. adder.brand)
end

GetVehiclesByHash

Returns vehicle data by hash or all vehicles.
local vehicles = exports.qbx_core:GetVehiclesByHash(key)
key
number
The vehicle hash to retrieve. If omitted, returns all vehicles
vehicles
table<number, Vehicle> | Vehicle
Either a specific vehicle or all vehicles indexed by hash
Example:
-- Get all vehicles by hash
local vehiclesByHash = exports.qbx_core:GetVehiclesByHash()

-- Get specific vehicle by hash
local vehicle = exports.qbx_core:GetVehiclesByHash(joaat('adder'))

GetVehiclesByCategory

Returns vehicles grouped by category.
local vehiclesByCategory = exports.qbx_core:GetVehiclesByCategory()
vehiclesByCategory
table<string, Vehicle[]>
Vehicles grouped by their category
Example:
local categorized = exports.qbx_core:GetVehiclesByCategory()
for category, vehicles in pairs(categorized) do
    print("Category: " .. category)
    for i, vehicle in ipairs(vehicles) do
        print("  - " .. vehicle.name)
    end
end

Weapon Functions

GetWeapons

Returns weapon data by hash or all weapons.
local weapons = exports.qbx_core:GetWeapons(key)
key
number
The weapon hash to retrieve. If omitted, returns all weapons
weapons
table<number, Weapon> | Weapon
Either a specific weapon or all weapons indexed by hash
Example:
-- Get all weapons
local allWeapons = exports.qbx_core:GetWeapons()
for hash, weapon in pairs(allWeapons) do
    print(weapon.name .. ": " .. weapon.label)
end

-- Get specific weapon
local pistol = exports.qbx_core:GetWeapons(joaat('weapon_pistol'))
if pistol then
    print("Pistol damage: " .. pistol.damage)
end

Location Functions

GetLocations

This function is deprecated.
Returns shared locations.
local locations = exports.qbx_core:GetLocations()
locations
table<string, vector4>
A table of location names and their coordinates

Notification Function

Notify

Displays a notification to the player.
exports.qbx_core:Notify(text, notifyType, duration, subTitle, notifyPosition, notifyStyle, notifyIcon, notifyIconColor)
text
table | string
required
The notification text. Can be a string or table with text and caption fields
notifyType
NotificationType
The notification type for default styling. Defaults to ‘inform’. Options: ‘inform’, ‘error’, ‘success’, ‘warning’
duration
integer
Duration in milliseconds the notification will remain on screen. Defaults to 5000
subTitle
string
Extra text under the title
notifyPosition
NotificationPosition
Position of the notification on screen
notifyStyle
table
Custom styling object. See ox_lib documentation
notifyIcon
string
Font Awesome 6 icon name
notifyIconColor
string
Custom color for the icon
Example:
-- Simple text notification
exports.qbx_core:Notify('Hello World!', 'success')

-- With subtitle
exports.qbx_core:Notify('Money Received', 'success', 5000, 'You earned $500')

-- Table format
exports.qbx_core:Notify({
    text = 'Vehicle Spawned',
    caption = 'Your vehicle is ready'
}, 'inform', 3000)

-- With custom icon
exports.qbx_core:Notify('Police Alert', 'error', 10000, nil, nil, nil, 'shield-halved', '#FF0000')

Build docs developers (and LLMs) love