xXMADEXx Posted July 10, 2013 Posted July 10, 2013 Hi guys, so, i've never used "getTickCount()" before, and I hear its a lot better then using setTimer. I just have one problem.. The DX text will only show for 1 frame every second.. Im not really sure how to fix it either... local sx, sy = guiGetScreenSize ( ) local LastTick = 1000 addEventHandler ( "onClientRender", root, function ( ) local lc = getTickCount ( ) if ( lc-LastTick >= 1000 ) then dxDrawText ( lc, 0, 0, sx, sy, tocolor ( 202, 202, 202, 255 ), 3, "default-bold", "center", "center" ) LastTick = lc else return end end ) The Ultimate Lua Tutorial! | MTA PHP SDK
Castillo Posted July 10, 2013 Posted July 10, 2013 I don't really understand what do you mean. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Tete omar Posted July 10, 2013 Posted July 10, 2013 Shouldn't you define 2 getTickCount and compare them to get how much time has passed in ms?
Moderators IIYAMA Posted July 10, 2013 Moderators Posted July 10, 2013 local sx, sy = guiGetScreenSize ( ) local LastTick = 1000 local DXToRender = 0 addEventHandler ( "onClientRender", root, function ( ) local lc = getTickCount ( ) if ( lc-LastTick >= 1000 ) then LastTick = lc DXToRender = 30 end if DXToRender > 0 then dxDrawText ( lc, 0, 0, sx, sy, tocolor ( 202, 202, 202, 255 ), 3, "default-bold", "center", "center" ) DXToRender = DXToRender-1 end end ) You forgot to set how many frames it have to render. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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