Jump to content

setTimer stays the same


rusztamas

Recommended Posts

Code:

function koth_Csatlakozas()
end

function koth_Idozito()
idozito = setTimer (function()
	end,
	60000,
	1)
end
addEvent ("koth_Idozito", false)
addEventHandler ("koth_Idozito", getRootElement(), koth_Idozito)

function koth_DxJelzes()
	local sX, sY = 1366, 768 -- sajátX, sajátY
	local jX, jY = guiGetScreenSize() -- játékosX, játékosY
	triggerEvent ("koth_Idozito", localPlayer)
	local idozitostatusz = tostring(getTimerDetails(idozito))
	local dxrectangle = dxDrawRectangle (570/sX*jX, 25/sY*jY, 250/sX*jX, 20/sY*jY, tocolor (0, 0, 0, 150))
	local dxtimer = dxDrawRectangle (575/sX*jX, 30/sY*jY, 240*idozitostatusz/60000/sX*jX, 10/sY*jY, tocolor (255, 255, 255, 200))
	outputChatBox (idozitostatusz)

end
addEventHandler ("onClientRender", getRootElement(), koth_DxJelzes)

Simple DX hud, and it would display how many time left from a match. No errors, but the timer stays the same, it outputs the chatbox 60000. It should be like 6000, 59000 and else. Why isn't the timer going? (This is just a little piece of the script, it's unfinished.)

Fixed!
Problem was:

the function triggerer was inside an event "onClientRender", so it was "looping" for ever.

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...