> 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/exports.md).

# Exports

Notifications, the progress bar and HUD visibility from other scripts.

All exports are client-side. The resource name is `kossek-hud`.

## Show and hide the HUD

```lua
exports['kossek-hud']:showHUD()
exports['kossek-hud']:hideHUD()
```

{% hint style="warning" %}
Export names are case-sensitive: `showHUD` and `hideHUD`, not `showHud`.
{% endhint %}

## Change visibility

Shows or hides one element.

```lua
exports['kossek-hud']:changeVisibility(element, visible)
```

| Parameter | Type    | Description                            |
| --------- | ------- | -------------------------------------- |
| `element` | string  | One of the names from the table below. |
| `visible` | boolean | `true` to show, `false` to hide.       |

| Element          | What it is                           |
| ---------------- | ------------------------------------ |
| `'global'`       | The whole HUD                        |
| `'settings'`     | The settings panel                   |
| `'statusBar'`    | The status bars                      |
| `'progress'`     | The progress bar                     |
| `'speedometer'`  | The speedometer and the street label |
| `'logo'`         | The server logo                      |
| `'cinematicCam'` | The cinematic bars                   |

The names are case-sensitive. A name that is not on the list is ignored.

```lua
exports['kossek-hud']:changeVisibility('speedometer', false)
```

## Notification

```lua
exports['kossek-hud']:notify(data)
```

| Field         | Type             | Description                                      |
| ------------- | ---------------- | ------------------------------------------------ |
| `description` | string           | The message.                                     |
| `title`       | string, optional | Defaults to `Config.Notifications.defaultTitle`. |
| `icon`        | string, optional | Defaults to `Config.Notifications.defaultIcon`.  |

A plain string works too and becomes the description.

```lua
exports['kossek-hud']:notify({
    title = 'Garage',
    description = 'Vehicle stored',
    icon = 'car'
})

exports['kossek-hud']:notify('Vehicle stored')
```

From the server, use the event:

```lua
TriggerClientEvent('kossek-hud:notify', source, {
    title = 'Garage',
    description = 'Vehicle stored'
})
```

## Progress bar

Starts a progress bar and waits for it. Returns `true` when it completed and `false` when it was cancelled or interrupted.

```lua
local completed = exports['kossek-hud']:progress(data)
```

| Field          | Type              | Description                                   |
| -------------- | ----------------- | --------------------------------------------- |
| `duration`     | number            | Length in milliseconds.                       |
| `label`        | string            | Text on the bar.                              |
| `canCancel`    | boolean, optional | The player can cancel it with the cancel key. |
| `useWhileDead` | boolean, optional | Allowed while dead.                           |
| `allowRagdoll` | boolean, optional | Not interrupted by ragdoll.                   |
| `allowCuffed`  | boolean, optional | Not interrupted by being cuffed.              |
| `allowFalling` | boolean, optional | Not interrupted by falling.                   |
| `anim`         | table, optional   | Animation or scenario, see below.             |
| `prop`         | table, optional   | One prop or a list of props, see below.       |
| `disable`      | table, optional   | Controls to disable, see below.               |

**anim**

| Field                     | Type              | Description                              |
| ------------------------- | ----------------- | ---------------------------------------- |
| `dict`                    | string, optional  | Animation dictionary.                    |
| `clip`                    | string            | Animation name.                          |
| `flag`                    | number, optional  | Default `49`.                            |
| `blendIn`                 | number, optional  | Default `3.0`.                           |
| `blendOut`                | number, optional  | Default `1.0`.                           |
| `duration`                | number, optional  | Default `-1`.                            |
| `playbackRate`            | number, optional  | Default `0`.                             |
| `lockX`, `lockY`, `lockZ` | boolean, optional | Lock the axes.                           |
| `scenario`                | string, optional  | A scenario instead of `dict` and `clip`. |
| `playEnter`               | boolean, optional | Play the scenario's enter animation.     |

**prop**

| Field   | Type             | Description                |
| ------- | ---------------- | -------------------------- |
| `model` | hash             | Prop model.                |
| `bone`  | number, optional | Ped bone. Default `60309`. |
| `pos`   | table            | `{ x, y, z }` offset.      |
| `rot`   | table            | `{ x, y, z }` rotation.    |

**disable**

| Field    | Type    | Disables                         |
| -------- | ------- | -------------------------------- |
| `move`   | boolean | Walking, sprinting and ducking.  |
| `sprint` | boolean | Sprinting only.                  |
| `car`    | boolean | Driving and leaving the vehicle. |
| `combat` | boolean | Aiming and shooting.             |
| `mouse`  | boolean | Looking around.                  |

```lua
local completed = exports['kossek-hud']:progress({
    duration = 5000,
    label = 'Repairing vehicle',
    canCancel = true,
    disable = { move = true, car = true, combat = true },
    anim = {
        dict = 'mini@repair',
        clip = 'fixing_a_ped'
    },
    prop = {
        model = `prop_tool_wrench`,
        pos = { x = 0.1, y = 0.0, z = 0.0 },
        rot = { x = 0.0, y = 0.0, z = 0.0 }
    }
})

if completed then
    -- finished
end
```

From the server, start one for a player with the event (no return value):

```lua
TriggerClientEvent('kossek-hud:startProgress', source, { duration = 5000, label = 'Searching' })
```

### Check if a progress bar is active

```lua
local isActive = exports['kossek-hud']:progressActive()
```

Returns `true` while a progress bar is running and `false` otherwise.

```lua
-- Do not open a menu during a progress bar
if exports['kossek-hud']:progressActive() then return end
```
