Player Metadata

Player metadata and how to use it

Complete Player Metadata List:

-- Metadata Name, example value, --type/explaination
-- (Tables to be added soon)

injail              0       -- 0 = Not in jail, 1 = In Jail
tracker             false   -- Bool
inside              -- Table
    name: value
dealerrep           23      -- Int
bloodtype	    O+
drugxp	            23      -- Int
criminalrecord	    -- Table
    name: value    
phone	table
    name: value
jobrep	table
    name: value
ishandcuffed	    false   -- Bool
craftingrep	    0       -- Int
fitbit	            -- Table
    name: value
inlaststand	    false
status	            -- Table
    name: value
farmingxp	    13      -- Int
fingerprint	    If13... -- String
communityservice    0
licences	    -- Table
    name: value
isdead	            false   -- Bool
callsign	    NO CALLSIGN 
commandbinds	    -- Table
    name: value
walletid	    QB-4... -- String
phonedata	    -- Table
    name: value
armor	            10      -- Int
hunger	            53.0    -- Int
stress	            0       -- Int
thirst	            58.0    -- Int
jailitems	    -- Table
    name: value
attachmentcraftingrep       -- Int

How to use: This will return the current player metadata state for a name from above.

-- !!Metadata must be retrived from a client script!!

QBCore = exports['qb-core']:GetCoreObject()

-- If it has a type

QBCore.Functions.GetPlayerData().metadata.{meta_name} -- Returns meta's value (if the meta has a table it will return something like 0x23423

-- OR if its a table

QBCore.Functions.GetPlayerData().metadata.{meta_name}.{table_key} -- Returns the value associated with a key from the meta's table. 

Example:

-- !!Metadata must be retrived from a client script!!

QBCore = exports['qb-core']:GetCoreObject()
local playerData = QBCore.Functions.GetPlayerData()
local playerMeta = playerData.metadata


if playerMeta["isdead"] then
 -- Execute Code

Last updated