PDA

View Full Version : [Killing Hud MONEY]



Rocky
9th November 2013, 06:01
Does somebody know how to put killing hud? When player kill somebody to hud show ex. +100,+200..

Thanks.

Jeplaa
9th November 2013, 06:28
make a hud on center with label +100 and call it on PlayerKilled

Rocky
9th November 2013, 07:13
showmoneyplus(money)
{
self notify("hud_restart");
self endon("disconnect");
self endon("hud_restart");
wait 0.05;
if(!isDefined(self.hud_money))
{
self.hud_money = newClientHudElem(self);
self.hud_money.horzAlign = "fullscreen";
self.hud_money.vertAlign = "fullscreen";
self.hud_money.alignX = "center";
self.hud_money.alignY = "top";
self.hud_money.x = 305;
self.hud_money.y = 20;
self.hud_money.fontscale = 2.0;
self.hud_money.color = (0,1,0);
self.hud_money.label = &"^3+&&1";
self.hud_money setValue(money);
self.hud_money.alpha=1;
wait 2;
self.hud_money fadeOverTime(1);
self.hud_money.alpha=0;
}
else
{
self.hud_money setValue(money);
self.hud_money.alpha=1;
wait 2;
self.hud_money fadeOverTime(1);
self.hud_money.alpha=0;
}
wait 1;
if(isDefined(self.hud_money))
self.hud_money destroy();

}

Like this?

Tally
9th November 2013, 08:26
untested:


showmoneyplus( money )
{
if( isDefined( self.hud_money ) )
self.hud_money destroy();

if( !isDefined( self.hud_money ) )
{
self.hud_money = newClientHudElem( self );
self.hud_money.horzAlign = "fullscreen";
self.hud_money.vertAlign = "fullscreen";
self.hud_money.alignX = "center";
self.hud_money.alignY = "top";
self.hud_money.x = 305;
self.hud_money.y = 20;
self.hud_money.fontscale = 2.0;
self.hud_money.color = (0,1,0);
self.hud_money.label = &"^3+ &&1";
self.hud_money.alpha = 0;
}

if( isDefined( self.hud_money ) )
{
self.hud_money setValue( money );
self.hud_money.alpha = 1;
self.hud_money fadeOverTime( 1 );
}

wait( 2 );

if( isDefined( self.hud_money ) )
{
self.hud_money fadeOverTime( 1 );
self.hud_money.alpha = 0;
}

if( isDefined( self.hud_money ) )
self.hud_money destroy();
}


WARNING - you cannot use placeholders (i.e. &&1, &&2, etc, etc) in a hud label. They don't work. Placeholders only work with iprintln/iprintlnBold.

So, this would be better and actually work:


showmoneyplus( money )
{
if( isDefined( self.hud_money ) )
self.hud_money destroy();

if( !isDefined( self.hud_money ) )
{
self.hud_money = newClientHudElem( self );
self.hud_money.horzAlign = "fullscreen";
self.hud_money.vertAlign = "fullscreen";
self.hud_money.alignX = "center";
self.hud_money.alignY = "top";
self.hud_money.x = 305;
self.hud_money.y = 20;
self.hud_money.fontscale = 2.0;
self.hud_money.color = (0,1,0);
self.hud_money.label = &"+ ";
self.hud_money.alpha = 0;
}

if( isDefined( self.hud_money ) )
{
self.hud_money setValue( money );
self.hud_money.alpha = 1;
self.hud_money fadeOverTime( 1 );
}

wait( 2 );

if( isDefined( self.hud_money ) )
{
self.hud_money fadeOverTime( 1 );
self.hud_money.alpha = 0;
}

if( isDefined( self.hud_money ) )
self.hud_money destroy();
}

IzNoGoD
9th November 2013, 08:29
Placeholders (only the &&1) work fine in a hud if you .label them with it AND the label is localized, aka it is in inside a .str file

Tally
9th November 2013, 08:38
Placeholders (only the &&1) work fine in a hud if you .label them with it AND the label is localized, aka it is in inside a .str file

Really? Are you sure? I have always understood that placeholders don't work in a HUD, even if you use a localized string label. In fact, (and it's been a few years since I experimented with HUD placeholders), my tests all those years ago always failed using them in a HUD.

Rocky
9th November 2013, 08:45
put it at callback playerkilled? (tally can u add me at xfire or i add you)

Tally
9th November 2013, 09:33
put it at callback playerkilled? (tally can u add me at xfire or i add you)

There is no point adding me, or me adding you. I only use XFire to make videos, very infrequently. I am never online.

IzNoGoD
9th November 2013, 11:08
Really? Are you sure? I have always understood that placeholders don't work in a HUD, even if you use a localized string label. In fact, (and it's been a few years since I experimented with HUD placeholders), my tests all those years ago always failed using them in a HUD.

I dont have any mod currently using it, but i think i succesfully put a settext(loc_string) or setvalue(val) in a .label(loc_label) where loc_label was something with &&1 in it (and not at the end)

Im currently using the &&1 as postfix in some mod, and it does NOT show up in the hud ("Money: &&1" becomes Money: 666 ingame after setvalue(666))