Arsilex Posted September 21, 2012 Share Posted September 21, 2012 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 ) ) Link to comment
Cadu12 Posted September 21, 2012 Share Posted September 21, 2012 guiGridListSetItemColor ( Tabla, row, column, unpack ( getPlayerNametagColor ( player ) ) ) Link to comment
Castillo Posted September 21, 2012 Share Posted September 21, 2012 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. Link to comment
Cadu12 Posted September 21, 2012 Share Posted September 21, 2012 With multi-codes color? If so, this is not possible, you have to make new custom gui. Link to comment
Castillo Posted September 21, 2012 Share Posted September 21, 2012 Multi-codes is not possible, indeed, maybe he wants to use just one color. Link to comment
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