Help with ProgressBar2 - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with ProgressBar2 (
/showthread.php?tid=567252)
Help with ProgressBar2 -
Nabster - 12.03.2015
https://sampforum.blast.hk/showthread.php?tid=537468
How to use this to create CaptureBar with timer,i can create Bar but i don't know how do i update it like when i type /bar it starts the capture timer and then new color comes,bar color will be white and capture color will be green,pls help me out
Re: Help with ProgressBar2 -
LegendOfScripts - 12.03.2015
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.
Re: Help with ProgressBar2 -
Nabster - 12.03.2015
Code:
CMD:bar(playerid,params[])
{
SendClientMessage(playerid,COLOR_PINK,"Progress bar activated");
Bar = CreatePlayerProgressBar(playerid, 375.879943, 160.166656, 100.0, 15.0, COLOR_GREEN, 100.0, BAR_DIRECTION_RIGHT);
SetTimerEx("CountBar", 1000, true, "i", playerid);
ShowPlayerProgressBar(playerid,Bar);
return 1;
}
CMD:hbar(playerid,params[])
{
SendClientMessage(playerid,COLOR_PINK,"Health bar activated");
HealthBar = CreatePlayerProgressBar(playerid, 375.879943, 160.166656, 100.0, 15.0, COLOR_LIMEGREEN, 100.0, BAR_DIRECTION_RIGHT);
SetTimerEx("HBUpdate", 1000, true, "i", playerid);
ShowPlayerProgressBar(playerid,HealthBar);
return 1;
}
forward CountBar(playerid);
public CountBar(playerid)
{
new Float:BarCount;
SetPlayerProgressBarValue(playerid, Bar, BarCount);
SetPlayerProgressBarColour(playerid, Bar, COLOR_RED);
BarCount++;
return 1;
}
forward HBUpdate(playerid);
public HBUpdate(playerid)
{
GetPlayerHealth(playerid,health);
SetPlayerProgressBarValue(playerid, HealthBar, health);
SetPlayerProgressBarColour(playerid, HealthBar, COLOR_RED);
return 1;
}
The /bar is not working as i want it to be and /hbar is working but it shows Limegreen color first then GREEN then RED,idk why it shows the GREEN color,i need help here please