Config Client

-- LoadHud() it's to load the player settings otherwise it will load default ones.

if Config.Framework == "ESX" then
    AddEventHandler('esx_status:onTick', function(data)
        local hunger, thirst
        for i = 1, #data do
            if data[i].name == 'thirst' then thirst = math.floor(data[i].percent) end
            if data[i].name == 'hunger' then hunger = math.floor(data[i].percent) end
        end
        SendNUIMessage({
            Action = "Food",
            Hunger = hunger,
            Thirst = thirst
        })
    end)
    AddEventHandler('esx:playerLoaded', function(xPlayer, isNew, skin)
        LoadHud()
    end)
elseif Config.Framework == "QBCORE" then
    RegisterNetEvent('hud:client:UpdateNeeds', function(hunger, thirst)
        SendNUIMessage({
            Action = "Food",
            Hunger = hunger / 100,
            Thirst = thirst / 100
        })
    end)
    RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
        LoadHud()
    end)
elseif Config.Framework == "Other" then
    -- Put here your code

    --SendNUIMessage({
    --    Action = "Food",
    --    Hunger = hunger / 100,
    --    Thirst = thirst / 100
    --})
end

Last updated