Jump to content

Time color in DxText[Solved]


#RooTs

Recommended Posts

it is possible to manage color time?

from

pneDCBC.gif

to

mTpJKWO.gif

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 by Guest
Link to comment

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

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

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