Jump to content

Timer


iLimix

Recommended Posts

how can i get Timer from 05:00 Minute to 00:00 in dxDraw

Example:
 

    dxDrawText(ladezeit.."%", 1130*(x/1400), 244*(y/900), 1342*(x/1400), 269*(y/900), tocolor(255, 255, 255, 255), 3.00, "default-bold", "center", "center", false, false, false, false, false)

function ladeBalken()
	setTimer(function()
		ladezeit=ladezeit+1
		if(ladezeit==100)then
			removeEventHandler("onClientRender",root,dxLadebalken)
			ladezeit=0
		end
	end,50,100)
	addEventHandler("onClientRender",root,dxLadebalken)
end--0.00006
addEvent("ladeBalken",true)
addEventHandler("ladeBalken",root,ladeBalken)

 

Link to comment
local leftTimer = setTimer(function() end, 60000*5, 1)
local timeLeft = getTimerDetails(leftTimer)
local timeLeft = timeLeft/1000
local minLeft = math.floor(timeLeft/60)
local secLeft = timeLeft % 60
local timeText = string.format("%02d", minLeft) .. ":" .. string.format("%02d", secLeft)

Try it like this.

Link to comment

thx he show me ingame 05:00 But he does not count down

	local leftTimer = setTimer(function() end, 60000*5, 1)
	local timeLeft = getTimerDetails(leftTimer)
	local timeLeft = timeLeft/1000
	local minLeft = math.floor(timeLeft/60)
	local secLeft = timeLeft % 60
	local timeText = string.format("%02d", minLeft) .. ":" .. string.format("%02d", secLeft)
	    dxDrawText(timeText.."%", 1130*(x/1400), 244*(y/900), 1342*(x/1400), 269*(y/900), tocolor(255, 255, 255, 255), 3.00, "default-bold", "center", "center", false, false, false, false, false)

 
Link to comment
  • Administrators

yes but you would still at the least need a timer to update the label every second. You might aswell just use dxDrawText in onClientRender - imo its the best way

Edited by LopSided_
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...