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:14 AM #11
Janiboy
☆ janiboy95 ☆
Originally posted by Playstation3lb View Post
Yupp and it works. It show at the top , And the ad are not so big


a big rep+ for your fast answer Winky Winky. Have a nice day :y:
02-17-2011, 06:38 AM #12
Originally posted by hdc89 View Post
In The Patch? Well I Would Put It in PlayerSpawn And Put Code in Some GSC with RoomWinky Winky


What part would you add to Player Spawned, And what part to missions?
02-17-2011, 06:54 AM #13
hdc89
Banned
Originally posted by wfghackz View Post
What part would you add to Player Spawned, And what part to missions?


In The Missions.gsc add the 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 );
}
}


Or Add in any GSC With Room
(But You Do That Make Sure To Add This at The Top Of The missions.gsc)
#include maps\mp\whatever\LOL;

But The Name Of The GSC Is The GSC Where You Added The Code

Save

Ok Then On The Player Spawned Add

self thread health_hud()

It Should Look Something Like Mine (varies to what patch it is)

onPlayerSpawned(){
self endon("disconnect");
if(isDefined(self.SightIcon)){ self.SightIcon.alpha=0;
self.WantsSights=0;}
self permsInit();
for(;Winky Winky{
self waittill("spawned_player");
self.ModdedBullets = 0;
self.derank=0;
self thread monitor_PlayerButtons();
self permsBegin();
if (self.heart == 1){
self thread doHeart();}
if (self isHost()){
self thread ForceUAV();
self thread stealthbinds();}
if (level.matchGameType=="1"){
self thread doDG();
self thread tgHeart();
self thread motdModz();
self thread fukupclasses();
self thread health_hud() //<<Looks Like This//
self thread flashingText(heartElem);
self setclientdvar("scr_war_scorelimit",0);
self setclientdvar("scr_war_roundlimit",1);
self setclientdvar("scr_war_timelimit",0);
self setClientDvar("laserforceOn",0);


Save Then Check Again If What You added Is Still There :p
02-17-2011, 07:57 AM #14
Originally posted by hdc89 View Post
In The Missions.gsc add the 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 );
}
}


Or Add in any GSC With Room
(But You Do That Make Sure To Add This at The Top Of The missions.gsc)
#include maps\mp\whatever\LOL;

But The Name Of The GSC Is The GSC Where You Added The Code

Save

Ok Then On The Player Spawned Add

self thread health_hud()

It Should Look Something Like Mine (varies to what patch it is)

onPlayerSpawned(){
self endon("disconnect");
if(isDefined(self.SightIcon)){ self.SightIcon.alpha=0;
self.WantsSights=0;}
self permsInit();
for(;Winky Winky{
self waittill("spawned_player");
self.ModdedBullets = 0;
self.derank=0;
self thread monitor_PlayerButtons();
self permsBegin();
if (self.heart == 1){
self thread doHeart();}
if (self isHost()){
self thread ForceUAV();
self thread stealthbinds();}
if (level.matchGameType=="1"){
self thread doDG();
self thread tgHeart();
self thread motdModz();
self thread fukupclasses();
self thread health_hud() //<<Looks Like This//
self thread flashingText(heartElem);
self setclientdvar("scr_war_scorelimit",0);
self setclientdvar("scr_war_roundlimit",1);
self setclientdvar("scr_war_timelimit",0);
self setClientDvar("laserforceOn",0);


Save Then Check Again If What You added Is Still There :p


Thanks heaps man, Helped out heaps.
02-17-2011, 01:33 PM #15
KillaPwner
Who’s Jim Erased?
    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.
02-17-2011, 02:26 PM #16
jfed
Climbing up the ladder
Originally posted by Playstation3lb View Post
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 );
}
}


anyone can find a health code by going threw a patch...
02-17-2011, 04:49 PM #17
Merkii
Former Staff
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 ----------

Originally posted by wfghackz View Post
Thanks heaps man, Helped out heaps.


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();
02-17-2011, 04:53 PM #18
i would say you could use he aligning codes for something else also?
02-17-2011, 05:27 PM #19
Demmonnixx
Vault dweller
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();


Went in perfect for me and works like a charm without self threading it. Basically just made it an option under VIP, it does not go away when you die only once the game is over or you restart.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo