papam77 Posted July 11, 2013 Share Posted July 11, 2013 Hello how can get player color to label? I see in the label: EAG|#ffffffDeeJay I need to change the color as hex. Link to comment
فاّرس Posted July 11, 2013 Share Posted July 11, 2013 You cannot make this. But you can use : guiLabelSetColor Link to comment
papam77 Posted July 11, 2013 Author Share Posted July 11, 2013 I know about it, but it doesn't give me player color to the label Link to comment
Dealman Posted July 11, 2013 Share Posted July 11, 2013 You can do it like this; local namedRed, nameGreen, nameBlue = getPlayerNametagColor(thePlayer) Then use the variables along with guiLabelSetColor. guiLabelSetColor(labelVariable, nameRed, nameGreen, nameBlue) And you can then use this to get rid of the HEX Colour Code from the names; :gsub("#%x%x%x%x%x%x","") Link to comment
denny199 Posted July 11, 2013 Share Posted July 11, 2013 Use this function I don't know who made this function, just found it on the forums. function guiCreateColorLabel( ax, ay, bx, by,str, bool, parent ) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find( pat, 1 ) local last = 1 local r,g,b while s do if cap == "" and col then r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth( cap ) avc321 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) if not r then r = 255 end if not g then g = 255 end if not b then b = 255 end guiLabelSetColor( avc321,r,g,b ) ax = ax + w r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then local cap = str:sub( last ) local w = dxGetTextWidth( cap ) local avc123 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) guiLabelSetColor( avc123,r or 255,g or 255,b or 255 ) return avc123 end end 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