01 Exports & API
Client Exports
| Export | Description |
|---|
| StartProgress(data: table) | Starts a progress bar with label, duration, theme, animation and onFinish/onCancel callbacks. |
| StopProgress(completed: boolean) | Stops the active progress bar; passes completion state to onFinish. |
| IsProgressActive() | Returns whether a progress bar is currently active. |
| GetProgressPercentage() | Returns the current 0-100 completion percentage of the active bar. |
| SetProgressTheme(theme: string) | Updates the live progress bar theme (e.g. 'modern'). |
| SetProgressPosition(position: string) | Updates the live progress bar position on screen. |
| TryReload(usedItem?: string) | Initiates a secured weapon reload flow (validates ammo type and item server-side). |
| UseConsumable(itemName: string, isDrink: boolean) | Plays the eat/drink progress with animation for the named item. |
Server Exports
| Export | Description |
|---|
| StartProgressForPlayer(playerId: number, data: table) | Starts a progress bar on a specific player from the server. |
| StopProgressForPlayer(playerId: number, completed?: boolean) | Stops the active progress bar for a specific player. |
| StartProgressForAllPlayers(data: table) | Broadcasts a progress bar to every connected player. |
| StopProgressForAllPlayers(completed?: boolean) | Stops the active progress bar on every connected player. |
Client Events
| Event | Description |
|---|
| Agency:Progressbar:LoadSettings | Loads per-player UI settings (position, color, scale, style) from DB into the client. |
| agency-progressbar:client:start | Starts the progress bar on the receiving client with the supplied data. |
| agency-progressbar:client:stop | Stops the active progress bar with a completion flag. |
| agency:consumables:useFood | Inventory bridge to consume a food item (animation + secured server apply). |
| agency:consumables:useDrink | Inventory bridge to consume a drink item (animation + secured server apply). |
Server Events
| Event | Description |
|---|
| Agency:Progressbar:SaveSettings | Validates and persists the player's progress bar UI settings to the DB. |
| agency-progressbar:server:start | Server-side trigger to start a progress bar on a target (or self). |
| agency-progressbar:server:stop | Server-side trigger to stop a progress bar on a target (or self). |
| agency:reload:request | Validates ammo/weapon/item before granting a reload to the requesting player. |
| agency:consumables:apply | Validates inventory, removes one item and applies hunger/thirst gains. |
Example: Start with callbacks
exports['Agency-Progressbar']:StartProgress({
label = 'Repairing Vehicle...',
duration = 5000,
canCancel = true,
anim = { dict = 'mini@repair', clip = 'fixing_a_player' },
onComplete = function() print('Done!') end,
onCancel = function() print('Cancelled!') end,
})