# HZ-Bridge

## Overview

**HZ-Bridge** is the shared foundation used by all Hz-Scripts resources. It automatically detects your server environment and provides a unified API so that every Hz-Script works out of the box, regardless of your framework or addon combination.

{% hint style="success" %}
**Free asset** — HZ-Bridge is available for free on the [Hz-Scripts shop](https://hzscripts.com/shop). Download it once and all compatible scripts will use it automatically.
{% endhint %}

***

## What does it do?

Instead of each script including its own framework detection and adapter code, HZ-Bridge handles it **centrally**:

| Module            | What it detects                                                                      |
| ----------------- | ------------------------------------------------------------------------------------ |
| **Framework**     | ESX, QBCore, QBox, Ox Core, vRP, Standalone                                          |
| **Inventory**     | ox\_inventory, qs-inventory, ps-inventory, codem, core, origen, tgiann, framework    |
| **Notifications** | ox\_lib, okokNotify, mythic\_notify, codem, pNotify, framework, GTA native           |
| **Target**        | ox\_target, qb-target, interact, built-in TextUI                                     |
| **Menu / UI**     | ox\_lib (full), qb-menu + qb-input, ESX menu, GTA native fallback                    |
| **Dispatch**      | cd\_dispatch, ps-dispatch, qs-dispatch, rcore\_dispatch, emergencydispatch, built-in |
| **Callbacks**     | Bidirectional (client-server) with rate limiting & timeout                           |
| **Minigames**     | Progress bar, skill check, sequence                                                  |

***

## Key Benefits

* **Install once** — All Hz-Scripts share the same bridge, no duplicate code
* **Auto-detection** — Leave everything on `'auto'` and HZ-Bridge figures out your setup
* **Override when needed** — Force a specific system in one config file
* **60+ exports** — Use the bridge from your own scripts too
* **Zero performance cost** — Detection runs once at startup, exports are instant

***

## Supported Systems

### Frameworks

| Framework  | Resource      | Status |
| ---------- | ------------- | ------ |
| ESX        | `es_extended` | Full   |
| QBCore     | `qb-core`     | Full   |
| QBox       | `qbx_core`    | Full   |
| Ox Core    | `ox_core`     | Full   |
| vRP        | `vRP`         | Full   |
| Standalone | —             | Full   |

### Inventories

| Inventory         | Resource           | Status |
| ----------------- | ------------------ | ------ |
| ox\_inventory     | `ox_inventory`     | Full   |
| qs-inventory      | `qs-inventory`     | Full   |
| ps-inventory      | `ps-inventory`     | Full   |
| codem-inventory   | `codem-inventory`  | Full   |
| core\_inventory   | `core_inventory`   | Full   |
| origen\_inventory | `origen_inventory` | Full   |
| tgiann-inventory  | `tgiann-inventory` | Full   |
| Framework native  | —                  | Basic  |

### Menu Systems

| Menu System | Resource           | Features                                            |
| ----------- | ------------------ | --------------------------------------------------- |
| ox\_lib     | `ox_lib`           | Context, Input, Alert, TextUI, Progress, List menu  |
| qb-menu     | `qb-menu`          | Context, Input (via qb-input), TextUI (via qb-core) |
| ESX menu    | `esx_menu_default` | Context, List menu, TextUI (via esx\_textui)        |
| Native      | —                  | GTA keyboard input, help text, basic fallback       |

***

## Quick Start

1. Download **HZ-Bridge** from the [shop](https://hzscripts.com/shop) (free)
2. Place it in your `resources/` folder
3. Add `ensure HZ-Bridge` to your `server.cfg` **before** any Hz-Script
4. Done — all Hz-Scripts will auto-detect it

See the [Installation](https://hz-script.gitbook.io/hz-script-docs/free-tools/hz-bridge/installation) guide for full details.

***

## For Developers

HZ-Bridge exposes **60+ exports** that you can use from your own scripts:

```lua
-- Framework
local job = exports['HZ-Bridge']:GetPlayerJob()

-- Notifications
exports['HZ-Bridge']:Notify('Hello!', 'success', 3000)

-- Inventory (server)
exports['HZ-Bridge']:AddItem(source, 'bread', 5)

-- Menu (client)
exports['HZ-Bridge']:ContextMenu('my_menu', 'My Menu', {
    { title = 'Option 1', onSelect = function() print('selected') end },
})

-- Callbacks
exports['HZ-Bridge']:RegisterCallback('myResource:getData', function(source)
    return { money = 1000 }
end)
```

See the full [Exports & API](https://hz-script.gitbook.io/hz-script-docs/free-tools/hz-bridge/exports) reference.
