# QB-Core integration (/docs/orbit-studios-resources/orbit-dynamichud-v2/interface/qb-core)



# QB-Core integration [#qb-core-integration]

These mappings follow [QB-Core's client functions](https://github.com/qbcore-framework/qb-core/blob/main/client/functions.lua), [DrawText exports](https://github.com/qbcore-framework/qb-core/blob/main/client/drawtext.lua), and [progressbar contract](https://github.com/qbcore-framework/progressbar). Start `orbit-dynamichud-v2` before resources that call its exports. Apply changes to the **resource that owns each call**; Lua globals are not shared across resources.

## Notifications [#notifications]

For a client-side `QBCore.Functions.Notify(text, type, length)`, use:

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

QB also accepts `{ text = 'Heading', caption = 'Details' }`. Map `text` to HUD `title` and `caption` to `description`. `primary` may be passed as `type = 'primary'`; QB-only icon or visual settings may not have the same appearance in the HUD.

For a server-side `QBCore.Functions.Notify(source, text, type, length)` or `TriggerClientEvent('QBCore:Notify', ...)`, send only the HUD event:

```lua
TriggerClientEvent('orbit-dynamichud:notify', source, {
    description = 'Vehicle stored.',
    type = 'success',
    duration = 5000
})
```

QB-Core's own [server Notify](https://github.com/qbcore-framework/qb-core/blob/main/server/functions.lua) and [client `QBCore:Notify` handler](https://github.com/qbcore-framework/qb-core/blob/main/client/events.lua) are separate paths. A bridge loaded in one unrelated resource will **not** replace either framework path globally.

## DrawText / HideText [#drawtext--hidetext]

Replace QB's `DrawText` and `HideText` calls in the same client resource:

```lua
-- exports['qb-core']:DrawText('[E] Open garage', 'left')
exports['orbit-dynamichud-v2']:showTextUI('[E] Open garage', {
    position = 'left-center'
})

-- exports['qb-core']:HideText()
exports['orbit-dynamichud-v2']:hideTextUI()
```

The HUD supports `left-center`, `right-center`, `top-center`, and `bottom-center`; translate QB placement deliberately. QB's `KeyPressed` helper hides its prompt, so replace that behavior with `hideTextUI()` at the point where the key is accepted. Show once on interaction entry, hide on exit or resource stop, and avoid a per-frame show loop.

## Progressbar callbacks [#progressbar-callbacks]

QB's `QBCore.Functions.Progressbar(...)` is callback-based. The HUD's progress export returns a boolean **after** the action ends. Use a thread if your existing script depends on immediate return, and map QB's control/animation/prop fields:

```lua
local function hudProgressbar(name, label, duration, useWhileDead, canCancel,
    disableControls, animation, prop, propTwo, onFinish, onCancel)
    disableControls = disableControls or {}
    animation = animation or {}

    local function hudProp(value)
        if not value or not value.model then return nil end
        return {
            model = value.model,
            bone = value.bone,
            pos = value.coords,
            rot = value.rotation
        }
    end

    local props = {}
    local first, second = hudProp(prop), hudProp(propTwo)
    if first then props[#props + 1] = first end
    if second then props[#props + 1] = second end

    CreateThread(function()
        local completed = exports['orbit-dynamichud-v2']:progressBar({
            id = name,
            label = label,
            duration = duration,
            useWhileDead = useWhileDead,
            canCancel = canCancel,
            disable = {
                move = disableControls.disableMovement,
                car = disableControls.disableCarMovement,
                mouse = disableControls.disableMouse,
                combat = disableControls.disableCombat
            },
            anim = animation.task and { scenario = animation.task } or
                (animation.animDict and {
                    dict = animation.animDict,
                    clip = animation.anim,
                    flag = animation.flags
                } or nil),
            prop = #props > 0 and props or nil
        })

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

-- Replace QBCore.Functions.Progressbar(...) with hudProgressbar(...)
hudProgressbar('repair', 'Repairing vehicle', 5000, false, true,
    { disableMovement = true, disableCombat = true },
    { animDict = 'mini@repair', anim = 'fixing_a_ped', flags = 49 },
    nil, nil,
    function() TriggerServerEvent('garage:repairFinished') end,
    function() print('Cancelled') end)
```

This keeps the QB **callback timing** and translates the common fields. QB's progress UI and HUD progress UI have different visuals; inspect any custom flags, prop offsets, and cancellation assumptions in your scripts. Use `cancelProgress()` for actions that should be stopped programmatically. For a new action with no callback requirement, call `progressBar` directly and branch on its boolean result.

## Framework-wide migration [#framework-wide-migration]

Migrating your own scripts is the least risky option. To replace **QB-Core's own** notices, prompts, or progress display, maintain a tested QB-Core fork and change the relevant QB-Core client functions themselves (plus any direct `progressbar`/DrawText calls). Its `QBCore:Notify` handler already calls `QBCore.Functions.Notify`, so changing that function in the core captures the event path. Do not register a second `QBCore:Notify` handler without removing the original, or players will see duplicate notices. Core edits may be overwritten by framework updates. Search every resource before stopping QB's `progressbar` dependency.

QB-Core does not define one universal skill-check contract. Use the HUD [Skill Check export](/docs/orbit-studios-resources/orbit-dynamichud-v2/interface/skill-check) where your own scripts require a timing check.
