# Exports & Commands

Everything here is client-side unless it says otherwise. The export namespace is the resource folder name, `koja_hud`.

## Commands

The resource registers one command, and its name comes from `KOJA.SettingsCommand` in `editable/shared/config.lua`:

```lua
KOJA.SettingsCommand = 'settings'
```

`/settings` opens the player's own settings menu. Rename it there if it clashes with something else on your server.

## Notifications

```lua
exports['koja_hud']:sendNotify({
    type  = 'success',
    icon  = 'fa-solid fa-check',
    color = '#B1FEA1',
    title = 'Saved',
    desc  = 'Your vehicle is in the garage.',
    time  = 5000,
})
```

Every field is passed straight through to the interface. Leave one out and the HUD falls back to its own default for it.

## Progress bar

```lua
exports['koja_hud']:startProgressbar({
    label     = 'Repairing…',
    time      = 5,
    animation = { dict = 'mini@repair', name = 'fixing_a_ped' },
    inputBlock = { keys = { 'W', 'A', 'S', 'D', 'SPACE' } },
}, function(finished)
    if finished then
        -- it ran to the end
    end
end)
```

| Field | Meaning |
| --- | --- |
| `time` | Seconds. The animation is played for the same length. |
| `animation` | Optional `dict` and `name`. The dictionary is requested and loaded before the bar starts. |
| `inputBlock.keys` | Key names to disable while the bar runs — `W`, `SPACE`, `LEFTSHIFT` and so on. |

The callback receives whether the bar finished rather than being cancelled.

```lua
exports['koja_hud']:cancelProgressbar()
```

## Text UI

```lua
exports['koja_hud']:TextUI({ ... })
exports['koja_hud']:HideUI()
```

Both are also reachable as server-triggerable events, which is what you want when the decision to show something is made server-side:

```lua
TriggerClientEvent('koja_hud:startTextUI', source, { ... })
TriggerClientEvent('koja_hud:cancelTextUI', source)
```

## Hiding the HUD

```lua
exports['koja_hud']:ToggleHUD(false)  -- during a cutscene
exports['koja_hud']:ToggleHUD(true)
```

## Stress

```lua
local stress = exports['koja_hud']:GetStress()
```

Stress is moved with events rather than exports:

```lua
TriggerEvent('koja-hud:addStress', 5)
TriggerEvent('koja-hud:removeStress', 5)
```

:::warning{title="Two spellings, and they are not interchangeable"}
The stress events use a **hyphen** — `koja-hud:addStress`. The Text UI and nitro events use an **underscore** — `koja_hud:startTextUI`. That is how the resource registers them, so copy the spelling exactly; the wrong one fails silently.
:::

## Seatbelt

```lua
if not exports['koja_hud']:IsSeatbeltOn() then
    -- they are not belted in
end

exports['koja_hud']:SeatbeltState(true)
```

`SeatbeltState` sets the flag the HUD reads. Use it when another resource owns the seatbelt and this one only has to display it.

## Nitro

```lua
exports['koja_hud']:SetNitro()
local nitro = exports['koja_hud']:GetNitro()
```

Persisting it goes the other way — these are **server** events, triggered from the client:

```lua
TriggerServerEvent('koja_hud:setVehicleNitro', GetVehicleNumberPlateText(veh), 100)
TriggerServerEvent('koja_hud:removeNitroItem')
```

`setVehicleNitro` takes the plate and the value and writes it to your vehicles table. `removeNitroItem` takes nothing and removes one `KOJA.Nitro.Item` from whoever triggered it.

Nitro is the one thing the HUD persists — see [Database](/new/hud/database).

## The full list

| Export | Returns |
| --- | --- |
| `sendNotify(data)` | — |
| `startProgressbar(data, cb)` | calls back with whether it finished |
| `cancelProgressbar()` | — |
| `TextUI(data)` | — |
| `HideUI()` | — |
| `ToggleHUD(visible)` | — |
| `GetStress()` | the player's stress |
| `IsSeatbeltOn()` | `true` / `false` |
| `SeatbeltState(state)` | — |
| `SetNitro()` | — |
| `GetNitro()` | the current vehicle's nitro |

## Related pages

- [Installation](/new/hud/installation) — Read the entire installation process to ensure the resource is fully usable.
- [Configuration](/new/hud/configuration) — Changing Language, Debug Prints, Settings Command, Hide Minimap, Notifications, Nitro, Engine, Seatbelt and Cruisemode.
- [Guides](/new/hud/guides) — Creating/Editing Locales, Progress Bar, Text UI and Stress.
- [Features](/new/hud/features)
- [Database](/new/hud/database)
- [HUD](/new/hud) — back to the section overview
