Comments (3)
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.
[ERROR] lua/autorun/client/ttt_easyscoreboard.lua:92: attempt to index field 'Colors' (a nil value)
- fn - lua/autorun/client/ttt_easyscoreboard.lua:92
- Call - addons/ulib/lua/ulib/shared/hook.lua:183
- ColorForPlayer - gamemodes/terrortown/gamemode/vgui/sb_row.lua:86
- UpdatePlayerData - gamemodes/terrortown/gamemode/vgui/sb_row.lua:169
- SetPlayer - gamemodes/terrortown/gamemode/vgui/sb_row.lua:152
- AddPlayerRow - gamemodes/terrortown/gamemode/vgui/sb_team.lua:94
- UpdateScoreboard - gamemodes/terrortown/gamemode/vgui/sb_main.lua:275
- unknown - gamemodes/terrortown/gamemode/cl_scoreboard.lua:40
from ttt-easyscoreboard.
it's been fixed, download the newest version
from ttt-easyscoreboard.
Related Issues (20)
- Color issue
- Scoreboard colors are white? HOT 1
- Icons don't align properly HOT 2
- Invalid players can cause errors HOT 4
- How can I make someone have a rainbow rank colour?
- Problems adding ranks HOT 2
- Rainbow HOT 1
- Wrong color?? HOT 3
- Custom Ranks not persistent HOT 1
- Addon is not working HOT 1
- "Label" Error
- Icons not working
- Ranks not showing up
- Ehmm I dont know were to post suggestions ;) HOT 2
- Getting this Error HOT 1
- column width HOT 1
- Terrortown HOT 1
- Dynamic colors? HOT 2
- add way to disguise admin in scoreboard HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ttt-easyscoreboard.