Jump to content

Can Be ?


iPrestege

Recommended Posts

hi all , how are you , fine ? hmm i think about setButtonColor but i need it math.random (= Same SetLabelColor ! i dont know if i can do it or no -_-" but i try that but doesn,t work ! : :|:|

  
addEventHandler("onClientResourceStart", root, 
function() 
    setTimer(function() 
        for _, random in ipairs(getElementsByType('gui-button')) do 
            guiSetProperty(random, 'NormalTextColour', math.random(0, 255), math.random(0, 255), math.random(0, 255)) 
            guiSetFont(random, "default-bold-small") 
        end 
    end, 250, 0) 
end) 

:P

Link to comment

Maybe like that :? :

function RGBToHex(red, green, blue, alpha) 
        if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then 
                return nil 
        end 
        if(alpha) then 
                return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) 
        else 
                return string.format("#%.2X%.2X%.2X", red,green,blue) 
        end  
end 
  
for i, random in ipairs(getElementsByType("gui-button")) do 
guiSetProperty(random, 'NormalTextColour',RGBToHex(r,g,b)) 
end 

Link to comment
for i, random in ipairs(getElementsByType("gui-button")) do 
    guiSetProperty(random, 'NormalTextColour', string.format("%.2X%.2X%.2X%.2X", alpha, red, green, blue)) 
end 

Example for green color:

for i, random in ipairs(getElementsByType("gui-button")) do 
    guiSetProperty(random, 'NormalTextColour', string.format("%.2X%.2X%.2X%.2X", 255, 0, 255, 0)) 
end 

And your code:

addEventHandler("onClientResourceStart", resourceRoot, 
function() 
    setTimer(function() 
        for _, random in ipairs(getElementsByType('gui-button')) do 
            guiSetProperty(random, 'NormalTextColour', string.format("%.2X%.2X%.2X%.2X", 255, math.random(255), math.random(255), math.random(255))) 
            guiSetFont(random, "default-bold-small") 
        end 
    end, 250, 0) 
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...