Post: [RELEASE] DISPLAY HEALTH ON SCREEN Code
02-16-2011, 10:03 PM #1
Dreamcather
Call me Eddie Winky Winky
(adsbygoogle = window.adsbygoogle || []).push({}); This Display your health on screen.

    
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 );
}
}
(adsbygoogle = window.adsbygoogle || []).push({});

The following 7 users say thank you to Dreamcather for this useful post:

Ada Wong, BuC-ShoTz, Fifa97, maxrox, wfghackz, xELiT3_Sn1PaXx, xNiicademus
02-17-2011, 06:00 PM #20
would this work for like a the health in zombies?

    
health_hud()
{

self endon( "disconnect" );

x = 80;
y = 40;

self.health_text = NewClientHudElem( self );
self.health_text.x = x - 20;
self.health_text.y = y;
self.health_text.alignX = "right";
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;
self.health_text.glow = 1;
self.health_text.glowColor = (1, 0, 0);

for ( ;; )
{
wait ( 0.05 );

width = self.health / self.maxhealth * 300;
width = int( max( width, 1 ) );

self.health_text SetValue( self.health );
}
}
02-17-2011, 07:00 PM #21
x-FuRY-x
< ^ > < ^ >
I'm using this in my GB patch :p (Obviously not really GB, but its fun to play around with it) And me and my mates have so much fun with it, thanks for the post
02-17-2011, 11:39 PM #22
!x-MONKEY-BOMB!
League Champion
setDvar ("cg_drawhealth ; 1"). Cod Dancing
02-18-2011, 12:57 AM #23
hdc89
Banned
Originally posted by MerkLovesToHack View Post
IT BASICly puts a bar on your screen when you get hit it deducts hp but the text is hidden underneath which is gay :c

---------- Post added at 04:49 PM ---------- Previous post was at 04:47 PM ----------



in the self thread health_hud you forgot the ; that will give syntax errors if you forget it
it would be this
self thread health_hud();


lol I Was In a Rush Sorry :p
02-18-2011, 02:50 AM #24
Originally posted by KillaPwner View Post
    health_hud()
{

self endon( "disconnect" );
self endon( "death" );
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 );
}
}


Now it should work. And you must call it in OnPlayerSpawned() or it will only work for the "life" you call the function.


Now where about in DT Blackrain, I cant find on player spawned() ???????? can you have alook and let me know
02-18-2011, 04:57 PM #25
KillaPwner
Who’s Jim Erased?
Originally posted by wfghackz View Post
Now where about in DT Blackrain, I cant find on player spawned() ???????? can you have alook and let me know


I never edited Blackrain, but i think you can put it in _missions.gsc, look with a text editor for the function onPlayerSpawned() and call it like
Originally posted by another user
self thread health_hud();
02-18-2011, 06:09 PM #26
malanof5
Error… Cat invasion!
Nice find its prob been in Zombieland but who knows but again nice find.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo