Does somebody know how to put killing hud? When player kill somebody to hud show ex. +100,+200..
Thanks.
Does somebody know how to put killing hud? When player kill somebody to hud show ex. +100,+200..
Thanks.
make a hud on center with label +100 and call it on PlayerKilled
Like this?Code: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(); }
untested:
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.PHP Code:
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();
}
So, this would be better and actually work:
PHP Code:
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();
}
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
randall (9th November 2013)
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.
put it at callback playerkilled? (tally can u add me at xfire or i add you)
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))