Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About Health Bar...
#1
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 );
        }
}
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#2
Yes it works..
[Image: 1fxsnb.jpg]
Reply

#3
yhea but its ugly... an health bar has to be green
Reply

#4
(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;
        }
}
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#5
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)
[Image: 1fxsnb.jpg]
Reply

#6
u can only make black or i think also blue shaders to fill in the bar...
if you dig true the world... what comes up first your feet or your head ;qq
Reply

#7
(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
[Image: wyipjqo9qon7rc2v1lo.jpg]
Reply

#8
(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
X,X,X is RGB color

yes i was talking about the normal one...
if you dig true the world... what comes up first your feet or your head ;qq
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Request] Health and Points on hud source robinvm 7 5,590 10-27-2013, 08:23
Last Post: robinvm
Brick [Release] Health on HUD (no crash :D) xtreme2010 3 6,217 04-21-2013, 00:20
Last Post: CHRISLUVMSR
  [Release] Show player health on HUD [Z00MBY] Alex 18 13,401 02-03-2013, 00:48
Last Post: JariZ
  Health,regenerate, and message changes help mbakerinnv 4 3,491 11-02-2012, 18:12
Last Post: mbakerinnv
  Health and damage and custom comments mbakerinnv 1 2,007 11-01-2012, 15:09
Last Post: d0h!
  [Release] Health Icon (By Yamato) Rendflex 25 13,588 10-12-2012, 14:04
Last Post: momo5502
  Below 30% Max Health plugin worldclass 5 3,572 09-12-2012, 21:25
Last Post: worldclass
  [Release] Animated Health Bar from Minecraft Romuald27 2 4,458 07-22-2012, 18:44
Last Post: Romuald27
  Help: Edit Chopper health NooB_StalkeR 2 2,322 06-26-2012, 12:36
Last Post: NooB_StalkeR
  [Request] Survivor health pollarpart 9 5,157 06-20-2012, 15:46
Last Post: pollarpart

Forum Jump:


Users browsing this thread:
3 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.