Jump to content

Draw bug


Estevam2d

Recommended Posts

this is very fast and negative.

Is very fast and positive numbers become negative.

I'm desperate :oops: , I'm learning now draw.

If someone help me I will be very grateful.. :roll:

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

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

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