For the complete documentation index, see llms.txt. This page is also available as Markdown.

esx_hud

No changes are required. Simply set Config.ESXStatusOnTick = true in the vms_needs config.lua.

However, for the best performance and immediate status updates, we recommend applying the changes below to your esx_hud.


1. Open the file

Open the following file: esx_hud/client/player/status.lua

2. Remove unnecessary code

Find the esx_status:onTick event and delete the entire block AddEventHandler.

2. Add status change listeners

Register both AddStateBagChangeHandler instances so that they can listen for status changes.

AddStateBagChangeHandler("hunger", ("player:%s"):format(GetPlayerServerId(ESX.playerId)), function(_, _, percentage)
    values.foodBar = percentage
end)

AddStateBagChangeHandler("thirst", ("player:%s"):format(GetPlayerServerId(ESX.playerId)), function(_, _, percentage)
    values.drinkBar = percentage
end)

3. Enter the required code

Find the HUD:StatusThread function and add the highlighted lines inside it.

Last updated