Skip to content

Progress Bar Module - Client

Read Here on how to import the module into your scripts!

Init

Initialize an asynchronous progress bar.

lua
local success = Progress.Init({
  label = 'Processing...',
  duration = 5000, -- 5 Seconds
  prop = { ... },
  animation = { ... },
  states = { ... }
})

Returns

  • success (boolean) – Whether the progress bar was completed

Parameters

Data Structure

label

  • Type: string
  • Description: The text displayed on the progress bar.

duration

  • Type: number
  • Description: How long will the progress bar last? (milliseconds)

prop

  • Type: table or table[]
  • Description: Props attached to the player during the progress. Can be a single prop table or an array of props. Each prop entry is a table with:
FieldTypeDescription
modelstringThe prop model name
bonenumberThe GTA ped bone ID to attach the prop to
positionvector3Offset from the bone (x, y, z)
rotationvector3Rotation of the prop (x, y, z in degrees)

Example — single prop:

lua
prop = {
  model = 'prop_tool_wrench',
  bone = 57005, -- Right Hand
  position = vector3(0.05, 0, 0),
  rotation = vector3(0, 0, 45),
}

Example — two props:

lua
prop = {
  {
    model = 'prop_tool_box_04',
    bone = 18905, -- Left Hand
    position = vector3(0.05, 0, 0),
    rotation = vector3(0, 90, 0),
  },
  {
    model = 'prop_tool_wrench',
    bone = 57005, -- Right Hand
    position = vector3(0, 0.05, 0),
    rotation = vector3(0, 0, 45),
  }
}

animation

  • Type: table
  • Description: Animation to play during the progress bar. Fields:
FieldTypeDescription
dictstringAnimation dictionary
namestringAnimation name
flagsnumberAnimation flags (loop, upper body, etc.)

states

  • Type: table
  • Description: Controls player behavior during the progress. Fields:
FieldTypeDescription
useWhileDeadbooleanCan progress bar be used while dead
canCancelbooleanWhether player can cancel
disableMovementbooleanDisable movement while in progress
disableDrivingbooleanDisable driving
disableCombatbooleanDisable combat
disableMouseMovementbooleanDisable camera/mouse movement
disableSprintbooleanDisable sprinting

Example

This is an example with using two props (one in the left hand, one in the right hand)

lua
RegisterCommand('sdk:progress', function()
  local success = progress.init({
    label = 'Processing...',
    duration = 5000, -- 5 Seconds
    prop = { 
      {
        model = 'prop_tool_box_04',
        bone = 18905, -- Left Hand
        position = vector3(0.05, 0, 0), 
        rotation = vector3(0, 270, 0),
      },
      {
        model = 'prop_tool_wrench',
        bone = 57005, -- Right Hand
        position = vector3(0.05, 0, 0),
        rotation = vector3(0.05, 0, 45),
      }
    },
    animation = {
      dict = 'amb@world_human_welding@male@base',
      name = 'base',
      flags = 16,
    },
    states = {
      useWhileDead = false,
      canCancel = true,
      disableMovement = false,
      disableDriving = true,
      disableCombat = true,
      disableMouseMovement = false,
      disableSprint = true,
    }
  })

  print('Progress Bar Result:', success)
end)