Timer on HUD.

Hey everyone, recently I’ve been trying to get a timer to display on the HUD, specifically a timer to respawn a dead player, after 3 seconds, using GM:PlayerDeathThink, and timer.Simple(). As an addition to this, I wanted to display my timer on a HUD, so it would draw a simple text saying “You will respawn in 3 second(s)”. I’ve tried several times to display the timer onto the HUD, but I have failed. Can someone please explain to me, how I can go about doing this, perhaps even provide some sample code to help me understand better?

Thank you in advance,
Bman.

You should really be using curtime for something like this.

[lua]
local mTimer = 0

function setTimer()
mTimer = CurTime() + 3 //This will set our mTimer 3 seconds after that the actual, so we can have a countdown
end

setTimer() //We call this function each time that we need to set the timer again, but you can set the var manually whenever you want

<-hudhook->

//This will be the var that we gonna use for draw, example by drawsimpletext
local textToDraw = math.Clamp(math.Round(mTimer-CurTime(),1),0,900) //We gonna use clamp for avoid drawing negative values
//Also we use math.Round for avoid showing values like 2.563342, so this will draw 2.6

<-hudhook->
[/lua]