#RooTs Posted September 23, 2014 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
manve1 Posted September 23, 2014 Posted September 23, 2014 getTickCount() Looking for tutorials or information? check out: www.simpleask.co.uk
#RooTs Posted September 23, 2014 Author 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
Castillo Posted September 23, 2014 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
#RooTs Posted September 23, 2014 Author 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)
xeon17 Posted September 23, 2014 Posted September 23, 2014 line 5 math.ramdom should be math.random A unique GangWar gamemode waiting for you!Click here for more information.
#Samy Posted September 23, 2014 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)
#RooTs Posted September 23, 2014 Author 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
DNL291 Posted September 23, 2014 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 Please do not PM me with scripting related question nor support, use the forums instead.
DNL291 Posted September 23, 2014 Posted September 23, 2014 You're welcome. Please do not PM me with scripting related question nor support, use the forums instead.
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