# Progress

### lib.progressBar <a href="#libprogressbar" id="libprogressbar"></a>

Displays a running progress bar.

```lua
lib.progressBar(data)
```

* duration: `number`
* label: `string`
* useWhileDead?: `boolean`
* allowRagdoll?: `boolean`
* allowCuffed?: `boolean`
* allowFalling?: `boolean`
* canCancel?: `boolean`
* anim?: `table` (`object`)
  * dict?: `string`
    * Must specify either scenario or dict
  * clip: `string`
  * flag?: `number`
    * Default: `49`
  * blendIn?: `float`
    * Default: `3.0`
  * blendOut?: `float`
    * Default: `1.0`
  * duration?: `number` Default: `-1`
  * playbackRate?: `number` Default: `0`
  * lockX?: `boolean`
  * lockY?: `boolean`
  * lockZ?: `boolean`
  * scenario?: `string`
    * Must specify either scenario or dict
  * playEnter?: `boolean`
    * Default: `true`
* prop?: `table` (`object` or `array`)
  * \[ If you want to define multiple props, you can pass them as individual tables (array of objects) ]
  * model: `hash`
  * bone?: `number`
    * Default: `60309`
  * pos: `table`
    * x: `number`
    * y: `number`
    * z: `number`
  * rot: `table` (`object`)
    * x: `number`
    * y: `number`
    * z: `number`
* disable?: `table` (`object`)
  * move?: `boolean`
  * car?: `boolean`
  * combat?: `boolean`
  * mouse?: `boolean`

#### Usage Example <a href="#usage-example" id="usage-example"></a>

```lua
if lib.progressBar({
    duration = 2000,
    label = 'Drinking water',
    useWhileDead = false,
    canCancel = true,
    disable = {
        car = true,
    },
    anim = {
        dict = 'mp_player_intdrink',
        clip = 'loop_bottle'
    },
    prop = {
        model = `prop_ld_flow_bottle`,
        pos = vec3(0.03, 0.03, 0.02),
        rot = vec3(0.0, 0.0, -1.5)
    },
}) then print('Do stuff when complete') else print('Do stuff when cancelled') end
```

<div align="left"><figure><img src="https://i.imgur.com/7ZJgLjl.png" alt=""><figcaption></figcaption></figure></div>

### lib.progressCircle <a href="#libprogresscircle" id="libprogresscircle"></a>

Similar to `lib.progressBar` except it displays a circle and you can define a position.

```lua
lib.progressCircle(data)
```

* duration: `number`
* label?: `string`
* position?: `'middle'` or `'bottom'`
  * Default: `'middle'`
* useWhileDead?: `boolean`
* allowRagdoll?: `boolean`
* allowCuffed?: `boolean`
* allowFalling?: `boolean`
* canCancel?: `boolean`
* anim?: `table` (`object`)
  * dict?: `string`
    * Must specify either scenario or dict
  * clip: `string`
  * flag?: `number`
    * Default: `49`
  * blendIn?: `float`
    * Default: `3.0`
  * blendOut?: `float`
    * Default: `1.0`
  * duration?: `number` Default: `-1`
  * playbackRate?: `number` Default: `0`
  * lockX?: `boolean`
  * lockY?: `boolean`
  * lockZ?: `boolean`
  * scenario?: `string`
    * Must specify either scenario or dict
  * playEnter?: `boolean`
    * Default: `true`
* prop?: `table` (`object` or `array`)
  * \[ If you want to define multiple props, you can pass them as individual tables (array of objects) ]
  * model: `hash`
  * bone?: `number`
    * Default: `60309`
  * pos: `table`
    * x: `number`
    * y: `number`
    * z: `number`
  * rot: `table` (`object`)
    * x: `number`
    * y: `number`
    * z: `number`
* disable?: `table` (`object`)
  * move?: `boolean`
  * car?: `boolean`
  * combat?: `boolean`
  * mouse?: `boolean`

#### Usage Example <a href="#usage-example-1" id="usage-example-1"></a>

```lua
if lib.progressCircle({
    duration = 2000,
    position = 'bottom',
    useWhileDead = false,
    canCancel = true,
    disable = {
        car = true,
    },
    anim = {
        dict = 'mp_player_intdrink',
        clip = 'loop_bottle'
    },
    prop = {
        model = `prop_ld_flow_bottle`,
        pos = vec3(0.03, 0.03, 0.02),
        rot = vec3(0.0, 0.0, -1.5)
    },
}) then print('Do stuff when complete') else print('Do stuff when cancelled') end
```

<div align="left"><figure><img src="https://i.imgur.com/2tLbgrW.png" alt=""><figcaption></figcaption></figure></div>

### lib.progressActive <a href="#libprogressactive" id="libprogressactive"></a>

Returns true if a progress bar is currently active.

```lua
lib.progressActive()
```

### lib.cancelProgress <a href="#libcancelprogress" id="libcancelprogress"></a>

If there is a progress bar active and the progress bar can be cancelled then it cancels it.

```lua
lib.cancelProgress()
```
