Cxwh
Veteran
- Messages
- 64
- Reaction score
- 45
- Points
- 793
Last edited by a moderator:
I will take a look into this and update you shortly.Can someone hook me up with the code?
Here you go:Can someone hook me up with the code?
function func_Healthbar()
{
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;
if ( !isDefined( self.maxhealth ) || self.maxhealth <= 0 )
{
self.maxhealth = 100;
}
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 );
}
}
Thanks for the help!Here you go:
Code:function func_Healthbar() { 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; if ( !isDefined( self.maxhealth ) || self.maxhealth <= 0 ) { self.maxhealth = 100; } 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 ); } }
Credits
CabCon
Treyarch
Regards,
CabCon.