HUD Timers Please help or point me in the correct direction.

Hi guys.

I have been working with timers recently and got the hang of break,wait etc… But I want to add a timer count down on my hud now. If any of you know how to do it and wouldn’t mind giving an example bellow. That would be great! Or if you know a thread or site explaining ‘physical’ timers. Please don’t link with timers as I am using it… It doesn’t mention anything about physical timers as far as I can see.

I hope you guys can help me. First to help gets a cookie! :open_mouth:

What exactly do you mean? If you just want a simple timer that counts down, you can do something like

local startTime = CurTime()
and then in your hudpaint code just do

local timerTime = CurTime() - startTime
and then draw timerTime.

You can then reset startTime whenever, etc.

Ok what do you mean by draw timerTime? I cant seem to find that anywhere on the net or am I just derping?

timerTime is your variable, so where you’d use draw.SimpleText or something of the like, just use timerTime as the string to draw

Ok I am a tad lost with this. When I would lets say a ‘draw.simpleText’ where would I call upon the timerTime variable as you have the string ‘text’ then the string ‘front’ then the sizes and colours etc… After the draw.SimpleText(

I know this is a pain, but this is a new concept to me.

I tried this

draw.timerTime( “roundtime”,default, ScrW() / 2 - 70, ScrH() - 63, Color(225,225,225),TEXT_ALIGN_CENTER)

Then I tried this

draw.SimpleText( timerTime, “roundtime”,default, ScrW() / 2 - 70, ScrH() - 63, Color(225,225,225),TEXT_ALIGN_CENTER)

Or am I miss understanding what you are saying?

draw.SimpleText( string text, string font, number x, number y, Color color, number xAlign, number yAlign )[/lua]
draw.SimpleText( timerTime, “ScoreboardText”, ScrW()*0.5-70, ScrH()-63, Color( 255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )[/lua]
Remember: Multiplication is always faster than division.


I see thanks a lot it works great now ^^