Koja Scripts
KOJA-LIB

Progress Bar

A progress bar with optional animation and input blocking.

Progress Bar

A progress bar with optional animation and input blocking.


startProgressbar

startProgressbar(data, callback)

Also available as an export:

exports['koja-lib']:startProgressbar(data, callback)

Parameters

FieldTypeDefaultDescription
labelstring"Loading..."Title text (alias: title)
descriptionstring"Please wait..."Body text (alias: text)
durationnumber5000Duration in milliseconds (alias: time)
cancelablebooleanfalsePlayer can press X to cancel
animationtable?Ped animation to play
animation.dictstringAnimation dictionary
animation.namestringAnimation name
animation.flagnumber1Animation flag
inputBlocktable?Keys to block during the progress bar
inputBlock.keysstring[]Key names to disable (e.g. {"E", "SPACE"})

Callback

callback(success: boolean) — called when the bar finishes (true) or is cancelled (false).


cancelProgressbar

Cancel and hide the active progress bar immediately.

cancelProgressbar()

-- or via export:
exports['koja-lib']:cancelProgressbar()

Theme

Appearance is controlled by Config.UI.ProgressBar in the config file:

Config.UI.ProgressBar = {
    theme        = "darkBlack",  -- orange | darkGray | darkBlack | navy | green | purple | red
    bottomOffset = 1,
}

Examples

Basic progress bar

startProgressbar({
    label    = 'Searching...',
    duration = 5000,
}, function(success)
    if not success then return end
    -- action after completion
    print('Done')
end)

With animation and cancelable

startProgressbar({
    label       = 'Hotwiring',
    description = 'Hold still...',
    duration    = 8000,
    cancelable  = true,
    animation   = {
        dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
        name = 'machinic_loop_mechandplayer',
        flag = 1,
    },
    inputBlock = {
        keys = { 'SPACE', 'W', 'A', 'S', 'D' },
    },
}, function(success)
    if success then
        TriggerServerEvent('myScript:hotwireComplete')
    end
end)

Key Names Reference

Common keys you can use in inputBlock.keys:

ESC, F1F10, TAB, ENTER, SPACE, BACKSPACE
AZ, 09
LEFT, RIGHT, TOP, DOWN
LEFTSHIFT, LEFTCTRL, LEFTALT
HOME, PAGEUP, PAGEDOWN, DELETE

  • Callbacks — koja-lib provides a callback system that lets client scripts request data from the server and vice versa.
  • Inventory — Client-side inventory functions let you check what items the local player has without a server round-trip.
  • DUI — DUI (Dynamic UI) allows you to render a web page as a texture on any in-game surface — screens, billboards, laptops, phones, etc.
  • Money — Retrieve the local player's money balance from the client side via a server callback.
  • Keybinds — Register persistent key bindings that players can rebind in the GTA V settings menu.
  • Notifications — koja-lib provides two notification interfaces: SendNotify (routes through the configured backend) and LibNotify (built-in koja-lib notification).
  • Client API — back to the section overview