# antho_hud
Multi-framework FiveM HUD — works with **ESX**, **QBCore** and **QBox** (automatic detection, no configuration needed). Also works standalone (without hunger/thirst).
## Features
- **Status bars** (bottom right): health, armor, hunger, thirst, stamina, oxygen — bars turn red and blink below the critical threshold
- **Voice** (bottom right): talking indicator + range (whisper/normal/shout via pma-voice)
- **Vehicle dashboard** (bottom center): speed (dial), gear, RPM, fuel — only shown while in a vehicle
## Installation
1. Copy the `antho_hud` folder into `resources/`
2. Add `ensure antho_hud` to `server.cfg` (after the framework)
3. Disable any other HUD (e.g. `qb-hud`) to avoid duplicates
## Configuration
Everything lives in [config.lua](config.lua):
| Option | Default | Description |
|---|---|---|
| `UseMPH` | `false` | `true` = MPH, `false` = KM/H |
| `MaxSpeed` | `240` | Maximum speed shown on the dial |
| `StatusInterval` | `200` | Status refresh rate (ms) |
| `VoiceInterval` | `150` | Talking-state polling rate (ms) |
| `LowThreshold` | `25` | Critical threshold (%) |
| `HideDefaultHud` | `true` | Hides the GTA elements this HUD replaces |
| `ShowMinimap` | `true` | `false` disables the native GTA minimap |
| `ToggleCommand` | `'hud'` | Command to show/hide the HUD |
| `TestCommand` | `'testhud'` | Command to start/stop test mode |
| `PushToTalkControl` | `249` | PTT key used as a fallback for voice detection |
## Commands
- `/hud`: shows/hides the HUD
- `/testhud`: cycles test values across every bar (status, vehicle, voice) in a loop, so you can check the rendering without hurting yourself, diving underwater or getting in a car. Run the command again to return to real values.
## Compatibility
- **Hunger/thirst**: `esx_status` (ESX) or the `hud:client:UpdateNeeds` event (QBCore/QBox)
- **Voice**: pma-voice (ranges), mumble-voip and native voice (talking detection)
- **Fuel**: reads `GetVehicleFuelLevel`, compatible with LegacyFuel, ox_fuel, cdn-fuel, etc.
## Export
```lua
-- Hide/show the HUD from another resource (cutscenes, photo mode…)
exports.antho_hud:SetHudVisible(false)
```
## Out-of-game preview
Open `web/index.html` in a browser: a demo mode animates the HUD with fake values.
## Performance
No thread runs every frame:
- Hiding the native HUD uses `SetHudComponentPosition` (moved off-screen, **persistent**) instead of `HideHudComponentThisFrame` in a loop, and `DisplayRadar(false)` is persistent too — applied once at startup and on respawn, restored when the resource stops.
- The status (200 ms), voice (150 ms) and vehicle (100 ms in a vehicle / 500 ms on foot) loops sleep at 1000 ms and stop doing any work as soon as the HUD is hidden (pause menu, `/hud`, framework not loaded).
- Nothing is sent over the NUI bridge (JSON encoding = the real cost) unless a value changed, and the comparison is done field by field without allocating a table.
- The `/testhud` thread only exists while the test is running.
Expected `resmon` result: **0.00 ms** both idle and active.