A SA:MP UI library for rendering progress bars used to visualise all manner of data from health to a countdown timer.
A SA:MP UI library for rendering progress bars used to visualise all manner of data from health to a countdown timer.
Library originally written by Flávio Toribio, Now maintained by Southclaws in version 2+ with new features.
Simply install to your project:
sampctl package install Southclaws/progress2
Include in your code and begin using the library:
#include <progress2>
MAX_PLAYER_BARS
:
INVALID_PLAYER_BAR_VALUE
:
INVALID_PLAYER_BAR_ID
:
BAR_DIRECTION_RIGHT
:
BAR_DIRECTION_LEFT
:
BAR_DIRECTION_UP
:
BAR_DIRECTION_DOWN
:
PlayerBar:CreatePlayerProgressBar(playerid, Float:x, Float:y, Float:width = 55.5, Float:height = 3.2, colour, Float:max = 100.0, direction = BAR_DIRECTION_RIGHT)
:
DestroyPlayerProgressBar(playerid, PlayerBar:barid)
:
ShowPlayerProgressBar(playerid, PlayerBar:barid)
:
HidePlayerProgressBar(playerid, PlayerBar:barid)
:
IsValidPlayerProgressBar(playerid, PlayerBar:barid)
:
GetPlayerProgressBarPos(playerid, PlayerBar:barid, &Float:x, &Float:y)
:
SetPlayerProgressBarPos(playerid, PlayerBar:barid, Float:x, Float:y)
:
Float:GetPlayerProgressBarWidth(playerid, PlayerBar:barid)
:
SetPlayerProgressBarWidth(playerid, PlayerBar:barid, Float:width)
:
Float:GetPlayerProgressBarHeight(playerid, PlayerBar:barid)
:
SetPlayerProgressBarHeight(playerid, PlayerBar:barid, Float:height)
:
GetPlayerProgressBarColour(playerid, PlayerBar:barid)
:
SetPlayerProgressBarColour(playerid, PlayerBar:barid, colour)
:
Float:GetPlayerProgressBarMaxValue(playerid, PlayerBar:barid)
:
SetPlayerProgressBarMaxValue(playerid, PlayerBar:barid, Float:max)
:
Float:GetPlayerProgressBarValue(playerid, PlayerBar:barid)
:
SetPlayerProgressBarValue(playerid, PlayerBar:barid, Float:value)
:
GetPlayerProgressBarDirection(playerid, PlayerBar:barid)
:
SetPlayerProgressBarDirection(playerid, PlayerBar:barid, direction)
:
_RenderBar(playerid, barid)
:
OnScriptInit
:
OnPlayerDisconnect
:
To test, simply run the package:
sampctl package run
And connect to localhost:7777
to test.