Jump to content

time jail


Estevam2d

Recommended Posts

Posted

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.

Posted

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 ) 

Posted

You are creating timers every render, that's really inefficient, and useless.

What are you trying to do?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

350x20_FFFFFF_FFFFFF_000000_000000.png

http://i.imgur.com/CSE28MJ.png

Don't hesitate to contact me for anything! If I can help, I will for sure!

Education is the most powerful weapon which you can use to change the world. - Castillo

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