Skip to Content
ResourcesQb Coreqb-core Events & Functions Reference | QBCore 2026

qb-core Events & Functions Reference

The QBCore event system is the backbone of all resource communication. Server events handle player lifecycle, money changes, and data persistence. Client events manage UI updates and local player state. Functions provide a unified API for inventory, vehicle, and character operations.

Server Events

Event NameParametersDescription
QBCore:Server:OnPlayerLoadedPlayer (object)Fires after a player fully loads into the server
QBCore:Server:OnPlayerUnloadsrc (number)Fires when a player disconnects
QBCore:Server:OnMoneyChangesrc, type, amount, action, reasonFires when a player’s money changes
QBCore:Server:UpdatePlayersrcRequests a player data sync to client

QBCore:Server:OnPlayerLoaded

Triggered when a player finishes loading. Use this to set up player-specific logic, give starter items, or restore saved states.

RegisterNetEvent('QBCore:Server:OnPlayerLoaded', function(Player) local src = Player.PlayerData.source local citizenid = Player.PlayerData.citizenid local charname = Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname print('^2[QB-Core] ^7Player loaded: ' .. charname .. ' (' .. citizenid .. ')') -- Give starter items on first join if Player.PlayerData.metadata.ineditor then return end end)

QBCore:Server:OnMoneyChange

Fires every time money is added or removed. Ideal for transaction logging, anti-cheat, or HUD updates.

RegisterNetEvent('QBCore:Server:OnMoneyChange', function(src, moneyType, amount, action, reason) local Player = QBCore.Functions.GetPlayer(src) if not Player then return end if amount > 100000 and action == 'add' then print('^3[QB-Core] ^7Large transaction: ' .. Player.PlayerData.charinfo.firstname .. ' $' .. amount .. ' (' .. reason .. ')') end end)

QBCore:Server:OnPlayerUnload

Fires when a player disconnects or the server unloads them. Use this to save state, clean up callbacks, or release resources.

RegisterNetEvent('QBCore:Server:OnPlayerUnload', function(src) print('^1[QB-Core] ^7Player ' .. src .. ' disconnected') end)

Client Events

Event NameParametersDescription
QBCore:Client:OnPlayerLoaded(none)Fires when the client receives PlayerData from the server
QBCore:Client:OnPlayerUnload(none)Fires when the client is unloading
QBCore:Client:OnJobUpdateJobInfo (table)Fires when the player’s job changes
QBCore:Client:OnGangUpdateGangInfo (table)Fires when the player’s gang changes
QBCore:Client:Notifytext, type, lengthDisplays a notification on the client
QBCore:Client:VehicleInfovehicle (entity), plate, etc.Receives vehicle info lookup from server

QBCore:Client:OnPlayerLoaded

The client-side counterpart. Run local UI setup, HUD initialization, or keybind registrations here.

RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() local PlayerData = QBCore.Functions.GetPlayerData() LocalPlayer.state:set('isLoggedIn', true, true) print('^2[QB-Core] ^7Client loaded. CitizenID: ' .. PlayerData.citizenid) end)

QBCore:Client:OnJobUpdate

Use this to react to job changes β€” update uniforms, toggle duty blips, or refresh job-specific UI.

RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) PlayerData.job = JobInfo if JobInfo.name == 'police' and JobInfo.onduty then TriggerEvent('police:client:SetDutyBlips') end end)

Server Functions

FunctionReturnsDescription
QBCore.Functions.GetPlayer(source)Player object or nilGets the Player object by server ID
QBCore.Functions.GetPlayerByCitizenId(citizenid)Player object or nilGets the Player object by citizen ID
QBCore.Functions.GetPlayers()Table of Player objectsReturns all online players
QBCore.Functions.GetQBPlayers()Table of Player objectsAlternative: returns all online players
QBCore.Functions.GetPlayersOnDuty(job)Table of Player objectsGets players with a specific job who are on duty
QBCore.Functions.AddPermission(src, perm)trueGrants a permission to a player
QBCore.Functions.RemovePermission(src, perm)trueRemoves a permission from a player

QBCore.Functions.GetPlayer

local Player = QBCore.Functions.GetPlayer(source) if Player then print(Player.PlayerData.charinfo.firstname) print('Cash: $' .. Player.PlayerData.money.cash) print('Bank: $' .. Player.PlayerData.money.bank) end

QBCore.Functions.GetPlayersOnDuty

local cops = QBCore.Functions.GetPlayersOnDuty('police') print(#cops .. ' police officers on duty') for _, cop in pairs(cops) do TriggerClientEvent('police:client:Notify', cop.PlayerData.source, 'Robbery in progress!') end

Client Functions

FunctionReturnsDescription
QBCore.Functions.GetPlayerData()Player data tableReturns the local player’s full data
QBCore.Functions.Notify(text, type, length)(none)Shows a client-side notification
QBCore.Functions.TriggerCallback(name, cb, ...)Callback resultMakes a callback request to the server
QBCore.Functions.HasItem(item, amount)booleanChecks if the player has items
QBCore.Functions.SpawnVehicle(model, cb, coords, heading)Vehicle entitySpawns a vehicle client-side

QBCore.Functions.Notify

QBCore.Functions.Notify('You received $500', 'success', 5000) QBCore.Functions.Notify('Inventory full', 'error', 3000) -- Types: 'success', 'error', 'primary', 'warning'

QBCore.Functions.HasItem

if QBCore.Functions.HasItem('lockpick') then print('Player has a lockpick') else QBCore.Functions.Notify('You need a lockpick', 'error') end

Shared Functions

FunctionReturnsDescription
QBCore.Shared.SplitStr(str, delimiter)TableSplits a string into a table
QBCore.Shared.Round(value, decimals)numberRounds a number to N decimals
QBCore.Shared.GroupDigits(value)stringFormats a number (e.g., 1000000 β†’ β€œ1,000,000”)

Vehicle Utilities

QBCore.Functions.GetPlate

Retrieves the license plate of a vehicle entity.

-- Server-side local veh = GetVehiclePedIsIn(GetPlayerPed(src), false) if veh ~= 0 then local plate = QBCore.Functions.GetPlate(veh) print('Vehicle plate: ' .. plate) end

QBCore.Functions.SpawnVehicle

-- Client-side QBCore.Functions.SpawnVehicle('adder', function(vehicle) SetVehicleNumberPlateText(vehicle, 'CUSTOM') TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1) end, vec3(200, 200, 25), 90.0)

For the full API reference, see Server Events, Client Events, and Functions in the API section.

Last updated on