Well I´m adding the gani to the players attributes whenever the player is hit (also changes the health than). And I made something like this in the gani
PHP Code:
SCRIPT
function onPlayerEnters() {
hideimgs(200, 201);
temp.pl = findplayer(player.account);
with (findimg(200)) {
x = player.x + 2/16;
y = player.y - 1.75;
image = "pirate_healthbar.png";
width = maxWidth;
height = maxHeight;
attachtoowner = true;
}
with (findimg(201)) {
x = player.x + 10/16;
y = player.y - 1.75 + 3/16;
image = "pirate_healthbar-progress.png";
width = getimgwidth(image);
height = getimgheight(image);
attachtoowner = true;
}
part=(pl.attr[28]/pl.attr[29])*findimg(201).width;
changeimgpart(201, findimg(201).width-part, 0, part, findimg(201).height);
settimer(3);
}
function onTimeOut() {
for (temp.i = 1; temp.i => 0; temp.i -= 0.01) {
changeimgcolors(200, i, i, i, i);
changeimgcolors(201, i, i, i, i);
sleep(0.05);
}
if (findimg(200).alpha == 0 || findimg(201).alpha == 0) player.attr[2] = "";
}
SCRIPTEND