QBCoreserver
QBCore.Functions.GetPlayerByCitizenId
QBCore server documentation with a FiveM Lua example.
Summary
Finds an online player by their unique CitizenID (the stable character identifier in QBCore). Useful when you store a CitizenID and later need the live player.
Returns
table (Player) or nil.
Parameters
citizenidstringThe character's CitizenID.Example
local Player = QBCore.Functions.GetPlayerByCitizenId('ABC12345')
if Player then
-- online
endCommon pitfalls
- Only returns ONLINE players; use a DB query for offline lookups.
- CitizenID is per-character, unlike license which is per-account.
Related functions
Related guides
FiveM scripts done right
Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.
Browse Scripts →