Well I played around with that and got this:
PHP Code:
//#CLIENTSIDE
function onCreated() {
settimer(0.05);
}
function onPlayerEnters() {
this.lastsize = 0;
settimer(0.05);
}
function onTimeout() {
if (players.size() != this.lastsize) {
drawInfo();
this.lastsize = players.size();
}
else updateInfo();
setTimer(0.05);
}
function drawInfo() {
temp.i = 0;
this.drawing1 = {};
this.drawing2 = {};
hideimgs(200, 3000);
for (temp.p: players) {
with (findimg(200 + temp.i)) {
x = p.x + 2/16;
y = p.y - 1.75;
width = getimgwidth(image);
height = getimgheight(image);
image = "pirate_healthbar.png";
}
with (findimg(200 + 1 + temp.i)) {
x = findimg(200 + temp.i).x + 8/16;
y = findimg(200 + temp.i).y + 3/16;
width = getimgwidth(image);
height = getimgheight(image);
image = "pirate_healthbar-progress.png";
}
this.drawing1.add({temp.p, 200 + i});
this.drawing2.add({temp.p, 200 + 1 + temp.i});
part=(p.attr[28]/temp.p.attr[29])*findimg(this.drawing2[1]).width;
changeimgpart(this.drawing2[1], findimg(this.drawing2[1]).width-part, 0, part, findimg(this.drawing2[1]).height);
}
temp.i += 2;
}
function updateInfo() {
for (temp.p: players) {
with (findimg(this.drawing1[1])) {
x = p.x + 2/16;
y = p.y - 1.75;
}
with (findimg(this.drawing2[1])) {
x = findimg(200 + temp.i).x + 8/16;
y = findimg(200 + temp.i).y + 3/16;
}
part = (p.attr[28]/temp.p.attr[29])*findimg(this.drawing2[1]).width;
changeimgpart(this.drawing2[1], findimg(this.drawing2[1]).width-part, 0, part, findimg(this.drawing2[1]).height);
}
}
My problem is that it won´t update the progress and it´s only shown on one player.
How can I fix that?