> For the complete documentation index, see [llms.txt](https://s1h.gitbook.io/info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://s1h.gitbook.io/info/resources/s1h_uipack/editable-files/exports/progressbar.md).

# Progressbar

### Progress

Starts a timed progress bar action with optional animation, prop attachment, control disabling, and a completion callback.

**You can use it for any timed action where you want visual feedback — vehicle repair, lockpicking, crafting, medical procedures, planting evidence, and more.**

```lua
exports["s1h_uipack"]:Progress(action, callback)
```

**Parameters :**

| Name                                      | Type    | Description                                                        |
| ----------------------------------------- | ------- | ------------------------------------------------------------------ |
| action.name                               | string  | Internal identifier for this action                                |
| action.duration                           | number  | Total time the bar runs, in milliseconds                           |
| action.label                              | string  | Text displayed above the progress bar                              |
| action.useWhileDead                       | boolean | Allow the action to run while the player is dead. Default: `false` |
| action.canCancel                          | boolean | Allow the player to cancel by pressing **Delete**. Default: `true` |
| **Control disables**                      |         |                                                                    |
| action.controlDisables.disableMovement    | boolean | Freeze the player's movement inputs                                |
| action.controlDisables.disableCarMovement | boolean | Freeze vehicle steering/acceleration                               |
| action.controlDisables.disableMouse       | boolean | Lock the mouse look                                                |
| action.controlDisables.disableCombat      | boolean | Disable shooting and melee inputs                                  |
| **Animation**                             |         |                                                                    |
| action.animation.animDict                 | string  | Animation dictionary to load                                       |
| action.animation.anim                     | string  | Animation clip name inside the dictionary                          |
| action.animation.flags                    | number  | Animation blend flags (e.g. `1` = loop). Default: `0`              |
| action.animation.task                     | string  | Alternative: play a scenario task instead of an animation          |
| **Prop (first)**                          |         |                                                                    |
| action.prop.model                         | string  | Prop model name to spawn and attach                                |
| action.prop.bone                          | number  | Bone index to attach the prop to (e.g. `28422` = right hand)       |
| action.prop.coords                        | vector3 | Position offset from the bone                                      |
| action.prop.rotation                      | vector3 | Rotation offset from the bone                                      |
| **Prop (second)**                         |         |                                                                    |
| action.propTwo.model                      | string  | Second prop model name (optional)                                  |
| action.propTwo.bone                       | number  | Bone index for the second prop                                     |
| action.propTwo.coords                     | vector3 | Position offset for the second prop                                |
| action.propTwo.rotation                   | vector3 | Rotation offset for the second prop                                |

**Callback :** `function(cancelled)` — fires when the bar finishes. `cancelled = true` means the player pressed Delete or died. `cancelled = false` means it completed naturally.

***

**Example — simple progress bar (no animation) :**

```lua
exports["s1h_uipack"]:Progress({
    name      = "simple_action",
    duration  = 5000,
    label     = "Processing...",
    canCancel = true,
    controlDisables = {
        disableMovement = true,
        disableCombat   = true
    }
}, function(cancelled)
    if not cancelled then
        print("Done!")
    end
end)
```

***

**Example — with animation and one prop :**

```lua
-- Repairing a vehicle: player holds a wrench and plays a repair animation
exports["s1h_uipack"]:Progress({
    name      = "repair_vehicle",
    duration  = 8000,
    label     = "Repairing vehicle...",
    canCancel = true,
    controlDisables = {
        disableMovement    = true,
        disableCarMovement = true,
        disableCombat      = true
    },
    animation = {
        animDict = "mini@repair",
        anim     = "fixing_a_player",
        flags    = 1
    },
    prop = {
        model    = "prop_tool_wrench",
        bone     = 28422,                       -- right hand
        coords   = vec3(0.12, 0.03, -0.02),
        rotation = vec3(50.0, -30.0, 0.0)
    }
}, function(cancelled)
    if not cancelled then
        TriggerServerEvent("vehicle:server:repairComplete")
        exports["s1h_uipack"]:SendAdvancedNotify(nil, "Vehicle repaired!", "success", 3000)
    else
        exports["s1h_uipack"]:SendAdvancedNotify(nil, "Repair cancelled.", "warning", 2000)
    end
end)
```

***

**Example — with two props (e.g. handing cash) :**

```lua
exports["s1h_uipack"]:Progress({
    name      = "hand_cash",
    duration  = 4000,
    label     = "Handing over the money...",
    canCancel = false,
    controlDisables = { disableMovement = true },
    animation = {
        animDict = "anim@heists@ornate_bank@grab_cash",
        anim     = "intro",
        flags    = 1
    },
    prop = {
        model    = "prop_cash_pile_01",
        bone     = 60309,                       -- left hand
        coords   = vec3(0.0, 0.0, 0.0),
        rotation = vec3(0.0, 0.0, 0.0)
    },
    propTwo = {
        model    = "prop_cs_bank_note_01",
        bone     = 28422,                       -- right hand
        coords   = vec3(0.05, 0.0, 0.0),
        rotation = vec3(0.0, 0.0, 90.0)
    }
}, function(cancelled)
    if not cancelled then
        TriggerServerEvent("myScript:server:transferCash")
    end
end)
```

***

**Example — using a scenario task instead of an animation :**

```lua
-- Player stands and pretends to use a phone during the action
exports["s1h_uipack"]:Progress({
    name      = "phone_call",
    duration  = 6000,
    label     = "Making a call...",
    canCancel = true,
    controlDisables = { disableMovement = true },
    animation = {
        task = "WORLD_HUMAN_STAND_MOBILE"   -- use task instead of animDict + anim
    }
}, function(cancelled)
    if not cancelled then
        TriggerServerEvent("myScript:server:callComplete")
    end
end)
```

***

**Example — useWhileDead :**

```lua
-- Player can interact even while they are dead (e.g. last stand action)
exports["s1h_uipack"]:Progress({
    name         = "send_distress",
    duration     = 3000,
    label        = "Sending distress signal...",
    useWhileDead = true,
    canCancel    = false
}, function(cancelled)
    if not cancelled then
        TriggerServerEvent("hospital:server:distressSignalSent")
    end
end)
```

***

### isDoingSomething

Returns whether a progress bar is currently running on this client.

**You can use it to prevent stacking progress bars — always check this before calling `Progress`.**

```lua
local busy = exports["s1h_uipack"]:isDoingSomething()
```

**Return value :** `boolean` — `true` if a progress bar is active, `false` otherwise.

**Example :**

```lua
RegisterCommand("craftitem", function()
    if exports["s1h_uipack"]:isDoingSomething() then
        print("Already busy, cannot start a new action.")
        return
    end

    exports["s1h_uipack"]:Progress({
        name      = "crafting",
        duration  = 10000,
        label     = "Crafting item...",
        canCancel = true,
        controlDisables = { disableMovement = true }
    }, function(cancelled)
        if not cancelled then
            TriggerServerEvent("crafting:server:giveItem")
        end
    end)
end, false)
```
