SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 15/09/2014, 06:47 PM   #1
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,717
Reputation: 1255
Default Progress Bars v2 (Originally by Toribio)

progress2.inc



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 Flvio Toribio: [email protected]
Now maintained by Southclaw in version 2+ with new features.


Download

Available on GitHub:



Progress Bar Editors for UI design:

Emmet_ (Post) (Pastebin)
Pottus (Post) (Pastebin)

Preview

Right and left bars.


Upwards progress bars added in this release!


All available progress bar directions:



Resources


Constants
  • MAX_PLAYER_BARS: Defaults to the textdraw limit divided by 3.
  • INVALID_PLAYER_BAR_VALUE: Invalid return value for interface functions.
  • INVALID_PLAYER_BAR_ID: Invalid bar ID value.
  • BAR_DIRECTION_RIGHT: Bar direction left-to-right: [> ]
  • BAR_DIRECTION_LEFT: Bar direction right-to-left: [ <]
  • BAR_DIRECTION_UP: Bar direction bottom to top: [/\]
  • BAR_DIRECTION_DOWN: Bar direction top to bottom: [\/]

Functions
  • PlayerBar:CreatePlayerProgressBar(playerid, Float:x, Float:y, Float:width = 55.5, Float:height = 3.2, colour, Float:max = 100.0, direction = BAR_DIRECTION_RIGHT);
    Creates a progress bar for a player.
  • DestroyPlayerProgressBar(playerid, PlayerBar:barid);
    Destroys a player's progress bar.
  • ShowPlayerProgressBar(playerid, PlayerBar:barid);
    Shows a player's progress bar to them.
  • HidePlayerProgressBar(playerid, PlayerBar:barid);
    Hides a player's progress bar from them.
  • IsValidPlayerProgressBar(playerid, PlayerBar:barid);
    Returns true if the input bar ID is valid and exists.
  • GetPlayerProgressBarPos(playerid, PlayerBar:barid, &Float:x, &Float:y);
    Returns the on-screen position of the specified progress bar.
  • SetPlayerProgressBarPos(playerid, PlayerBar:barid, Float:x, Float:y);
    Updates the position for a progress bar and re-renders it.
  • Float:GetPlayerProgressBarWidth(playerid, PlayerBar:barid);
    Returns the width of a progress bar.
  • SetPlayerProgressBarWidth(playerid, PlayerBar:barid, Float:width);
    Updates the width of a progress bar and re-renders it.
  • Float:GetPlayerProgressBarHeight(playerid, PlayerBar:barid);
    Returns the height of a progress bar.
  • SetPlayerProgressBarHeight(playerid, PlayerBar:barid, Float:height);
    Updates the height of a progress bar and re-renders it.
  • GetPlayerProgressBarColour(playerid, PlayerBar:barid);
    Returns the colour of a progress bar.
  • SetPlayerProgressBarColour(playerid, PlayerBar:barid, colour);
    Sets the colour of a progress bar.
  • Float:GetPlayerProgressBarMaxValue(playerid, PlayerBar:barid);
    Returns the maximum value of a progress bar.
  • SetPlayerProgressBarMaxValue(playerid, PlayerBar:barid, Float:max);
    Sets the maximum value that a progress bar represents.
  • Float:GetPlayerProgressBarValue(playerid, PlayerBar:barid);
    Returns the value a progress bar represents.
  • SetPlayerProgressBarValue(playerid, PlayerBar:barid, Float:value);
    Sets the value a progress bar represents.
  • GetPlayerProgressBarDirection(playerid, PlayerBar:barid);
    Returns the direction of a progress bar.
  • SetPlayerProgressBarDirection(playerid, PlayerBar:barid, direction);
    Updates the direction for a progress bar and re-renders it.

Internal
  • _RenderBar: Renders a valid bar on-screen using it's current properties. Called on creation and whenever position, width or height are updated.

Hooked
  • OnGameModeInit / OnFilterScriptInit: When y_iterate is used, initialises iterators.
  • OnPlayerDisconnect: To automatically destroy bars when a player disconnects.


Roadmap
  • Integrate global progress bars (if there is demand).
  • Write a bar creator/editor filterscript tool.
  • Improve colour customisation options.
  • Add option to make bars clickable.
  • Implement automatic interpolation based filling (with various animations)

Last edited by [HLF]Southclaw; 15/07/2016 at 02:41 PM.
[HLF]Southclaw is offline   Reply With Quote
Old 15/09/2014, 06:50 PM   #2
Manyula
Huge Clucker
 
Join Date: Jan 2012
Location: Germany
Posts: 261
Reputation: 24
Default Re: Progress Bars v2 (Originally by Toribio)

Awesome work! Thank you very much!
Manyula is offline   Reply With Quote
Old 15/09/2014, 06:50 PM   #3
momo123
Banned
 
Join Date: Dec 2013
Posts: 93
Reputation: 9
Default Re: Progress Bars v2 (Originally by Toribio)

Nice work +rep keep it up <3
momo123 is offline   Reply With Quote
Old 15/09/2014, 06:51 PM   #4
Lordzy
High-roller
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,801
Reputation: 1095
Default Re: Progress Bars v2 (Originally by Toribio)

Looks nice, I wondered why didn't you create a topic when you simply posted on the old thread of this include.
__________________
[Include]safeDialogs - Complete protection against dialog responses! (dialog ids, list-items, input-text of list-item and user)

Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote
Old 15/09/2014, 06:52 PM   #5
Mellnik
Gangsta
 
Mellnik's Avatar
 
Join Date: Dec 2011
Location: Paradise Falls, CAℕADA
Posts: 797
Reputation: 369
Default AW: Progress Bars v2 (Originally by Toribio)

Woah, going to use this for my upcoming project.
Mellnik is offline   Reply With Quote
Old 15/09/2014, 06:55 PM   #6
Emmet_
Guest
 
Posts: n/a
Default Re: Progress Bars v2 (Originally by Toribio)

Very nice! I've been waiting for player progress bars for a while now, but I could use the extra features aswell .
  Reply With Quote
Old 15/09/2014, 07:01 PM   #7
LorDWarS
Big Clucker
 
Join Date: Dec 2013
Posts: 72
Reputation: 3
Default Re: Progress Bars v2 (Originally by Toribio)

Nice! god job
LorDWarS is offline   Reply With Quote
Old 15/09/2014, 07:16 PM   #8
TheArcher
High-roller
 
TheArcher's Avatar
 
Join Date: Dec 2009
Location: Home
Posts: 2,422
Reputation: 251
Default Re: Progress Bars v2 (Originally by Toribio)

That's it, tired of various progressbar on internet. Thanks a lot!
__________________
TheArcher is offline   Reply With Quote
Old 15/09/2014, 07:22 PM   #9
Smileys
Huge Clucker
 
Smileys's Avatar
 
Join Date: Dec 2013
Location: Home.
Posts: 399
Reputation: 31
Default Re: Progress Bars v2 (Originally by Toribio)

I must say I've been waiting for an improved version of the old one.

Nice work

Q: can I use Toribio's in-game progress bar creator to determine the position of the bar?
Smileys is offline   Reply With Quote
Old 15/09/2014, 07:38 PM   #10
[email protected]
High-roller
 
Michael@Belgium's Avatar
 
Join Date: Dec 2010
Location: Belgium
Posts: 3,041
Reputation: 1001
Default Re: Progress Bars v2 (Originally by Toribio)

Ah. Neat !
__________________
Mah Github. - Mah Youtube
Interested in a full featured and cheap derby gamemode or need host-tab ? Contact me on skype: michael.belgium
Michael@Belgium is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Progress bars dont show up Lidor124 Scripting Help 3 02/03/2014 03:25 PM
Moving Progress Bars eеe Scripting Help 2 05/01/2012 05:17 AM
Progress Bars Creation CrucixTM Help Archive 0 15/12/2010 08:29 AM


All times are GMT. The time now is 10:09 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.