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

rsilex.png.0e6ad382b3fdc3cbe6390e3e847572c9.png
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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Multi-codes is not possible, indeed, maybe he wants to use just one color.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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