🤠 Wild Country Libs
Client API

Progress

Use StartProgress when a player action needs a timed progressbar. wc_libs uses vorp_progressbar when it is running, and falls back to a simple timer handle when the resource is unavailable.

StartProgress(label, durationMs, cb, style)client

Starts a timed progress action and calls cb when it completes.

ParamTypeDescription
labelstringText shown by the progressbar.
durationMsnumberDuration in milliseconds.
cbfunction | nilCalled after the timer completes if the handle was not canceled.
stylestring | nilProgressbar style. Defaults to 'innercircle'.
example
local handle = wc:StartProgress('Repairing wagon...', 7000, function()
  TriggerServerEvent('my_resource:repairComplete')
end, 'innercircle')

if IsEntityDead(PlayerPedId()) and handle and handle.cancel then
  handle.cancel()
end
Fallback handle. When vorp_progressbar is not started, wc_libs returns a timer handle with cancel() and stop(). Both prevent the completion callback from firing.

Real Wild County example — corn delivery loading bar

wc_corndelivery/client/main.lua
wc:StartProgress('Loading corn sacks...', 4000, function()
  wc:TriggerCallback('wc_corndelivery:pickupSack')
end)

For crafting-style flows that need a cancel button (e.g. leather crafting at a workbench), keep the handle and cancel it if the player walks away:

crafting cancel-on-move example
local startCoords = GetEntityCoords(PlayerPedId())
local handle = wc:StartProgress('Crafting...', 5000, onDone)

CreateThread(function()
  while not handle.canceled do
    Wait(250)
    if #(GetEntityCoords(PlayerPedId()) - startCoords) > 1.5 then
      handle.cancel()
      break
    end
  end
end)

Common mistakes

Troubleshooting