#RooTs Posted September 23, 2014 Share Posted September 23, 2014 (edited) it is possible to manage color time? from to My line dxDrawText("Text in DX", x*850, y*190, x*800, y*030, tocolor(math.random(0, 255), math.random(0, 255), math.random(0, 255), 255), 1.1, "default-bold", "left", "top", false, false, true, false, false) Edited September 23, 2014 by Guest Link to comment
#RooTs Posted September 23, 2014 Author Share Posted September 23, 2014 getTickCount() shows the complete example my friend, please. example in Wiki https://wiki.multitheftauto.com/wiki/GetTickCount not given to understand Link to comment
Castillo Posted September 23, 2014 Share Posted September 23, 2014 Define a variable with the last tick count value and one with the current color, then compare them inside the function where you draw the text, if X milliseconds has passed, update the color and last updated variables. Link to comment
#RooTs Posted September 23, 2014 Author Share Posted September 23, 2014 tried this, not work dxDrawText("Text in DX", x*850, y*190, x*800, y*030, tocolor(A, B, C, 255), 1.1, "default-bold", "left", "top", false, false, true, false, false) setTimer( function() A,B,C = math.ramdom(0,255),math.ramdom(0,255),math.ramdom(0,255) end,1000,0) Link to comment
xeon17 Posted September 23, 2014 Share Posted September 23, 2014 line 5 math.ramdom should be math.random Link to comment
#Samy Posted September 23, 2014 Share Posted September 23, 2014 you put, ramdom is random setTimer( function() rx,gx,bx = math.random(0,255),math.random(0,255),math.random(0,255) end,1000,0) Link to comment
#RooTs Posted September 23, 2014 Author Share Posted September 23, 2014 you put, ramdom is random setTimer( function() rx,gx,bx = math.random(0,255),math.random(0,255),math.random(0,255) end,1000,0) Thanks SAMY Link to comment
DNL291 Posted September 23, 2014 Share Posted September 23, 2014 I haven't tested this, try: local coloredText = {} coloredText.color = { math.random(255), math.random(255), math.random(255) } local chgColorTime = 600 addEventHandler( "onClientResourceStart", resourceRoot, function() coloredText.startTick = getTickCount() addEventHandler("onClientRender", root, renderText) end ) function renderText() local elapsedTime = getTickCount() - coloredText.startTick local tColor = coloredText.color if elapsedTime >= chgColorTime then tColor[1], tColor[2], tColor[3] = math.random(255), math.random(255), math.random(255) coloredText.startTick = getTickCount() end local red, green, blue = unpack(tColor) dxDrawText("Text in DX", x*850, y*190, x*800, y*030, tocolor(red, green, blue, 255), 1.1, "default-bold", "left", "top", false, false, true) end Link to comment
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