Skip to content

Progress ​

A progress bar or circle for timed actions. Both are client only, block the calling thread until the action ends, and return true when it completed or false when it was canceled or interrupted.

lua
local done = tm.progressBar({
    duration = 5000,
    label = tm.locale.t('repair.working'),
    canCancel = true,
    disable = { move = true, car = true, combat = true },
    anim = { dict = 'mini@repair', clip = 'fixing_a_ped' },
    prop = { model = 'prop_tool_wrench', bone = 57005, pos = vec3(0.1, 0.0, 0.0), rot = vec3(0.0, 0.0, 90.0) },
})

if done then repairVehicle() end
FunctionNotes
tm.progressBar(data)A horizontal bar.
tm.progressCircle(data)A circle.
tm.progressActive()true while either is running.
tm.cancelProgress(override?)Cancels the running one. It only works when the progress allows canceling, unless override is true. Returns whether it canceled.

Only one progress runs at a time. Starting a second returns false at once and logs a warning, so check tm.progressActive() first if that can happen.

Options ​

Progress bar and circle (use the Progress menu)Open full size
FieldMeaning
durationRequired. Milliseconds.
labelText shown with the bar.
colorAny color.
icon, iconsAn icon, or a list of icons the circle cycles through.
canCancelThe player can cancel with X. Default false.
disableLocks controls while it runs: move, sprint, car, combat, mouse, each a boolean.
anim{ dict, clip, flag = 49, blendIn, blendOut, duration }, or { scenario = '...' } to play a scenario in place.
propOne prop or a list: { model, bone = 60309, pos, rot, rotOrder }. Attached to the ped for the duration.

What ends it early ​

A progress returns false when the player cancels, or when the player is dead, ragdolling, cuffed, falling or swimming. Opt out of each with useWhileDead, allowRagdoll, allowCuffed, allowFalling and allowSwimming. The animation and props are removed when it ends, whichever way it ended. A prop or animation that fails to load is skipped with a warning and the progress still runs.

Performance ​

The progress loop runs every frame only while controls are locked (disable) or canCancel is on, since those need a per frame call. Otherwise it wakes every 100 ms to check the player's state. It exits as soon as the progress ends.