Jump to content

Hex


Arsilex

Recommended Posts

Posted

How to getNameTagColor in hex ?

i have this

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 

function stats2 () 
    Tabla = guiCreateGridList(639,99,356,511,false) 
    guiSetAlpha(Tabla,0.69999998807907) 
    local column = guiGridListAddColumn( Tabla, "Players", 0.85 ) 
    if ( column ) then 
        for id, player in ipairs(getElementsByType("player")) do 
            local row = guiGridListAddRow ( Tabla ) 
            local r, g, b = getPlayerNametagColor(player) 
            local hex = RGBToHex(r, g, b) 
            guiGridListSetItemText ( Tabla, row, column, getPlayerName ( player ), false, false ) 
            guiGridListSetItemColor ( Tabla, row, column, getPlayerNametagColor ( player ) ) 
        end 
    end 
end 
addEventHandler ( "onIniciodePlayers", root, stats2 ) 

but i dont khnow how is to add Color to

guiGridListSetItemColor ( Tabla, row, column, getPlayerNametagColor ( player ) ) 

Posted

There's no need to unpack anything, getPlayerNametagColor returns the nick color in R, G, B ( 3 arguments ) the required for guiGridListSetItemColor, but what he wants is to use the HEX color in his nick instead of the nick color.

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