# ESX integration (/docs/orbit-studios-resources/orbit-dynamichud-v2/interface/esx)



# ESX integration [#esx-integration]

These examples target [current ESX Legacy client functions](https://github.com/esx-framework/esx_core/blob/main/%5Bcore%5D/es_extended/client/functions.lua). Check your installed ESX version before replacing calls. Start `orbit-dynamichud-v2` before resources that call its exports.

## Notifications [#notifications]

Replace `ESX.ShowNotification(message, type, length, title)` in a **client** script with:

```lua
exports['orbit-dynamichud-v2']:notify({
    title = 'Garage',
    description = 'Vehicle stored.',
    type = 'success',
    duration = 3500
})
```

For an existing call with no title, put its message in `description`; the HUD supplies a localized heading. Map ESX's `info`, `success`, `error`, and `warning` types directly. HUD placement is controlled by the HUD, so ESX's notification `position` is not transferred.

In a **server** script, replace `xPlayer.showNotification(...)` or a targeted ESX notification event with the HUD client event:

```lua
TriggerClientEvent('orbit-dynamichud:notify', source, {
    description = 'Your vehicle is ready.',
    type = 'info',
    duration = 4000
})
```

Do not send both the ESX and HUD notification for the same action. `ESX.ShowAdvancedNotification`, floating help, and per-frame help notifications have GTA-native presentation and are **not** equivalent to a HUD notification; migrate those only when changing their behavior is acceptable.

## Text UI [#text-ui]

Replace the call at the point where the interaction becomes available, and hide it when it ends:

```lua
-- ESX.TextUI('[E] Open garage', 'info')
exports['orbit-dynamichud-v2']:showTextUI('[E] Open garage', {
    position = 'right-center'
})

-- ESX.HideUI()
exports['orbit-dynamichud-v2']:hideTextUI()
```

ESX's visual `type` does not have a direct HUD equivalent. Do not reissue `showTextUI` every frame. Also hide the prompt when its owning resource stops.

## Progress actions [#progress-actions]

[ESX.Progressbar](https://github.com/esx-framework/esx_core/blob/main/%5Bcore%5D/esx_progressbar/Progress.lua) starts an **asynchronous** action and uses `onFinish`/`onCancel` callbacks. The HUD's `progressBar` waits in the calling Lua thread and returns a completion boolean. To keep callbacks and avoid blocking your event handler, start a thread:

```lua
local function startHudProgress(message, duration, options)
    options = options or {}
    if exports['orbit-dynamichud-v2']:progressActive() then return false end

    CreateThread(function()
        local animation = options.animation
        local anim
        if animation and animation.type == 'anim' then
            anim = { dict = animation.dict, clip = animation.lib }
        elseif animation and animation.type == 'Scenario' then
            anim = { scenario = animation.Scenario }
        end

        local completed = exports['orbit-dynamichud-v2']:progressBar({
            label = message,
            duration = duration,
            canCancel = true,
            anim = anim,
            disable = { move = options.FreezePlayer == true }
        })

        if completed then
            if options.onFinish then options.onFinish() end
        elseif options.onCancel then
            options.onCancel()
        end
    end)

    return true
end

startHudProgress('Repairing vehicle', 5000, {
    FreezePlayer = true,
    animation = { type = 'anim', dict = 'mini@repair', lib = 'fixing_a_ped' },
    onFinish = function() TriggerServerEvent('garage:repairFinished') end,
    onCancel = function() print('Repair cancelled') end
})
```

`disable.move` blocks movement controls; it is **not** the same as ESX's `FreezeEntityPosition`. If you need a hard ped freeze, add that around the HUD call and guarantee it is released on cancellation and resource stop. Replace `ESX.CancelProgressbar()` with `exports['orbit-dynamichud-v2']:cancelProgress()` after migrating the corresponding start call.

## Scope and cleanup [#scope-and-cleanup]

Replacing calls in your own resource affects that resource only. ESX and other scripts still call their own UI until you migrate those call sites or deliberately maintain an ESX core fork. Do not remove `esx_notify`, `esx_textui`, or `esx_progressbar` just because one script was migrated; search all dependencies first. Keep `es_extended` and other framework functionality running.

For a timing check, call `exports['orbit-dynamichud-v2']:skillCheck('medium', { 'E' })`; ESX has no single standard skill-check function to replace. See [Skill Check](/docs/orbit-studios-resources/orbit-dynamichud-v2/interface/skill-check).
