Jump to content

time jail


Estevam2d

Recommended Posts

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

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

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