Completely Stomped. Halp?

So I’m completely stomped here. I realized that I’m doing this completely wrong but I have no idea how to fix it. Basically, what I want to happen:

( To lessen confusion, Player X is a VIP Client. )

  1. Player X sets a certain Color he wants his name on the scoreboard to be…
  2. His name shows up as that color for everyone

What really happens:

  1. Player X sets a certain Color he wants his name on the scoreboard to be…
  2. For every other VIP Client that has this feature enabled, that his name is the color of what Player X set for HIS name to be…

I have no idea how to fix this, can anyone help? Here’s the full code:

[lua]
---- Scoreboard player score row, based on sandbox version

include(“sb_info.lua”)

local GetTranslation = LANG.GetTranslation
local GetPTranslation = LANG.GetParamTranslation

SB_ROW_HEIGHT = 24 --16

local PANEL = {}

function PANEL:Init()
– cannot create info card until player state is known
self.info = nil

self.open = false

self.cols = {}
self.cols[1] = vgui.Create(“Label”, self)
self.cols[1]:SetText(GetTranslation(“sb_ping”))

self.cols[2] = vgui.Create(“Label”, self)
self.cols[2]:SetText(GetTranslation(“sb_deaths”))

self.cols[3] = vgui.Create(“Label”, self)
self.cols[3]:SetText(GetTranslation(“sb_score”))

if KARMA.IsEnabled() then
self.cols[4] = vgui.Create(“Label”, self)
self.cols[4]:SetText(GetTranslation(“sb_karma”))
end

for _, c in ipairs(self.cols) do
c:SetMouseInputEnabled(false)
end

self.tag = vgui.Create(“Label”, self)
self.tag:SetText("")
self.tag:SetMouseInputEnabled(false)

self.sresult = vgui.Create(“DImage”, self)
self.sresult:SetSize(16,16)
self.sresult:SetMouseInputEnabled(false)

self.avatar = vgui.Create( “AvatarImage”, self )
self.avatar:SetSize(SB_ROW_HEIGHT, SB_ROW_HEIGHT)
self.avatar:SetMouseInputEnabled(false)

self.nick = vgui.Create(“Label”, self)
self.nick:SetMouseInputEnabled(false)

self:SetCursor( “hand” )
end

local glow = math.abs(math.sin(CurTime() * 2) * 255); – Math stuff for flashing.
local flashingRed = Color(glow, 0, 0, 255); – This flashes red.
local flashingGreen = Color(0, glow, 0); – This flashes green.
local flashingBlue = Color(0, 0, glow); – This flashes blue.

local namecolor = {
default = COLOR_WHITE,
admin = Color(220, 180, 0, 255),
dev = flashingRed,
red = Color( 255, 0, 0, 255 ),
blue = Color( 0, 0, 255, 255 ),
green = Color( 0, 255, 0, 255 ),
purple = Color( 148, 0, 211, 255 )
};

function GM:TTTScoreboardColorForPlayer(ply)
if not IsValid(ply) then return namecolor.default end

if ply:IsAdmin() and GetGlobalBool("ttt_highlight_admins", true) then
	return namecolor.admin
elseif ( ply:EV_IsVip() or ply:EV_IsOwner() ) and ply:GetInfoNum( "ttt_scoreboard_color" ) == 1 then
	return Color( ply:GetInfoNum( "ttt_scoreboard_colorr", 255 ), ply:GetInfoNum( "ttt_scoreboard_colorg", 255 ), ply:GetInfoNum( "ttt_scoreboard_colorb", 255 ), 255 )
end

return namecolor.default
end

local function ColorForPlayer(ply)
if IsValid(ply) then
local glow = math.abs(math.sin(CurTime() * 2) * 255); – Math stuff for flashing.
local flashingRed = Color(glow, 0, 0, 255); – This flashes red.
local flashingGreen = Color(0, glow, 0); – This flashes green.
local flashingBlue = Color(0, 0, glow); – This flashes blue.
local c = hook.Call(“TTTScoreboardColorForPlayer”, GAMEMODE, ply)

  -- verify that we got a proper color
  if c and type(c) == "table" and c.r and c.b and c.g and c.a then
     return c
  else
     ErrorNoHalt("TTTScoreboardColorForPlayer hook returned something that isn't a color!

")
end
end
return namecolor.default
end

function PANEL:Paint()
if not ValidEntity(self.Player) then return end

– if ( self.Player:GetFriendStatus() == “friend” ) then
– color = Color( 236, 181, 113, 255 )
– end

local ply = self.Player

if ply:IsTraitor() then
surface.SetDrawColor(255, 0, 0, 30)
surface.DrawRect(0, 0, self:GetWide(), SB_ROW_HEIGHT)
elseif ply:IsDetective() then
surface.SetDrawColor(0, 0, 255, 30)
surface.DrawRect(0, 0, self:GetWide(), SB_ROW_HEIGHT)
end

if ply == LocalPlayer() then
surface.SetDrawColor( 200, 200, 200, math.Clamp(math.sin(RealTime() * 2) * 50, 0, 100))
surface.DrawRect(0, 0, self:GetWide(), SB_ROW_HEIGHT )
end

return true
end

function PANEL:SetPlayer(ply)
self.Player = ply
self.avatar:SetPlayer(ply)

if not self.info then
local g = ScoreGroup(ply)
if g == GROUP_TERROR and ply != LocalPlayer() then
self.info = vgui.Create(“TTTScorePlayerInfoTags”, self)
self.info:SetPlayer(ply)

     self:InvalidateLayout()
  elseif g == GROUP_FOUND or g == GROUP_NOTFOUND then
     self.info = vgui.Create("TTTScorePlayerInfoSearch", self)
     self.info:SetPlayer(ply)
     self:InvalidateLayout()
  end

else
self.info:SetPlayer(ply)

  self:InvalidateLayout()

end

self:UpdatePlayerData()
end

function PANEL:GetPlayer() return self.Player end

function PANEL:UpdatePlayerData()
if not IsValid(self.Player) then return end

local ply = self.Player
self.cols[1]:SetText(ply:Ping())
self.cols[2]:SetText(ply:Deaths())
self.cols[3]:SetText(ply:Frags())

if self.cols[4] then
self.cols[4]:SetText(math.Round(ply:GetBaseKarma()))
end

self.nick:SetText(ply:Nick())
self.nick:SizeToContents()
if ply:SteamID() == “STEAM_0:X:XXXXXXXX” and ply:Nick() == “XXXXX” then
self.nick:SetFGColor( math.abs(math.sin(CurTime() * 2) * 255), 0, math.abs(math.sin(CurTime() * 2) * 255), 255 )
elseif ply:SteamID() == “STEAM_0:X:XXXXXXXX” and ply:Nick() == “XXXXXX” then
self.nick:SetFGColor( math.abs(math.sin(CurTime() * 2) * 255), 0, math.abs(math.sin(CurTime() * 2) * 255), 255 )
else
self.nick:SetFGColor(ColorForPlayer(ply))
end

local ptag = ply.sb_tag
if ScoreGroup(ply) != GROUP_TERROR then
ptag = nil
end

self.tag:SetText(ptag and GetTranslation(ptag.txt) or “”)
self.tag:SetFGColor(ptag and ptag.color or COLOR_WHITE)

self.sresult:SetVisible(ply.search_result != nil)

– more blue if a detective searched them
if ply.search_result and (LocalPlayer():IsDetective() or (not ply.search_result.show)) then
self.sresult:SetImageColor(Color(200, 200, 255))
end

– cols are likely to need re-centering
self:LayoutColumns()

if self.info then
self.info:UpdatePlayerData()
end
end

function PANEL:ApplySchemeSettings()
for k,v in pairs(self.cols) do
v:SetFont(“treb_small”)
v:SetFGColor(COLOR_WHITE)
end

self.nick:SetFont(“treb_small”)
self.nick:SetFGColor(ColorForPlayer(self.Player))

local ptag = self.Player and self.Player.sb_tag
self.tag:SetFGColor(ptag and ptag.color or COLOR_WHITE)
self.tag:SetFont(“treb_small”)

self.sresult:SetImage(“gui/silkicons/magnifier”)
self.sresult:SetImageColor(Color(170, 170, 170, 150))
end

function PANEL:LayoutColumns()
for k,v in ipairs(self.cols) do
v:SizeToContents()
v:SetPos(self:GetWide() - (50*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
end

self.tag:SizeToContents()
self.tag:SetPos(self:GetWide() - (50 * 6) - self.tag:GetWide()/2, (SB_ROW_HEIGHT - self.tag:GetTall()) / 2)

self.sresult:SetPos(self:GetWide() - (50*6) - 8, (SB_ROW_HEIGHT - 16) / 2)
end

function PANEL:PerformLayout()
self.avatar:SetPos(0,0)
self.avatar:SetSize(SB_ROW_HEIGHT,SB_ROW_HEIGHT)

if not self.open then
self:SetSize(self:GetWide(), SB_ROW_HEIGHT)

  if self.info then self.info:SetVisible(false) end

elseif self.info then
self:SetSize(self:GetWide(), 100 + SB_ROW_HEIGHT)

  self.info:SetVisible(true)
  self.info:SetPos(5, SB_ROW_HEIGHT + 5)
  self.info:SetSize(self:GetWide(), 100)
  self.info:PerformLayout()

  self:SetSize(self:GetWide(), SB_ROW_HEIGHT + self.info:GetTall())

end

self.nick:SizeToContents()

self.nick:SetPos(SB_ROW_HEIGHT + 10, (SB_ROW_HEIGHT - self.nick:GetTall()) / 2)

self:LayoutColumns()
end

function PANEL:DoClick(x, y)
self:SetOpen(not self.open)
end

function PANEL:SetOpen(o)
if self.open then
surface.PlaySound(“ui/buttonclickrelease.wav”)
else
surface.PlaySound(“ui/buttonclick.wav”)
end

self.open = o

self:PerformLayout()
self:GetParent():PerformLayout()
sboard_panel:PerformLayout()
– sboard_panel:PerformLayout()
end

function PANEL:DoRightClick()
end

vgui.Register( “TTTScorePlayerRow”, PANEL, “Button” )
[/lua]

A picture would help me :confused:

GetInfoNum is serverside. You’ll need to network the values to all the other clients.

So you’re saying every client needs the colors of every other client? I’ll see if that works…

How else would the client know what color the other players should be on the scoreboard…telepathy?

Well when I first looked at the GetInfoNum page, it said it was a shared thing. But I checked again and it was server only.