04.09.2013, 21:41
Hey gents,
Basically I'm working on a custom health system which should be having his own bar, I'm so far that I have my own bar and what I am trying to script is that the bar goes down when for example the health is 90, 80, 70 etc.. Although I've been scripting it but I am getting NO WAY to get it work so please help me out on this one.
Another attempt:
Thanks in advance! This has really been a pain in the ass for me and I do NOT understand why it is not working. :<
Basically I'm working on a custom health system which should be having his own bar, I'm so far that I have my own bar and what I am trying to script is that the bar goes down when for example the health is 90, 80, 70 etc.. Although I've been scripting it but I am getting NO WAY to get it work so please help me out on this one.
Код:
public OnPlayerSpawn(playerid)
{
new Bar:life = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 100.0);
ShowProgressBarForAll(life);
GetPlayerHealth(playerid,health);
if (health < 90.0)
{
SetProgressBarValue(life, 90.0);
UpdateProgressBar(life, playerid);
}
if (health < 80.0)
{
SetProgressBarValue(life, 80.0);
UpdateProgressBar(life, playerid);
}
if (health < 70.0)
{
SetProgressBarValue(life, 70.0);
UpdateProgressBar(life, playerid);
}
if (health < 60.0)
{
SetProgressBarValue(life, 60.0);
UpdateProgressBar(life, playerid);
}
if (health < 50.0)
{
SetProgressBarValue(life, 50.0);
UpdateProgressBar(life, playerid);
}
if (health < 40.0)
{
SetProgressBarValue(life, 40.0);
UpdateProgressBar(life, playerid);
}
if (health < 30.0)
{
SetProgressBarValue(life, 30.0);
UpdateProgressBar(life, playerid);
}
if (health < 20.0)
{
SetProgressBarValue(life, 20.0);
UpdateProgressBar(life, playerid);
}
if (health < 10.0)
{
SetProgressBarValue(life, 10.0);
UpdateProgressBar(life, playerid);
}
if (health < 5.0)
{
SetProgressBarValue(life, 0.0);
UpdateProgressBar(life, playerid);
}
return 1;
}
Код:
public OnPlayerSpawn(playerid)
{
new Bar:a = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 100.0);
new Bar:b = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 90.0);
new Bar:c = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 80.0);
new Bar:d = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 70.0);
new Bar:e = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 60.0);
new Bar:f = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 50.0);
new Bar:g = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 40.0);
new Bar:h = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 30.0);
new Bar:i = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 20.0);
new Bar:j = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 10.0);
new Bar:k = CreateProgressBar(547.00, 53.00, 59.50, 8.19, 1735555583, 5.0);
ShowProgressBarForAll(a);
GetPlayerHealth(playerid,health);
if (health < 90.0)
{
HideProgressBarForAll(a);
ShowProgressBarForAll(b);
UpdateProgressBar(b, playerid);
}
if (health < 80.0)
{
HideProgressBarForAll(b);
ShowProgressBarForAll©;
UpdateProgressBar(c, playerid);
}
if (health < 70.0)
{
HideProgressBarForAll©;
ShowProgressBarForAll(d);
UpdateProgressBar(d, playerid);
}
if (health < 60.0)
{
HideProgressBarForAll(d);
ShowProgressBarForAll(e);
UpdateProgressBar(e, playerid);
}
if (health < 50.0)
{
HideProgressBarForAll(e);
ShowProgressBarForAll(f);
UpdateProgressBar(f, playerid);
}
if (health < 40.0)
{
HideProgressBarForAll(f);
ShowProgressBarForAll(g);
}
if (health < 30.0)
{
HideProgressBarForAll(g);
ShowProgressBarForAll(h);
}
if (health < 20.0)
{
HideProgressBarForAll(h);
ShowProgressBarForAll(i);
}
if (health < 10.0)
{
HideProgressBarForAll(i);
ShowProgressBarForAll(j);
}
if (health < 5.0)
{
HideProgressBarForAll(j);
ShowProgressBarForAll(k);
}
return 1;
}

