> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/advanced-hud/installation.md).

# Installation

Requirements, start order and commands.

## Requirements

| Resource                                                | Required    | Notes                                                                                            |
| ------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------ |
| ESX or QBCore                                           | No          | Detected automatically on start. Without one of them the HUD runs in standalone mode, see below. |
| esx\_status                                             | ESX only    | Hunger and thirst                                                                                |
| [pma-voice](https://github.com/AvarianKnight/pma-voice) | Recommended | Microphone range indicator. Without it the indicator always shows the middle range.              |

## Install

{% stepper %}
{% step %}

### Download the resource

After purchase, the script is available in your [Cfx.re Portal](https://portal.cfx.re/assets/granted-assets). Log in with the account you used for the purchase.
{% endstep %}

{% step %}

### Add it to your server

Put the `kossek-hud` folder into your `resources` directory.

{% hint style="warning" %}
Keep the folder name `kossek-hud`. Exports and events use it.
{% endhint %}
{% endstep %}

{% step %}

### Remove other HUDs

Stop any other HUD resource (for example `esx_hud`), so two HUDs do not overlap.
{% endstep %}

{% step %}

### Start it after its dependencies

```cfg
ensure es_extended    # or qb-core; leave out for standalone
ensure esx_status     # ESX only
ensure pma-voice

ensure kossek-hud
```

The framework is checked at the moment the HUD starts. If your framework starts later, the HUD runs in standalone mode.
{% endstep %}
{% endstepper %}

## Standalone mode

When neither `es_extended` nor `qb-core` is running, the HUD uses `bridge/standalone/client.lua`. Everything works, but there is no source for hunger and thirst, so both bars stay at 100%.

If another resource tracks hunger and thirst on your server, return its values (0 to 100) from `GetStatus()` in that file:

```lua
function GetStatus()
    return { hunger = 100, thirst = 100 }
end
```

## Stress

The stress bar reads its value from the framework bridge, which returns `0` by default. To connect your stress system, edit `GetStress()` in `bridge/esx/client.lua`, `bridge/qbcore/client.lua` or `bridge/standalone/client.lua` and return a value from 0 to 100:

```lua
function GetStress()
    return LocalPlayer.state.stress or 0
end
```

## Commands and keys

| Command            | Default key | What it does                                                                              |
| ------------------ | ----------- | ----------------------------------------------------------------------------------------- |
| `/hud`             |             | Opens the settings panel. The name is `Config.Settings.commandName`.                      |
| `/togglehud`       |             | Shows or hides the whole HUD.                                                             |
| `/seatbelt`        | K           | Fastens or unfastens the seatbelt.                                                        |
| `/cancel_progress` | X           | Cancels a progress bar that allows it. The name and the key are set in `Config.Progress`. |

Players can rebind the keys in the GTA settings: **Key Bindings → FiveM**.

## For other scripts

The seatbelt state is available on the player's state bag:

```lua
local isBuckled = LocalPlayer.state.seatbelt
```
