Thread: Health bar
View Single Post
  #13  
Old 11-04-2011, 01:41 AM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
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.0;
  
this.drawing1 = {};
  
this.drawing2 = {};
  
hideimgs(2003000);
  for (
temp.pplayers) {
    
with (findimg(200 temp.i)) {
      
p.2/16;
      
p.1.75;
      
width getimgwidth(image);
      
height getimgheight(image);
      
image "pirate_healthbar.png";
    }
    
with (findimg(200 temp.i)) {
      
findimg(200 temp.i).8/16;
      
findimg(200 temp.i).3/16;
      
width getimgwidth(image);
      
height getimgheight(image);
      
image "pirate_healthbar-progress.png";
    }
    
this.drawing1.add({temp.p200 i});
    
this.drawing2.add({temp.p200 temp.i});
    
part=(p.attr[28]/temp.p.attr[29])*findimg(this.drawing2[1]).width;
    
changeimgpart(this.drawing2[1], findimg(this.drawing2[1]).width-part0partfindimg(this.drawing2[1]).height);
  }
  
temp.+= 2;
}

function 
updateInfo() {
  for (
temp.pplayers) {
    
with (findimg(this.drawing1[1])) {
      
p.2/16;
      
p.1.75;
    }
    
with (findimg(this.drawing2[1])) {
      
findimg(200 temp.i).8/16;
      
findimg(200 temp.i).3/16;
    }
    
part = (p.attr[28]/temp.p.attr[29])*findimg(this.drawing2[1]).width;
    
changeimgpart(this.drawing2[1], findimg(this.drawing2[1]).width-part0partfindimg(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?
__________________
MEEP!
Reply With Quote