Server Function Reference
Learn about and how to use common core server functions!
Player Getters
QBCore.Functions.GetIdentifier
Get a specific identifier of a player
source:
number
identifier:
string
(optional)return:
string
QBCore.Functions.GetSource
Get a players source by identifier
identifier:
string
return:
number
QBCore.Functions.GetPlayer
Get a player by their source and access their data
source:
number
|string
return:
table
QBCore.Functions.GetPlayerByCitizenId
Get a player by their citizen id and access their data (must be online)
citizenid:
string
return:
table
QBCore.Functions.GetPlayerByPhone
Get a player by their phone number (must be online)
number:
number
return:
table
QBCore.Functions.GetPlayerByAccount
Get a player by their account number (must be online)
account:
string
return:
table
QBCore.Functions.GetPlayerByCharInfo
Get a player by their character info (must be online)
property:
string
value:
any
return:
table
QBCore.Functions.GetPlayers
Get all player IDs in the server (deprecated method)
return:
table
QBCore.Functions.GetQBPlayers
Access the table of all active players on the server (preferred to above)
return:
table
QBCore.Functions.GetPlayersOnDuty
Get a table of player id's that are on duty for a specific job and the amount
job:
string
return:
table
,number
QBCore.Functions.GetDutyCount
Get the amount of players on duty for a specific job
job:
string
return:
number
World Getters
QBCore.Functions.GetCoords
Get the coordinates of a passed entity
entity:
number
return:
vector4
QBCore.Functions.GetClosestObject
Get's the closest object to a player in the world and the distance to it
source:
string
coords:
vector3
(optional)return:
number
|number
QBCore.Functions.GetClosestVehicle
Get's the closest vehicle to a player in the world and the distance to it
source:
string
coords:
vector3
(optional)return:
number
|number
QBCore.Functions.GetClosestPed
Get's the closest ped to a player in the world and the distance to it
source:
string
coords:
vector3
(optional)return:
number
|number
Vehicle Creation
QBCore.Functions.SpawnVehicle
Spawns a vehicle near a player using the standard client-assisted CreateVehicle
RPC. The client must be near the spawn location for the vehicle to appear
source:
string
model:
string
|number
coords:
vector3
(optional)warp:
boolean
(optional)return:
number
QBCore.Functions.CreateAutomobile
Spawns a vehicle using the experimental CREATE_AUTOMOBILE
native, which does not rely on the client for creation. This is more efficient but does not work for all vehicle types
source:
string
model:
string
|number
coords:
vector3
(optional)warp:
boolean
(optional)return:
number
QBCore.Functions.CreateVehicle
Uses the newer CreateVehicleServerSetter
native to spawn vehicles on the server. More reliable and supports all major vehicle types
source:
string
model:
string
|number
vehType:
string
coords:
vector3
(optional)warp:
boolean
(optional)return:
number
Routing Buckets
QBCore.Functions.GetBucketObjects
Returns the internal bucket state tables used by the framework
return:
table
,table
QBCore.Functions.GetPlayersInBucket
Returns a list of player IDs assigned to a given bucket
bucket:
number
return:
table
|boolean
QBCore.Functions.GetEntitiesInBucket
Returns a list of entity IDs (excluding players) assigned to a given bucket
bucket:
number
return:
table
|boolean
QBCore.Functions.SetEntityBucket
Assigns an entity (e.g., ped, vehicle, or prop) to the specified routing bucket
entity:
number
bucket:
number
return:
boolean
QBCore.Functions.SetPlayerBucket
Assigns a player to the specified routing bucket
source:
string
bucket:
number
return:
boolean
Items
QBCore.Functions.CreateUseableItem
Registers an item as "usable" and binds it to a callback function
item:
string
data:
function
|table
QBCore.Functions.CanUseItem
Checks if a given item has been registered as usable
item:
string
return:
table
|nil
QBCore.Functions.UseItem
Trigger an item to be used on the player
source:
string
item:
string
QBCore.Functions.HasItem
Checks if a player has a specific item(s)
source:
string
items:
string
|table
amount:
number
(optional)return:
boolean
Permissions
QBCore.Functions.AddPermission
Give a player a specific permission level (per session only)
source:
string
permission:
string
QBCore.Functions.RemovePermission
Remove a specific permission level or all of the players permissions (per session only)
source:
string
permission:
string
(optional)
QBCore.Functions.HasPermission
Check if a player has a specific permission level(s)
source:
string
permission:
string
|table
QBCore.Functions.GetPermission
Get a player's permission level(s)
source:
string
return:
table
QBCore.Functions.IsOptIn
Checks whether a player has opted in to receive reports
source:
string
return:
boolean
QBCore.Functions.ToggleOptIn
Toggle a players status to receive reports
source:
string
Callbacks
QBCore.Functions.TriggerClientCallback
Triggers a client-side callback function from the server. Supports both asynchronous usage via a promise and direct function-based response handling
name:
string
source:
string
cb:
function
(optional)...
:any
QBCore.Functions.CreateCallback
Registers a new server-side callback that can be triggered from the client
name:
string
cb:
function
Miscellaneous
QBCore.Functions.Notify
Triggers a notification on a specfic player
source:
string
text:
string
type:
string
(optional)length:
number
(optional)
QBCore.Debug
Prints a formatted, color-coded debug output of a table or value
table:
table
|any
indent:
number
(optional)resource:
string
QBCore.ShowError
Prints a red-colored error log to the console
resource:
string
message:
string
QBCore.ShowSuccess
Prints a green-colored success/log message to the console
resource:
string
message:
string
QBCore.Functions.Kick
Kick a player from the server
playerId:
string
reason:
string
setKickReason:
function
(optional)deferrals:
table
(optional)
Last updated
Was this helpful?