//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]);
}
}
}
//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) || health >= 0)
{
ShowProgressBarForPlayer(phealthmalato[playerid]);
SetProgressBarValue(phealthmalato[playerid]);
UpdateProgressBar(phealthmalato[playerid], playerid);
HideProgressBarForPlayer(phealthsano[playerid]);
HideProgressBarForPlayer(phealthmezzo[playerid]);
}
}
}
I don't see anything wrong, But try this
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) && health >= 0)
{
ShowProgressBarForPlayer(phealthmalato[playerid]);
SetProgressBarValue(phealthmalato[playerid]);
UpdateProgressBar(phealthmalato[playerid], playerid);
HideProgressBarForPlayer(phealthsano[playerid]);
HideProgressBarForPlayer(phealthmezzo[playerid]);
}
}
}