> For the complete documentation index, see [llms.txt](https://kazescripts.gitbook.io/kazescripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kazescripts.gitbook.io/kazescripts/kaze_hud/integrations.md).

# Integrations

Connect any fuel, voice, seatbelt or framework script through bridge.lua and editable.lua.

kaze\_hud reads the game through two open files:

| File           | What it holds                                                                |
| -------------- | ---------------------------------------------------------------------------- |
| `bridge.lua`   | Framework code: player data, money, job, needs and death                     |
| `editable.lua` | Everything else: fuel, voice, seatbelt, NOS, postal, weapons and dirty money |

Edit them to connect a script that is not supported out of the box.

## editable.lua functions

| Function                      | Returns                                   | Default source                                                       |
| ----------------------------- | ----------------------------------------- | -------------------------------------------------------------------- |
| `Bridge.GetFuel(veh)`         | Fuel, 0 to 100                            | `fuel` state bag, then LegacyFuel, cdn-fuel, lc\_fuel, then GTA fuel |
| `Bridge.GetEngine(veh)`       | Engine health, 0 to 100                   | GTA engine health                                                    |
| `Bridge.IsLocked(veh)`        | `true` or `false`                         | GTA door lock status                                                 |
| `Bridge.GetNitro(veh)`        | NOS 0 to 100, or `nil`                    | `nitro`, `nos` or `nitrous` state bag                                |
| `Bridge.HasSeatbelt()`        | `true` or `false`                         | `seatbelt` or `harness` state bag                                    |
| `Bridge.HasCruise()`          | `true` or `false`                         | `seatbelt:client:ToggleCruise` event                                 |
| `Bridge.GetVoice()`           | `{ talking, range, radio, radioTalking }` | pma-voice state bags                                                 |
| `Bridge.GetPostal(coords)`    | Postal text, or `nil`                     | nearest-postal, npostal, postals                                     |
| `Bridge.DescribeWeapon(hash)` | Name, label                               | ox\_inventory, QBCore weapons, ESX, `Config.ExtraWeapons`            |
| `Bridge.GetDirtyMoney()`      | Amount                                    | ox\_inventory item, ESX `black_money`, QBCore items                  |

## Examples

{% tabs %}
{% tab title="Custom fuel" %}

```lua
function Bridge.GetFuel(veh)
    return exports['my-fuel']:GetFuel(veh)
end
```

{% endtab %}

{% tab title="SaltyChat" %}

```lua
function Bridge.GetVoice()
    local range = LocalPlayer.state['SaltyChat_VoiceRange'] or 8.0
    return {
        talking = NetworkIsPlayerTalking(PlayerId()),
        range = range <= 3.0 and 1 or range <= 8.0 and 2 or 3,
        radio = 0,
        radioTalking = false,
    }
end
```

{% endtab %}

{% tab title="Custom seatbelt" %}

```lua
function Bridge.HasSeatbelt()
    return exports['my-seatbelt']:IsBuckled()
end
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Keep the function names and return values the same. The HUD calls them many times a second, so never do slow work like database calls inside them.
{% endhint %}
