Making a visible timer

In my gamemode, when someone dies the rest of the players have 5 mins left to play then the map changes.

I don’t have the skill to draw, say a block with digital time that counts down from 5 mins to 0 seconds left.

Any help would be appreciated

HELP
I really need this

ok first of all you want to make a timer use

then your going to want to start it

and your going to want to

to draw the text and im not 100 percent on reading how long the timer has been on someone will have to tell you that

Use CurTime() for the countdown.

Serverside:
[lua]hook.Add(“PlayerDeath”,“startTimer”,function()
if not timer.Exists(“mapChange”) then
timer.Create(“mapChange”,300,1,function()
game.ConsoleCommand(“changelevel somewhere”)
end)
datastream.StreamToClients(player.GetAll(),“startTimer”,CurTime())
end
end)

hook.Add(“Think”,“sendTimer”,function()
if timer.Exists(“mapChange”) then
umsg.Start(“sendTimer”,RecipientFilter():AddAllPlayers())
umsg.Short(CurTime())
umsg.End()
end
end)[/lua]

Clientside:
[lua]
local shouldDraw = false
local startcur = 0
local endcur = 0
datastream.Hook(“startTimer”,function(hand,id,enc,dec)
shouldDraw = true
startcur = dec
end)
usermessage.Hook(“sendTimer”,function(um) endcur = um:ReadShort() end)

hook.Add(“HUDPaint”,“drawTimer”,function()
if shouldDraw == true then
draw.DrawText(startcur+300-endcur,“Default”,3,3,Color(255,255,255),0)
end
end)[/lua]

Untested, but it’s the essence of what you want.

Thank you!

[lua]if SERVER then
hook.Add(“PlayerDeath”,“startTimer”,function()
if timer.IsTimer"mapChange" then return end
timer.Create(“mapChange”,30,1,function()
game.ConsoleCommand"changelevel somewhere"
end)
SetGlobalFloat(“mapChange”,CurTime() + 30)
end)
SetGlobalFloat(“mapChange”,0)
else
hook.Add(“HUDPaint”,“drawTimer”,function()
local change = (GetGlobalFloat"mapChange" or 0) - CurTime()
if change > 0 then
draw.DrawText(string.ToMinutesSeconds(change),“ScoreboardText”,ScrW()/2,ScrH()/2,Color(255,255,255,255),1)
end
end)
end[/lua]
Involves far less pointless networking and provides a nicer output.

You’re sending usermessages in a think hook when CurTime returns the same number on the server and the client.