> For the complete documentation index, see [llms.txt](https://docs.otherplanet.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otherplanet.dev/scripts/op-hud-v2/exports/client-side.md).

# Client Side

Client side list of exports / events.

{% hint style="warning" %}
Missing an export? Contact us on our Discord Server.
{% endhint %}

***

#### Notify

Show a HUD toast.

```lua
exports['op-hud']:Notify('Settings saved', 'success', 4000)
exports['op-hud']:Notify('Body text', 'error', 5, 'Failed')

exports['op-hud']:Notify({
    title = 'Dispatch',
    description = 'New call available',
    type = 'info',
    duration = 4,
})
```

* `message` / table: string or `{ title?, description?, message?, type?, duration? }`
* `type`: `success` | `info` | `warning` | `error` (aliases normalised)
* `duration`: seconds if `<= 60`, otherwise ms
* returns: nothing

Event:

```lua
TriggerEvent('oph:client:notify', 'Hello', 'info', 4000)
-- or from server:
TriggerClientEvent('oph:client:notify', source, payload)
```

***

#### Progress / ProgressCancel / IsProgressActive

Blocking progress bar.

```lua
local ok = exports['op-hud']:Progress(5000, 'Searching...')
local ok = exports['op-hud']:Progress(5, 'Lockpicking', true)

local ok = exports['op-hud']:Progress({
    duration = 8,
    label = 'Crafting',
    canCancel = true,
})

exports['op-hud']:ProgressCancel()
local busy = exports['op-hud']:IsProgressActive()
```

* returns (`Progress`): `boolean` - `true` completed, `false` cancelled / already running

Events:

```lua
TriggerClientEvent('oph:client:progress', source, 5000, 'Searching...', false)
TriggerClientEvent('oph:client:progressCancel', source)
```

***

#### GetSettings

Deep copy of the local player's HUD settings table.

```lua
local settings = exports['op-hud']:GetSettings()
```

* returns: `table`

***

#### IsHudEnabled / SetHudEnabled

```lua
local on = exports['op-hud']:IsHudEnabled()
exports['op-hud']:SetHudEnabled(false)
exports['op-hud']:SetHudEnabled(true)
```

* `enabled`: `boolean`
* persists via player settings

***

#### OpenSettings

Opens the HUD settings menu (same as `/hudsettings`).

```lua
exports['op-hud']:OpenSettings()
```

***

#### Seatbelt / Cruise / Indicators

```lua
local belted = exports['op-hud']:IsSeatbeltOn()
exports['op-hud']:ToggleSeatbelt()
exports['op-hud']:ToggleCruise()
exports['op-hud']:ToggleIndicator('left')  -- 'left' | 'right' | 'hazards'
```

{% hint style="info" %}
Built-in seatbelt / cruise / indicators only apply when their integration is `builtin` / enabled in `MainConfig.lua`. If another resource owns seatbelts, set `Config.Integrations.seatbelt` accordingly.
{% endhint %}
