Jump to content

Why not working setTimer?


Turbe$Z

Recommended Posts

Posted (edited)
local countdown = 120
		G3 = guiCreateLabel(0.49, 0.67, 0.03, 0.02, tostring(countdown).." mp", true)
        guiSetFont(G3, "default-bold-small")    
		guiSetVisible(G3,false)

addEventHandler("onClientGUIClick",root,
	function ()
	if source == buttonGuest then
	removeEventHandler("onClientRender",root,a123)
	addEventHandler("onClientRender", root, dxhavendeg)
	guiSetVisible(buttonLogin,false)
	guiSetVisible(buttonRegister,false)
	guiSetVisible(buttonGuest,false)
	guiSetVisible(editPassword,false)
	guiSetVisible(editUsername,false)
setTimer(function () 
	countdown = countdown - 1 
	if countdown >= 0 then 
		guiSetText(G3, tostring(countdown)) 
	else 
		outputChatBox("asd")
	end 
end, 120000, 1000) 
	end
end
)

what wrong? :'( 

Edited by Turbo777
Posted (edited)
28 minutes ago, Turbo777 said:

end, 120000, 1000)

replace 1000 with 0 cuz there no such thing

0*

Edited by #BrosS
Posted
Just now, Turbo777 said:

but still not working :S 

setTimer(function () 
	countdown = countdown - 1 
	if countdown >= 0 then 
		guiSetText(G3, tostring(countdown)) 
	else 
		outputChatBox("asd")
	end 
end, 1000, 0) 

 

  • Like 1
Posted
1 minute ago, #BrosS said:

setTimer(function () 
	countdown = countdown - 1 
	if countdown >= 0 then 
		guiSetText(G3, tostring(countdown)) 
	else 
		outputChatBox("asd")
	end 
end, 1000, 0) 

 

the counter does not countdown :S 

sorry for my bad English:c

Posted
local countdown = 120
		G3 = guiCreateLabel(0.49, 0.67, 0.03, 0.02, tostring(countdown).." mp", true)
        guiSetFont(G3, "default-bold-small")    
		guiSetVisible(G3,false)

addEventHandler("onClientGUIClick",root,
	function (button, state)
	if button == "left"and state=="up" and source == buttonGuest then
	removeEventHandler("onClientRender",root,a123)
	addEventHandler("onClientRender", root, dxhavendeg)
	guiSetVisible(buttonLogin,false)
	guiSetVisible(buttonRegister,false)
	guiSetVisible(buttonGuest,false)
	guiSetVisible(editPassword,false)
	guiSetVisible(editUsername,false)
setTimer(function () 
	countdown = countdown - 1 
	if countdown >= 0 then 
		guiSetText(G3, tostring(countdown)) 
	else 
		outputChatBox("asd")
	end 
end, 1000, 0) 
	end
end
)

try see if that work

  • Like 1
Posted
4 minutes ago, Turbo777 said:

the counter does not countdown :S 

sorry for my bad English:c

no it's working and i just tested it

try again with my code

  • Moderators
Posted
end, 1000, countdown) 

I do recommend this. There is no need for an infinity timer since you already know that it is going to stop at 0.

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