Estevam2d Posted October 8, 2014 Share Posted October 8, 2014 this is very fast and negative. Is very fast and positive numbers become negative. I'm desperate , I'm learning now draw. If someone help me I will be very grateful.. if seconds = 0 then removeEventHandler("onClientRender",root, createText) end -- Not working; If I remove back up and running local seconds = 500 function createText ( ) setTimer(function () seconds = seconds - 1 if seconds = 0 then removeEventHandler("onClientRender",root, createText) end -- Not working; If I remove back up and running end ,1000 , seconds) local sWidth,sHeight = guiGetScreenSize() local sw,sh = 1280,960 dxDrawText("Saira em:", 200/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) dxDrawText(""..seconds.."", 800/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", localPlayer, HandleTheRendering ) Link to comment
manawydan Posted October 8, 2014 Share Posted October 8, 2014 change if seconds = 0 to if seconds == 0 Link to comment
n3wage Posted October 8, 2014 Share Posted October 8, 2014 Stop Creating Multiple Topics... Try This: Timers = {} sWidth,sHeight = guiGetScreenSize() sw,sh = 1280,960 function JailPlayerC (sec) local seconds = tonumber(sec) or 10 local plr = source or localPlayer Timers[plr] = setTimer ( unJail, seconds *1000, 1, plr ) addEventHandler ( "onClientRender", root, renderTime ) end addEvent ( "jailC", true ) addEventHandler ( "jailC", root, JailPlayerC ) -- function renderTime () if Timers[localPlayer] and isTimer(Timers[localPlayer]) then local seconds = getTimerDetails(Timers[localPlayer]) /1000 or "?" dxDrawText("Saira em:", 500/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) dxDrawText(math.floor(seconds).." Segundos", 800/sw*sWidth, 844/sh*sHeight, 1215/sw*sWidth, 905/sh*sHeight, tocolor(195, 195, 195, 255), 2.30, "pricedown", "left", "top", false, false, true, false, false) end end function unJail (plr) if Timers[plr] and isTimer(Timers[plr]) then Timers[plr] = nil removeEventHandler ( "onClientRender", root, renderTime ) end end function testt (seconds) -- Test Function JailPlayerC (30) outputChatBox ( "* Jailed for 30 Seconds", 0, 255, 0 ) end addCommandHandler ( "jail", testt, false, false ) In Server Script Use: triggerClientEvent ( player, "jailC", player, seconds ) -- player: player who will be arrested Use the command /jail to test. Link to comment
Estevam2d Posted October 8, 2014 Author Share Posted October 8, 2014 Thank you, promise I'll stop it ... you guys helped me a lot I am happy now. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now