Jump to content

Help - Counting Text


xXMADEXx

Recommended Posts

Posted

Hey guys, i have made this basic script, but i dont know how to make the dx text count.

function timerText() 
    dxDrawBorderedTitleText("Time Left: ", 0, 0, 1279, 65, tocolor(0, 255, 255, 255), 2, "default", "center", "center", false, false, true, false, false) 
end 
  
function startJailGUITimer(player,timer) 
    addEventHandler('onClientRender',root,timerText) 
    setTimer( 
        function () 
            removeEventHandler("onClientRender",root,timerText) 
        end, timer * 1000, 1 
    ) 
end 
addEvent("jail:startDxTimer",true) 
addEventHandler("jail:startDxTimer",root,startJailGUITimer) 

Posted
triggerServerEvent  
  

?

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted

This should do it my awesome friend,

function timerText() 
    dxDrawBorderedTitleText("Time Left: "..(timeLeft or 'BUGGED'), 0, 0, 1279, 65, tocolor(0, 255, 255, 255), 2, "default", "center", "center", false, false, true, false, false) 
end 
  
function startJailGUITimer(player,timer) 
    addEventHandler('onClientRender',root,timerText) 
    setTimer( 
        function () 
            removeEventHandler("onClientRender",root,timerText) 
        end, timer * 1000, 1 
    ) 
    timeLeft = timer 
    setTimer( 
        function() 
            timeLeft = timeLeft - 1 
        end, 1000, timer 
    ) 
end 
addEvent("jail:startDxTimer",true) 
addEventHandler("jail:startDxTimer",root,startJailGUITimer) 

Posted

You can also do it without any timers, which might decrease the chance of lag and timing out.

Just make a variable and make it increase itself and when it hits a certain amount, it will decrease the time variable. This might not work well on old machines since the rendering isn't working well over there, so the "timer" would be slow. Maybe if you implement a synchronization with the server, it could work out. But if you think you don't need to worry about any of these issues, go ahead and use timers.

If I helped you, please click the like button on the right ;) Thanks!

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