so recently i've been trying to add a ulx scoreboard script. when i install it , it worked properly once, but now its messed up. i think the problem may be that some groups aren't listed, because i didn't have them all entered into the file, but this is the addon file
[CODE]local EZS = {}
EZS.Ranks = {}
--[[ CONFIG ]]--
EZS.Enabled = true
EZS.Ranks["superadmin"] = { name = "S. Admin", color = Color( 255, 0, 0 ), admin = true } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["Admin"] = { name = "Admin", color = Color( 150, 100, 100 ), admin = true }
EZS.Ranks["Owner"] = { name = "Owner", color = Color( 179, 236, 255 ), admin = true }
EZS.Ranks["Trusted"] = { name = "Trusted", color = Color(0, 204, 51), admin = false }
EZS.Ranks["Moderator"] = { name = "Mod", color = Color(255, 179, 198), admin = true }
EZS.CreateRankLabel = { enabled = true, text = "Rank" } -- label enable on the top? what should it say?
EZS.HideBackground = false
EZS.ShiftLeft = 0
EZS.UseNameColors = true -- should we color the names?
EZS.RainbowFrequency = .5 -- frequency of rainbow (if enabled)
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" },
_icon = "icon16/shield.png",
}
}
}
--[[ END CONFIG ]]--
local function rainbow()
local frequency, time = EZS.RainbowFrequency, 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
local function AddRankLabel( sb )
local heading = EZS.CreateRankLabel.enabled and EZS.CreateRankLabel.text or ""
local function RainbowFunction( label, key )
label.HasRainbow = true
label.Think = function( s )
if EZS.Ranks[key] and EZS.Ranks[key].color ~= "rainbow" then
s:SetTextColor( EZS.Ranks[key].color )
else
s:SetTextColor( rainbow() )
end
end
sb.nick.Think = function( s )
if EZS.Ranks[key] and EZS.Ranks[key].color ~= "rainbow" then
s:SetTextColor( EZS.Ranks[key].color )
else
s:SetTextColor( rainbow() )
end
end
end
if EZS.HideBackground and KARMA.IsEnabled() then
sb:AddColumn( "", function() return "" end, 0 )
end
sb:AddColumn( heading, function( ply, label )
local key = ply:SteamID()
if not EZS.Ranks[key] then key = ply:GetUserGroup() end
local rank = EZS.Ranks[key]
if not rank then return "" end
if rank.color ~= "rainbow" then
label.Think = function( s )
if EZS.Ranks[key] and EZS.Ranks[key].color ~= "rainbow" then
s:SetTextColor( EZS.Ranks[key].color )
else
s:SetTextColor( rainbow() )
end
end
elseif not label.HasRainbow then
RainbowFunction( label, key )
end
if rank.offset then
local px, py = label:GetPos()
label:SetPos( px - rank.offset, py )
end
label:SetName( "EZS" )
return rank.name
end )
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 )
end
end
end
hook.Add( "TTTScoreboardColumns", "EasyScoreboard_Columns", AddRankLabel )
local function AddNameColors( ply )
if EZS.UseNameColors then
local col = EZS.Ranks[ply:SteamID()]
if not col then col = EZS.Ranks[ply:GetUserGroup()] end
if col and col.color then
if col.color == "rainbow" then return rainbow() end
return col.color
else return color_white end
end
end
hook.Add( "TTTScoreboardColorForPlayer", "EasyScoreboard_NameColors", AddNameColors )
local function AddMenu( menu )
local RCF = EZS.RightClickFunction
if not RCF.enabled then return nil end
local rank = EZS.Ranks[LocalPlayer():GetUserGroup()]
local ply = menu.Player
for permission, funcs in pairs( RCF.functions ) do
if permission == "Admin Functions" then
if not rank then continue end
if not rank.admin then continue end
end
menu:AddSpacer()
local perm = menu:AddOption( permission )
perm.OnMousePressed = function() end
perm.OnMouseReleased = function() end
menu:AddSpacer()
for name, f in pairs( funcs ) do
if name == "_icon" then perm:SetIcon( f ) continue end
local option = menu:AddOption( name )
if istable( f ) then
option.DoClick = function()
if not IsValid( ply ) then return end
if RCF.ask_admins then
Derma_Query( "Execute '" .. name .. "' on player " .. ply:Nick() .. "?", "Admin Command",
"Yes", function() f.func( ply ) end,
"No", function() end )
else
f.func( ply )
end
end
option:SetIcon( f.icon )
else
option.DoClick = function() f( ply ) end
end
end
end
end
hook.Add( "TTTScoreboardMenu", "EasyScoreboard_Menu", AddMenu )
concommand.Add( "ezs_refreshscoreboard", function() GAMEMODE:ScoreboardCreate() end )[/CODE]
My sb_main.lua is this
[CODE]---- VGUI panel version of the scoreboard, based on TEAM GARRY's sandbox mode
---- scoreboard.
local surface = surface
local draw = draw
local math = math
local string = string
local vgui = vgui
local GetTranslation = LANG.GetTranslation
local GetPTranslation = LANG.GetParamTranslation
include("sb_team.lua")
surface.CreateFont("cool_small", {font = "coolvetica",
size = 20,
weight = 400})
surface.CreateFont("cool_large", {font = "coolvetica",
size = 24,
weight = 400})
surface.CreateFont("treb_small", {font = "Trebuchet18",
size = 14,
weight = 700})
local logo = surface.GetTextureID("vgui/ttt/score_logo")
local PANEL = {}
local max = math.max
local floor = math.floor
local function UntilMapChange()
local rounds_left = max(0, GetGlobalInt("ttt_rounds_left", 6))
local time_left = floor(max(0, ((GetGlobalInt("ttt_time_limit_minutes") or 60) * 60) - CurTime()))
local h = floor(time_left / 3600)
time_left = time_left - floor(h * 3600)
local m = floor(time_left / 60)
time_left = time_left - floor(m * 60)
local s = floor(time_left)
return rounds_left, string.format("%02i:%02i:%02i", h, m, s)
end
GROUP_TERROR = 1
GROUP_NOTFOUND = 2
GROUP_FOUND = 3
GROUP_SPEC = 4
GROUP_COUNT = 4
function ScoreGroup(p)
if not IsValid(p) then return -1 end -- will not match any group panel
if DetectiveMode() then
if p:IsSpec() and (not p:Alive()) then
if p:GetNWBool("body_found", false) then
return GROUP_FOUND
else
local client = LocalPlayer()
-- To terrorists, missing players show as alive
if client:IsSpec() or
When you initially added it, did you add it via auto-refresh; if so, was that the time it worked? If so, then the load order isn't correct.
[QUOTE=Acecool;44854950]When you initially added it, did you add it via auto-refresh; if so, was that the time it worked? If so, then the load order isn't correct.[/QUOTE]
Well I just extracted the .zip into the addons folder in my server files if that's what you mean.
Is there an error? What version of TTT are you running?
Sorry, you need to Log In to post a reply to this thread.