HZ Scripts

Exports & API

HZ-Bridge exposes 60+ exports usable from any resource. All exports are available via exports['HZ-Bridge'].


Meta / Detection

{% tabs %}
{% tab title="Client & Server" %}

-- Get the full Bridge table (advanced usage)
local Bridge = exports['HZ-Bridge']:GetBridge()

-- Get detected system names
local framework = exports['HZ-Bridge']:GetDetectedFramework() -- 'esx', 'qbcore', 'qbox', etc.
local inventory = exports['HZ-Bridge']:GetDetectedInventory() -- 'ox_inventory', etc.
local notify = exports['HZ-Bridge']:GetDetectedNotifications() -- 'ox_lib', etc.
local dispatch = exports['HZ-Bridge']:GetDetectedDispatch() -- 'cd_dispatch', etc.
local target = exports['HZ-Bridge']:GetDetectedTarget() -- 'ox_target', etc.
local menu = exports['HZ-Bridge']:GetDetectedMenu() -- 'ox_lib', 'qb-menu', etc.


{% endtab %}
{% endtabs %}


Framework

Client

-- Get current player job
local job = exports['HZ-Bridge']:GetPlayerJob()

-- Get full player data
local data = exports['HZ-Bridge']:GetPlayerData()

Server

-- Get player info
local job    = exports['HZ-Bridge']:GetPlayerJob(source)
local data   = exports['HZ-Bridge']:GetPlayerData(source)
local charId = exports['HZ-Bridge']:GetPlayerCharId(source)
local name   = exports['HZ-Bridge']:GetPlayerName(source)

-- Money
local canPay = exports['HZ-Bridge']:CanAfford(source, 500)
exports['HZ-Bridge']:AddMoney(source, 500, 'bank')
exports['HZ-Bridge']:RemoveMoney(source, 500, 'cash')

-- Job queries
local cops = exports['HZ-Bridge']:GetPlayersWithJob({'police', 'sheriff'}, 0)

-- Usable items
exports['HZ-Bridge']:RegisterUsableItem('phone', function(source)
-- player used the item
end)


Inventory (Server)

-- Check items
local count   = exports['HZ-Bridge']:GetItemCount(source, 'bread')
local itemData = exports['HZ-Bridge']:GetItemData(source, 'bread')
local has     = exports['HZ-Bridge']:HasItem(source, 'bread', 1)
local canFit  = exports['HZ-Bridge']:CanCarry(source, 'bread', 5)

-- Add / Remove
exports['HZ-Bridge']:AddItem(source, 'bread', 5)
exports['HZ-Bridge']:RemoveItem(source, 'bread', 1)
exports['HZ-Bridge']:AddItemToFit(source, 'bread', 5) -- Only add if can carry

-- Stash
exports['HZ-Bridge']:OpenStash(source, 'my_stash', 'My Stash', 50, 100000)
local content = exports['HZ-Bridge']:GetStashContent('my_stash')


Notifications

Client

exports['HZ-Bridge']:Notify('Item added!', 'success', 3000)

Server

-- Notify one player
exports['HZ-Bridge']:NotifyPlayer(source, 'Welcome!', 'info', 5000)

-- Notify all players
exports['HZ-Bridge']:NotifyAll('Server restart in 5 minutes', 'warning', 10000)

Types: 'info', 'success', 'warning', 'error'

Dispatch (Client)

exports['HZ-Bridge']:SendDispatch({
    title = 'Robbery in progress',
    message = '10-90 at Fleeca Bank',
    coords = GetEntityCoords(PlayerPedId()),
    jobs = {'police'},
    blip = { sprite = 161, color = 1, scale = 1.0 },
})

Target (Client)

-- Add target to entity
exports['HZ-Bridge']:AddTargetEntity(entity, {
    { label = 'Open', icon = 'fas fa-door-open', action = function(e) end },
})

-- Add target to zone
exports['HZ-Bridge']:AddTargetZone('my_zone', {
coords = vector3(0, 0, 0),
radius = 2.0,
options = { { label = 'Interact', action = function() end } },
})

-- Add target to model
exports['HZ-Bridge']:AddTargetModel('prop_vendmach_01', {
{ label = 'Buy drink', icon = 'fas fa-coffee', action = function() end },
})

-- Remove
exports['HZ-Bridge']:RemoveTarget('my_zone')


Context Menu

-- Quick: register + show in one call
exports['HZ-Bridge']:ContextMenu('my_menu', 'My Menu', {
    {
        title = 'Option 1',
        description = 'Description here',
        icon = 'fas fa-star',
        onSelect = function(args) print('selected!') end,
    },
    {
        title = 'Sub Menu',
        menu = 'my_submenu',  -- Opens another registered context
    },
})

-- Or register and show separately
exports['HZ-Bridge']:RegisterContext({
id = 'my_menu',
title = 'My Menu',
options = { --[[ ... ]] },
})
exports['HZ-Bridge']:ShowContext('my_menu')

-- Hide / Query
exports['HZ-Bridge']:HideContext()
local openId = exports['HZ-Bridge']:GetOpenContext()

Input Dialog

local result = exports['HZ-Bridge']:InputDialog('Enter Details', {
    { type = 'input', label = 'Name', placeholder = 'John Doe', required = true },
    { type = 'number', label = 'Amount', default = 100 },
    { type = 'select', label = 'Type', options = {
        { value = 'a', label = 'Option A' },
        { value = 'b', label = 'Option B' },
    }},
})

if result then
local name, amount, type = result[1], result[2], result[3]
end

Alert Dialog

local response = exports['HZ-Bridge']:AlertDialog({
    header = 'Confirm Action',
    content = 'Are you sure you want to proceed?',
    centered = true,
    cancel = true,
})

if response == 'confirm' then
-- User confirmed
end

TextUI

exports['HZ-Bridge']:ShowTextUI('[E] Interact', {
    position = 'right-center',
    icon = 'fas fa-hand-pointer',
})

exports['HZ-Bridge']:HideTextUI()

local isOpen = exports['HZ-Bridge']:IsTextUIOpen()

Progress Bar

local completed = exports['HZ-Bridge']:ProgressBar({
    duration = 5000,
    label = 'Crafting...',
    canCancel = true,
    disable = { move = true, combat = true },
    anim = { dict = 'mini@repair', clip = 'fixing_a_player' },
})

if completed then
-- Finished
else
-- Cancelled
end

-- Circle variant
local done = exports['HZ-Bridge']:ProgressCircle({ duration = 3000, label = 'Loading...' })

-- Query / Cancel
local active = exports['HZ-Bridge']:IsProgressActive()
exports['HZ-Bridge']:CancelProgress()

List Menu

exports['HZ-Bridge']:RegisterMenu({
    id = 'my_list',
    title = 'Select Item',
    options = {
        { label = 'Item 1', description = 'First item' },
        { label = 'Item 2', description = 'Second item' },
    },
}, function(selected, scrollIndex, args)
    print('Selected index:', selected)
end)

exports['HZ-Bridge']:ShowMenu('my_list')
exports['HZ-Bridge']:HideMenu()

Close All

exports['HZ-Bridge']:CloseAllMenus()  -- Close any open menu/context/input/alert/progress

Callbacks

Server

-- Register a server callback
exports['HZ-Bridge']:RegisterCallback('myResource:getData', function(source, arg1, arg2)
    return { money = 1000, name = 'John' }
end)

-- Call a client callback from server
local result = exports['HZ-Bridge']:TriggerClientCallback(source, 'myResource:clientCheck')

Client

-- Call a server callback (blocking)
local data = exports['HZ-Bridge']:TriggerCallback('myResource:getData', arg1, arg2)
print(data.money)  -- 1000

-- Register a client callback
exports['HZ-Bridge']:RegisterClientCallback('myResource:clientCheck', function()
return GetEntityCoords(PlayerPedId())
end)


Minigames (Client)

-- Progress with coordinates
local success = exports['HZ-Bridge']:MinigameProgress(coords, 5000, {
    label = 'Searching...',
})

-- Sequence minigame
local passed = exports['HZ-Bridge']:SequenceMinigame(coords, 5, {
label = 'Enter code',
})

-- Skill check
local passed = exports['HZ-Bridge']:SkillCheck('medium', {'w', 'a', 's', 'd'})


Admin Panel (Server)

-- Open the centralised admin panel for a player (same effect as them typing /hzpanel).
-- Second arg optionally preselects a module's tab.
exports['HZ-Bridge']:OpenPanel(source)
exports['HZ-Bridge']:OpenPanel(source, 'HZ-Weather')

See the Admin Panel guide for the schema DSL, field types, and view registration.


Theme (Server & Client)

The Apparence tab in the admin panel writes a single shared theme used by every HZ NUI. Resources can read the current theme synchronously, or subscribe to live updates.

Server

-- Get the current effective theme (accent + surfaces + gradient mode + radii).
local theme = exports['HZ-Bridge']:GetTheme()

-- Subscribe to admin changes server-side.
AddEventHandler('HZ-Bridge:theme:updated', function(theme)
-- theme: { preset, accent, accentHi, gold, surface, subpanel, tint,
-- gradientMode, radiusNone, radiusXs, radiusSm, ..., radiusXl }
end)

Client

-- Live updates from the admin panel.
RegisterNetEvent('HZ-Bridge:theme:updated', function(theme)
    SendNUIMessage({ action = 'theme', data = theme })
end)

-- Pull the current theme on resource start so first paint is themed.
TriggerServerEvent('HZ-Bridge:theme:request')

The server replies via TriggerClientEvent('HZ-Bridge:theme:updated', src, theme) so the same handler runs for both initial sync and live updates.