Skip to main content

API & configuration

exports['fr_progressbar']:Start(opts)id

Starts a new progress bar. If one is already running it is silently cancelled first.

Options

OptionTypeRequiredDescription
labelstringText shown in the bar
durationnumberDuration in milliseconds
iconstringIcon name or raw <svg> markup
colorstring'blue' | 'red' | 'green' | 'yellow' (default: 'blue')
canCancelbooleanPlayer can press the cancel key (default: true)
cancelOnMovebooleanCancels when the player moves (default: false)
cancelOnDeathbooleanCancels on death (default: Config.CancelOnDeath)
onCompletefunctionFired when the bar finishes naturally
onCancelfunctionFired when cancelled for any reason

Returns the bar's id string, or nil if duration is <= 0.


exports['fr_progressbar']:Stop(id?)

Stops a running bar programmatically. Fires onCancel unless the bar does not exist.

exports['fr_progressbar']:Stop() -- stop any active bar
exports['fr_progressbar']:Stop(id) -- stop a specific bar by id

exports['fr_progressbar']:IsActive()boolean

Returns true if a bar is currently running.


Usage examples

Healing (green, cancel on move)

exports['fr_progressbar']:Start({
label = 'Applying bandage...',
duration = 4000,
icon = 'medical',
color = 'green',
cancelOnMove = true,
onComplete = function()
-- apply heal
end,
})

Criminal action (red, cancellable)

exports['fr_progressbar']:Start({
label = 'Hacking terminal...',
duration = 12000,
icon = 'lock',
color = 'red',
canCancel = true,
onComplete = function() end,
onCancel = function() end,
})

Configuration (config.lua)

KeyDefaultDescription
Config.Locale'es'UI language: 'en' or 'es'
Config.CancelKey194FiveM control index for the cancel key (Backspace)
Config.CancelKeyLabel'Backspace'Human-readable label shown in the bar hint
Config.MoveThreshold1.5Metres a player must move to trigger cancelOnMove
Config.CancelOnDeathtrueGlobal default; individual calls can override with cancelOnDeath = false