PDA

View Full Version : HUD not working



EvoloZz
17th November 2012, 12:31
I wanted to make a HUD that would show some text on the bottom of the screen, but I dont seem to get it working

Here's where i precached it:

game["hud_text"] = &"RAndom TeXt";
precacheString(game["hud_text"]);


Under spawnPlayer() I have:

ShowText()
{
self endon("disconnect");
self endon("joined_spectators");

if(!isDefined(self.text_right))
{
self.text_right = newClientHudElem(self);
self.text_right.x = 249;
self.text_right.y = 471;
self.text_right.alignX = "left";
self.text_right.alignY = "middle";
self.text_right.sort = 1;
self.text_right.alpha = 1;
self.text_right.fontScale = 1.2;
self.text_right.archived = true;
self.text_right setText(game["hud_text"]);
}
}


Tell me if something is wrong, again I say that I am newb :D

~EvoloZz

kung foo man
17th November 2012, 13:10
You called ShowText()?

EvoloZz
17th November 2012, 15:32
You called ShowText()?

The problem was so simple, thanks :D

Tally
17th November 2012, 16:36
1 more thing - don't use endon() unless there is a wait time of some sorts: either wait( time ) or waittill( event ). The use of endon() uses up script variables, and when you hit the limit, it will shut down your server.

IzNoGoD
17th November 2012, 18:23
Usage will be cleared at the end of the function, which is very very soon :) (cause no waits)