Estevam2d Posted October 7, 2014 Share Posted October 7, 2014 how can I make a time jail server side? bandit arrested he can see the time left for him to leave the prison. Someone riding a script or pass me what I should use. Link to comment
n3wage Posted October 7, 2014 Share Posted October 7, 2014 addEvent triggerClientEvent setTimer getTimerDetails Event: onClientRender dxDrawText Link to comment
Estevam2d Posted October 7, 2014 Author Share Posted October 7, 2014 oh thank you, I will try. Link to comment
Estevam2d Posted October 8, 2014 Author Share Posted October 8, 2014 What is wrong, the time does not generate? the numbers are appearing one above the other, how to solve? function createText ( ) local seconds = 60 setTimer(function () seconds = seconds - 1 end ,1000 ,60) local sWidth,sHeight = guiGetScreenSize() local sw,sh = 1280,960 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) setTimer(function () dxDrawText("."..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 ,1000 ,60) end function HandleTheRendering ( ) addEventHandler ( "onClientRender", root, createText ) end addEvent( "onGreeting", true ) addEventHandler( "onGreeting", localPlayer, HandleTheRendering ) Link to comment
Estevam2d Posted October 8, 2014 Author Share Posted October 8, 2014 can someone help me? Link to comment
Castillo Posted October 8, 2014 Share Posted October 8, 2014 You are creating timers every render, that's really inefficient, and useless. What are you trying to do? Link to comment
Estevam2d Posted October 13, 2014 Author Share Posted October 13, 2014 Inform the prisoner how long was left for him to stay in jail. Is already solved. Link to comment
joaosilva099 Posted October 13, 2014 Share Posted October 13, 2014 This is what i use. function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end function draw() left, _, _ = getTimerDetails(jailt) lefts = math.round(left/1000) sx, sy = guiGetScreenSize() dxDrawText(lefts.." seconds remaining", sx*0.75, sy*0.9125, 765, 540, tocolor(255, 255, 255, 255), 2.10, "default-bold", "left", "top", false, false, true, false, false) end You must define jailt as a timer wich when ended will trigger the player out of jail. You should handle that with an onClientRender Event. 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