> For the complete documentation index, see [llms.txt](https://docs.vames-store.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vames-store.com/assets/vms_needs/compatibility/hud/esx_hud.md).

# esx\_hud

{% hint style="info" %}
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`.
{% endhint %}

***

#### 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.

```lua
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.

<pre class="language-lua"><code class="lang-lua">function HUD:StatusThread()
    values = {}
    CreateThread(function()
        while ESX.PlayerLoaded do
            local oxygen, stamina = 0, 0

            stamina = math.floor(100 - GetPlayerSprintStaminaRemaining(ESX.playerId))
            if stamina == 0 then
                stamina = 1
            end
            if stamina == 100 then
                stamina = 0
            end

            if IsPedSwimmingUnderWater(ESX.PlayerData.ped) then
                oxygen = math.floor(GetPlayerUnderwaterTimeRemaining(ESX.playerId) * 10)
            end
                
<strong>            values.healthBar = math.floor((GetEntityHealth(ESX.PlayerData.ped) - 100) / 100 * 100)
</strong><strong>
</strong><strong>            values.armorBar = GetPedArmour(ESX.PlayerData.ped)
</strong>
            values.oxygenBar = oxygen or 0
            values.staminaBar = stamina
            SendNUIMessage({ type = "STATUS_HUD", value = values })
            Wait(250)
        end
    end)
end
</code></pre>
