I'm trying to get a script for flashing names for admins to work on my ttt server, but I keep getting error.
I saw this on another thread and I was trying to emulate it but they didn't finish explaining how it was fixed, so I'm posting my code here to see if anyone can help.
[CODE]hook.Add( "Think", "scoreboardcolors", function()
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, 170, 0, 255),
dev = flashingRed
};
function GM:TTTScoreboardColorForPlayer(ply)
if not IsValid(ply) then return namecolor.default end
if ply:SteamID() == "STEAM_0:0:26639286" then
return namecolor.dev
elseif ply:IsAdmin() and GetGlobalBool("ttt_highlight_admins", true) then
return namecolor.admin
end
return namecolor.default
end
end )[/CODE]
I'll get an error like "TTTScoreboardColorForPlayer hook returned something that isn't a color!"
Anyone know why this is happening?
[lua]
local flashingRed = Color(0,0,0)
hook.Add("Think", "scoreboardcolors", function()
local glow = math.abs(math.sin(CurTime() * 2) * 255);
flashingRed = Color(glow, 0, 0, 255)
end)
hook.Add("TTTScoreboardColorForPlayer", "ScoreboardColors", function(ply)
if IsValid(ply) and ply:SteamID() == "STEAM_0:0:26639286" then
return flashingRed
end
end)
[/lua]
Sorry, you need to Log In to post a reply to this thread.