09.10.2014, 09:35
Hi.
I have created a Health Bar with some colors.
When you have between 100 and 60HP, the color is green, when you have from 60 to 30 HP it's yellow, and from 30 to 0 it's red...
But this does not work, it always show like a yellow bar with 0 HP...
Here's the include of the Bar, and the code.
https://sampforum.blast.hk/showthread.php?tid=113443
Help me please!
I have created a Health Bar with some colors.
When you have between 100 and 60HP, the color is green, when you have from 60 to 30 HP it's yellow, and from 30 to 0 it's red...
But this does not work, it always show like a yellow bar with 0 HP...
Here's the include of the Bar, and the code.
https://sampforum.blast.hk/showthread.php?tid=113443
pawn Код:
//On OnPlayerConnect:
SetTimer("ProgressBar", 500, 1);
forward ProgressBar();
public ProgressBar() //I prefer not to use OnPlayerUpdate with textdraws
{
for (new playerid; playerid < MAX_PLAYERS; playerid++) //I recommend foreach(Player, playerid)
{
new Float:health;
GetPlayerHealth(playerid, health);
if(health == 100 || health >= 60)
{
ShowProgressBarForPlayer(phealthsano[playerid]);
SetProgressBarValue(phealthsano[playerid], health);
UpdateProgressBar(phealthsano[playerid], playerid);
HideProgressBarForPlayer(phealthmezzo[playerid]);
HideProgressBarForPlayer(phealthmalato[playerid]);
}
else if(health < 60 || health >= 30)
{
ShowProgressBarForPlayer(phealthmezzo[playerid]);
SetProgressBarValue(phealthmezzo[playerid]);
UpdateProgressBar(phealthmezzo[playerid], playerid);
HideProgressBarForPlayer(phealthsano[playerid]);
HideProgressBarForPlayer(phealthmalato[playerid]);
}
else if(health < 30)
{
ShowProgressBarForPlayer(phealthmalato[playerid]);
SetProgressBarValue(phealthmalato[playerid]);
UpdateProgressBar(phealthmalato[playerid], playerid);
HideProgressBarForPlayer(phealthsano[playerid]);
HideProgressBarForPlayer(phealthmezzo[playerid]);
}
}
}