• Scoreboard Name Color Not Working
    6 replies, posted
I run a TTT server, and for some reason the names on the scoreboard will not work. I have tried manually putting in the RGB codes for the names, but nothing works. For some reason, the ULX yellow still shows up on the names for admins, along with the rainbow function showing up on the names for VIPs. I'll post the code and screenshots below. [LUA] EZS = {} -- what's one more global to the fray EZS.Ranks = {} --[[ CONFIG ]]-- EZS.Enabled = true -- you can set a silkicon to be used, by adding a "icon" field. for example: icon = "heart" will be drawn as "icon16/heart.png" -- for a full list of silkicons, go to [url]http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png[/url] --EZS.Ranks["rank OR steamid"] = { name = "displayname", color = RankColor, namecolor = (optional), admin = are they admin? (true/false) } EZS.Ranks["regular"] = { name = "Regular", color = Color( 128, 128, 128), namecolor = Color( 128, 128, 128), admin = false } EZS.Ranks["member"] = { name = "Member", color = Color( 51, 153, 255), namecolor = Color( 51, 153, 255), admin = false } EZS.Ranks["vip"] = { name = "VIP", color = ("rainbow") , admin = false } EZS.Ranks["operator"] = { name = "Operator", color = Color( 215, 183, 24 ), namecolor = Color( 215, 183, 24 ), admin = false } EZS.Ranks["admin"] = { name = "Admin", color = Color( 247, 25, 62), namecolor = Color( 247, 25, 62), admin = true } EZS.Ranks["highadmin"] = { name = "High Admin", color = Color( 0, 255, 64), namecolor = Color( 0, 255, 64), admin = true } EZS.Ranks["[highadmin]"] = { name = "Member", color = Color( 51, 153, 255), namecolor = Color( 51, 153, 255), admin = true } EZS.Ranks["headadmin"] = { name = "Head Admin", color = Color( 218, 109, 0), namecolor = Color( 218, 109, 0), admin = true } EZS.Ranks["servermanager"] = { name = "Server Manager", color = Color( 0, 255, 255), namecolor = Color( 0, 255, 255), admin = true } EZS.Ranks["generalmanager"] = { name = "General Manager", color = Color( 204, 0, 0), namecolor = Color( 204, 0, 0), admin = true } EZS.Ranks["owner"] = { name = "Owner", color = Color( 0, 0, 0), namecolor = Color( 0, 0, 0), admin = true } EZS.Ranks["superadmin"] = { name = "Member", color = Color( 51, 153, 255), namecolor = Color( 51, 153, 255), admin = true } EZS.Ranks["downy"] = { name = "Downy", color = Color( 24, 151, 14 ), namecolor = Color( 24, 151, 14 ), admin = false } EZS.Ranks["trusted"] = { name = "Trusted", color = Color( 54, 94, 255 ), namecolor = Color( 54, 94, 255 ), admin = false } -- label enable on the top? what should it say? EZS.CreateRankLabel = { enabled = true, text = "Rank" } -- what to show when the player doesnt have an entry EZS.DefaultLabel = "" -- sadly there is no way to shift the background bar over as TTT draws it manually :c EZS.HideBackground = false -- Width of the rank columns EZS.ColumnWidth = 50 -- the number of columns (not pixels!!!!!!!) to shift to the left EZS.ShiftLeft = 0 -- shift tags, search marker, etc how much? (IN PIXELS) EZS.ShiftOthers = 200 -- Show icon as well as rank text? (if possible) EZS.ShowIconsWithRanks = false -- How far left should we shift the icon relative to the rank text? EZS.ShiftRankIcon = 1 -- should we color the names? EZS.UseNameColors = true -- if there is no name color set, should we use the rank color? EZS.DefaultNameColorToRankColor = true -- should names get dynamic (changing) color? EZS.AllowNamesToHaveDynamicColor = true EZS.DynamicColors = {} EZS.DynamicColors.rainbow = function( ply ) local frequency, time = .5, RealTime() local red = math.sin( frequency * time ) * 127 + 128 local green = math.sin( frequency * time + 2 ) * 127 + 128 local blue = math.sin( frequency * time + 4 ) * 127 + 128 return Color( red, green, blue ) end EZS.RightClickFunction = { enabled = true, ask_admins = true, functions = { ["User Functions"] = { ["Show Profile"] = function( ply ) ply:ShowProfile() end, ["Copy SteamID"] = function( ply ) SetClipboardText( ply:SteamID() ) chat.AddText( color_white, ply:Nick() .. "'s SteamID (", Color( 200, 200, 200 ), ply:SteamID(), color_white, ") copied to clipboard!" ) end, _icon = "icon16/group.png", }, ["Admin Functions"] = { { ["Kick"] = { func = function( ply ) RunConsoleCommand( "ulx", "kick", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/user_delete.png" }, ["Slay"] = { func = function( ply ) RunConsoleCommand( "ulx", "slay", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/pill.png" }, }, { ["Mute"] = { func = function( ply ) RunConsoleCommand( "ulx", "mute", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/pill.png" }, ["Un-Mute"] = { func = function( ply ) RunConsoleCommand( "ulx", "unmute", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/pill.png" }, }, { ["Gag"] = { func = function( ply ) RunConsoleCommand( "ulx", "gag", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/sound_mute.png" }, ["Un-Gag"] = { func = function( ply ) RunConsoleCommand( "ulx", "ungag", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/sound.png" }, }, { ["Goto"] = { func = function( ply ) RunConsoleCommand( "ulx", "goto", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/sound_mute.png" }, ["Bring"] = { func = function( ply ) RunConsoleCommand( "ulx", "bring", ply:Nick():gsub( ";", "" ) ) end, icon = "icon16/sound.png" }, }, _icon = "icon16/shield.png", } } } hook.Run( "EZS_AddRightClickFunction", EZS.RightClickFunction.functions ) --[[ END CONFIG ]]-- for id, rank in pairs( EZS.Ranks ) do if rank.icon then rank.iconmat = Material( ("icon16/%s.png"):format( rank.icon ) ) end rank.dynamic_col = isstring( rank.color ) rank.dynamic_namecol = isstring( rank.namecolor ) end local function RealUserGroup( ply ) if ply.EV_GetRank then return ply:EV_GetRank() end return ply:GetUserGroup() end function EZS.GetRank( ply ) return EZS.Ranks[ply:SteamID()] or EZS.Ranks[RealUserGroup( ply )] end function EZS.Dynamic( rank, ply ) return (EZS.DynamicColors[rank.color] or EZS.DynamicColors.rainbow)( ply ) end function EZS.HandleShift( sb ) if EZS.ShiftLeft < 1 then return end local function ShiftLeft( parent ) local k = EZS.HideBackground and 6 or 5 local p = parent.cols[k] if not p then return end local shift = EZS.HideBackground and 1 or 0 local karma = KARMA.IsEnabled() and 0 or 1 local left = ( 5 - karma ) - EZS.ShiftLeft local posx, posy = p:GetPos() local mod = ( 50 * ( ( left + shift ) - #parent.cols ) ) p:SetPos( posx + mod, posy ) end if sb.ply_groups then -- sb_main local OldPerformLayout = sb.PerformLayout sb.PerformLayout = function( s ) OldPerformLayout( s ) ShiftLeft( s ) end else -- sb_row local OldLayoutColumns = sb.LayoutColumns sb.LayoutColumns = function( s ) OldLayoutColumns( s ) ShiftLeft( s ) EZS.HandleTags( s ) end end end function EZS.HandleTags( sb ) if EZS.ShiftOthers <= 0 then return end -- copy some from base local cx = sb:GetWide() - 90 for k,v in ipairs(sb.cols) do cx = cx - v.Width end sb.tag:SizeToContents() sb.tag:SetPos((cx - sb.tag:GetWide()/2) - EZS.ShiftOthers, (SB_ROW_HEIGHT - sb.tag:GetTall()) / 2) sb.sresult:SizeToContents() sb.sresult:SetPos((cx - 8)-EZS.ShiftOthers, (SB_ROW_HEIGHT - 16) / 2) end function EZS.AddSpacer( w ) EZS.Scoreboard:AddColumn( "", function() return "" end, w or 0 ) end function EZS.AddRankLabel( sb ) EZS.Scoreboard = sb local heading = EZS.CreateRankLabel.enabled and EZS.CreateRankLabel.text or "" local function AttachDynamicColor( label, ply ) label.HasRainbow = true label.Think = function( s ) if not IsValid( ply ) then return end local rank = EZS.GetRank( ply ) if not rank then s:SetTextColor( color_white ) return end if not rank.dynamic_col then s:SetTextColor( rank.color ) else s:SetTextColor( EZS
That doesn't make sense.... Nothing is hooking EZS.AddNameColor - the line is just missing?? Download the newest version from github and see if that works.
I just downloaded the newest version from Github, and the problem is still there. No name color, but the admin yellow name still shows up. EDIT - After I restarted the server, the rank column disappeared completely.
Are there any errors in the console? What version of TTT are you running?
I ended up restarting the server, and the ranks work perfectly fine, including the name color. I have no fucking clue what really happened, but it worked. Thanks!
I have another problem, however. For some reason, the tags reset after the map changes. Is there a way to make the tags permanent?
Bump.
Sorry, you need to Log In to post a reply to this thread.