![]() |
|
About Health Bar... - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: About Health Bar... (/Thread-About-Health-Bar.html) |
About Health Bar... - alistair3149 - 11-29-2010 Anyone tested these code? It is from MW2... Code: health_hud()
{
self endon( "disconnect" );
x = 80;
y = 40;
self.health_bar = NewClientHudElem( self );
self.health_bar.x = x + 80;
self.health_bar.y = y + 2;
self.health_bar.alignX = "left";
self.health_bar.alignY = "top";
self.health_bar.horzAlign = "fullscreen";
self.health_bar.vertAlign = "fullscreen";
self.health_bar.alpha = 1;
self.health_bar.foreground = 1;
self.health_bar setshader( "black", 1, 8 );
self.health_text = NewClientHudElem( self );
self.health_text.x = x + 80;
self.health_text.y = y;
self.health_text.alignX = "left";
self.health_text.alignY = "top";
self.health_text.horzAlign = "fullscreen";
self.health_text.vertAlign = "fullscreen";
self.health_text.alpha = 1;
self.health_text.fontScale = 1;
self.health_text.foreground = 1;
for ( ;; )
{
wait ( 0.05 );
width = self.health / self.maxhealth * 300;
width = int( max( width, 1 ) );
self.health_bar setShader( "black", width, 8 );
self.health_text SetValue( self.health );
}
}RE: About Health Bar... - 4FunPlayin - 11-29-2010 Yes it works.. RE: About Health Bar... - TheSaboteur - 11-30-2010 yhea but its ugly... an health bar has to be green RE: About Health Bar... - alistair3149 - 12-01-2010 (11-30-2010, 15:27)TheSaboteur Wrote: yhea but its ugly... an health bar has to be green I don't know how to change to color in here...I don't have the exact color no...But I hope this code may help: (I code it) Code: HealthBar()
{
useBar = createPrimaryProgressBar( -250 );
useBarText = createPrimaryProgressBarText( -250 );
useBarText settext("Health");
for(;;)
{
usebar updateBar( self.health/100, 100 );
if(self.health < 50 && self.health < 30 != true)
{
usebar.color = (0,0,0);
usebar.bar.color = (0.9,1,0);
useBarText settext("^3Injuried");
usebar.alpha = 0.5;
}
else if(self.health < 30)
{
usebar.color = (0,0,0);
usebar.bar.color = (1,0,0);
useBarText settext("^1Critical");
usebar.alpha = 1;
}
else if(self.health > 50)
{
usebar.color = (0,0,0);
usebar.bar.color = (0,1,0);
useBarText settext("^2Normal");
usebar.alpha = 0.5;
}
wait 0.05;
}
}RE: About Health Bar... - 4FunPlayin - 12-01-2010 lol gl with the coding To change back-bar idk2tell it something.color = (colorA,colorB,colorC); to change the bar itself something.bar.color (balbala) RE: About Health Bar... - TheSaboteur - 12-01-2010 u can only make black or i think also blue shaders to fill in the bar... RE: About Health Bar... - alistair3149 - 12-02-2010 (12-01-2010, 21:24)TheSaboteur Wrote: u can only make black or i think also blue shaders to fill in the bar...X is a number X,X,X is RGB color RE: About Health Bar... - TheSaboteur - 12-03-2010 (12-02-2010, 10:25)alistair3149 Wrote:(12-01-2010, 21:24)TheSaboteur Wrote: u can only make black or i think also blue shaders to fill in the bar...X is a number yes i was talking about the normal one... |