Giter Site home page Giter Site logo

Error about ttt-easyscoreboard HOT 3 CLOSED

rejax avatar rejax commented on June 26, 2024
Error

from ttt-easyscoreboard.

Comments (3)

VidmarDev avatar VidmarDev commented on June 26, 2024

local EZS = {}
EZS.Ranks = {}

--[[ CONFIG ]]--
EZS.Enabled = true

EZS.Ranks["superadmin"] = { name = "S. Admin", color = Color( 150, 100, 100 ), admin = true } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["admin"] = { name = "Admin", color = Color(255,20,147), admin = true }
EZS.Ranks["owner"] = { name = "Owner", color = Color( 255, 0, 0 ), admin = true } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["sr admin"] = { name = "Sr.Admin", color = Color( 204, 0, 102 ), admin = true }
EZS.Ranks["founder"] = { name = "Founder", color = Color( 102, 0, 0 ), admin = true } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["hd admin"] = { name = "H. Admin", color = Color(255,0,255), admin = true }
EZS.Ranks["donator+"] = { name = "Donator+", color = "rainbow", admin = false } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["sr mod"] = { name = "Sr. Mod", color = Color(25,25,112), admin = true }
EZS.Ranks["mod"] = { name = "Mod", color = Color(75,0,130), admin = false } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["donator"] = { name = "Donator", color = Color( 153, 153, 0 ), admin = false }
EZS.Ranks["member"] = { name = "Member", color = Color(34,139,34), admin = false } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["user"] = { name = "Terrorist", color = Color(192,192,192), admim = false }
EZS.Ranks["developer"] = { name = "Dev", color = Color(0,128,128), admin = true } -- the display name for a rank, color, is the rank admin?
EZS.Ranks["lead dev"] = { name = "Sr.Dev", color = Color(32,178,170), admin = true }

EZS.CreateRankLabel = { enabled = true, text = "Rank" } -- label enable on the top? what should it say?

EZS.UseNameColors = true -- should we color the names?
EZS.RainbowFrequency = .5 -- frequency of rainbow (if enabled) (higher is faster)

EZS.RightClickFunction = { enabled = true, functions = {
["User Functions"] = {
["Show Profile"] = function( ply )
ply:ShowProfile()
end,

        _icon = "icon16/group.png",
    },
    ["Admin Functions"] = {
        ["Kick"] = { func = function( ply )
            RunConsoleCommand( "ulx", "kick", ply:Nick():gsub( ";", "" ) ) -- change this to whatever
        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 )
    label.HasRainbow = true
    label.Think = function( s )
        s:SetTextColor( rainbow() )
    end
end

sb:AddColumn( heading, function( ply, label )
    local rank = EZS.Ranks[ply:GetUserGroup()]
    if not rank then return "" end

    if rank.color ~= "rainbow" then
        label:SetTextColor( rank.color )    
    elseif not label.HasRainbow then
        RainbowFunction( label )
    end

    if rank.offset then
        local px, py = label:GetPos()
        label:SetPos( px - rank.offset, py )
    end

    return rank.name
end )

end
hook.Add( "TTTScoreboardColumns", "EasyScoreboard_Columns", AddRankLabel )

local function AddNameColors( ply )
if EZS.UseNameColors then

local userGroup = ply:GetNWString( "usergroup" )
local col = EZS.Colors[userGroup]
if not col then col = EZS.Colors[ply:SteamID()] end

    if col then
        if col == "rainbow" then return color_white end
        return col
    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()]

for permission, funcs in pairs( RCF.functions ) do
    if permission == "Admin Functions" and not rank.admin then continue end

    menu:AddSpacer()
    local perm = menu:AddOption( permission )
    menu:AddSpacer()

    for name, f in pairs( funcs ) do
        if name == "_icon" then perm:SetIcon( f ) continue end

        local o = menu:AddOption( name )
        if istable( f ) then
            o.DoClick = function() f.func( menu.Player ) end
            o:SetIcon( f.icon )
        else
            o.DoClick = function() f( menu.Player ) end
        end
    end
end

end
hook.Add( "TTTScoreboardMenu", "EasyScoreboard_Menu", AddMenu )

from ttt-easyscoreboard.

VidmarDev avatar VidmarDev commented on June 26, 2024

[ERROR] lua/autorun/client/ttt_easyscoreboard.lua:92: attempt to index field 'Colors' (a nil value)

  1. fn - lua/autorun/client/ttt_easyscoreboard.lua:92
    1. Call - addons/ulib/lua/ulib/shared/hook.lua:183
    2. ColorForPlayer - gamemodes/terrortown/gamemode/vgui/sb_row.lua:86
      1. UpdatePlayerData - gamemodes/terrortown/gamemode/vgui/sb_row.lua:169
      2. SetPlayer - gamemodes/terrortown/gamemode/vgui/sb_row.lua:152
      3. AddPlayerRow - gamemodes/terrortown/gamemode/vgui/sb_team.lua:94
      4. UpdateScoreboard - gamemodes/terrortown/gamemode/vgui/sb_main.lua:275
        1. unknown - gamemodes/terrortown/gamemode/cl_scoreboard.lua:40

from ttt-easyscoreboard.

rejax avatar rejax commented on June 26, 2024

it's been fixed, download the newest version

from ttt-easyscoreboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.