local playerLoaded = false Citizen.CreateThread(function() if Config.Framework == 'QBCore' then local status, QB = pcall(function() return exports['qb-core']:GetCoreObject() end) while QB.Functions.GetPlayerData().job == nil do Citizen.Wait(100) end QB.playerData = QB.Functions.GetPlayerData() playerLoaded = true RegisterNetEvent('QBCore:Player:SetPlayerData', function(val) QB.playerData = val SendNUIMessage({ action = 'setJob', data = { label = QB.playerData.job.label, gLabel = QB.playerData.job.grade.name } }) SendNUIMessage({ action = 'setMoney', data = { type = 'bank', money = QB.playerData.money.bank } }) SendNUIMessage({ action = 'setMoney', data = { type = 'money', money = QB.playerData.money.cash } }) end) function GetJob() return { label = QB.playerData.job.label, gLabel = QB.playerData.job.grade.name } end if GetResourceState('hex_food') == 'started' then RegisterNetEvent('hex_food:onTick', function(food, thirst) SendNUIMessage({ action = 'refreshFood', data = { food = food, thirst = thirst } }) end) else RegisterNetEvent('hud:client:UpdateNeeds', function(food, thirst) SendNUIMessage({ action = 'refreshFood', data = { food = math.floor(food), thirst = math.floor(thirst) } }) end) end function GetFood() if GetResourceState('hex_food') == 'started' then return exports['hex_food']:GetFood() else return math.floor(QB.playerData.metadata['hunger']) end end function GetThirst() if GetResourceState('hex_food') == 'started' then return exports['hex_food']:GetThirst() else return math.floor(QB.playerData.metadata['thirst']) end end function GetWeaponFromHash(weapon) for k, v in pairs(QB.Shared.Weapons) do if k == weapon then return v end end end function GetWeaponLabel(weaponName) for k, v in pairs(QB.Shared.Weapons) do if v.name == weaponName then return v.label end end return 'unknown' end function GetMoney(account) if account == 'money' then return QB.playerData.money.cash elseif account == 'bank' then return QB.playerData.money.bank else return 0 end end function IsPlayerLoaded() return playerLoaded end end end)