dont mean to sound like a noob but...where do i put this?
Hey I seem to only be able to get the rank in color the players name is not in color is there a way to fix this?
[QUOTE=Excelsior;46152198]dont mean to sound like a noob but...where do i put this?[/QUOTE]
garrysmod/addons/
[QUOTE=Bazingacatz;46157108]Hey I seem to only be able to get the rank in color the players name is not in color is there a way to fix this?[/QUOTE]
post your file
I have the same problem. Names dont have colour...
My code:
[code]
EZS = {} -- what's one more global to the fray
EZS.Ranks = {}
--[[ CONFIG ]]--
EZS.Enabled = true
-- you can set a silkicon to be used, by adding a "icon" field. for example: icon = "heart" will be drawn as "icon16/heart.png"
-- for a full list of silkicons, go to http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png
--EZS.Ranks["rank OR steamid"] = { name = "displayname", color = RankColor, namecolor = (optional), admin = are they admin? (true/false) }
EZS.Ranks["superadmin"] = { name = "S. Admin", color = Color( 255, 0, 77 ), namecolor = Color( 255, 0, 77 ), admin = true }
EZS.Ranks["admin"] = { name = "Admin", color = Color( 255, 0, 204 ), namecolor = Color( 255, 0, 204 ), admin = true }
EZS.Ranks["moderador"] = { name = "Mod", color = Color( 51, 0, 255 ), namecolor = Color( 51, 0, 255 ), admin = true }
EZS.Ranks["vip"] = { name = "VIP", color = Color( 0, 255, 51 ), namecolor = Color( 0, 255, 51 ), admin = false }
EZS.Ranks["Registrado"] = { name = "Registrado", color = Color( 0, 204, 255 ), namecolor = Color( 0, 204, 255 ), admin = false }
EZS.Ranks["Habitual"] = { name = "Habitual", color = Color( 255, 179, 0 ), namecolor = Color( 255, 179, 0 ), admin = false }
EZS.Ranks["user"] = { name = "Usuario", color = Color( 255, 255, 255 ), namecolor = Color( 255, 255, 255 ), admin = false }
-- it would be nice if you left this in :)
EZS.Ranks["STEAM_0:1:45852799"] = { color = Color( 100, 200, 100 ), icon = "bug", admin = false }
-- label enable on the top? what should it say?
EZS.CreateRankLabel = { enabled = true, text = "Rank" }
-- sadly there is no way to shift the background bar over as TTT draws it manually :c
EZS.HideBackground = false
-- the number of columns (not pixels!!!!!!!) to shift to the left
EZS.ShiftLeft = 0
-- shift tags, search marker, etc how much? (IN PIXELS)
EZS.ShiftOthers = 200
-- Show icon as well as rank text? (if possible)
EZS.ShowIconsWithRanks = true
-- How far left should we shift the icon relative to the rank text?
EZS.ShiftRankIcon = 1
-- should we color the names?
EZS.UseNameColors = true
-- should names get rainbow?
EZS.AllowNamesToHaveRainbow = true
-- frequency of rainbow (if enabled)
EZS.RainbowFrequency = .5
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" },
},
{
["Mute"] = { func = function( ply )
RunConsoleCommand( "ulx", "mute", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/pill.png" },
["Un-Mute"] = { func = function( ply )
RunConsoleCommand( "ulx", "unmute", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/pill.png" },
},
{
["Gag"] = { func = function( ply )
RunConsoleCommand( "ulx", "gag", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound_mute.png" },
["Un-Gag"] = { func = function( ply )
RunConsoleCommand( "ulx", "ungag", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound.png" },
},
{
["Goto"] = { func = function( ply )
RunConsoleCommand( "ulx", "goto", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound_mute.png" },
["Bring"] = { func = function( ply )
RunConsoleCommand( "ulx", "bring", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound.png" },
},
_icon = "icon16/shield.png",
}
}
}
hook.Run( "EZS_AddRightClickFunction", EZS.RightClickFunction.functions )
--[[ END CONFIG ]]--
for id, rank in pairs( EZS.Ranks ) do
if rank.icon then
rank.__iconmat = Material( ("icon16/%s.png"):format( rank.icon ) )
end
end
local function RealUserGroup( ply )
if ply.EV_GetRank then return ply:EV_GetRank() end
return ply:GetUserGroup()
end
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
function EZS.HandleShift( sb )
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 )
EZS.HandleTags( s )
end
end
end
function EZS.HandleTags( sb )
if EZS.ShiftOthers <= 0 then return end
-- copy some from base
local cx = sb:GetWide() - 90
for k,v in ipairs(sb.cols) do
cx = cx - v.Width
end
sb.tag:SizeToContents()
sb.tag:SetPos((cx - sb.tag:GetWide()/2) - EZS.ShiftOthers, (SB_ROW_HEIGHT - sb.tag:GetTall()) / 2)
sb.sresult:SizeToContents()
sb.sresult:SetPos((cx - 8)-EZS.ShiftOthers, (SB_ROW_HEIGHT - 16) / 2)
end
function EZS.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
if EZS.AllowNamesToHaveRainbow then
s:SetTextColor( rainbow() )
end
end
end
end
if EZS.HideBackground and KARMA.IsEnabled() then -- ttt pls
sb:AddColumn( "", function() return "" end, 0 )
end
sb:AddColumn( heading, function( ply, label )
local key = ply:SteamID()
if not EZS.Ranks[key] then key = RealUserGroup( ply ) end
local rank = EZS.Ranks[key]
local ov_name = hook.Run( "EZS_GetPlayerRankName", ply )
if ov_name and not rank then return ov_name end
if not rank and not ov_name then return "" end
label:SetName( "EZS" )
if rank.offset then
local px, py = label:GetPos()
label:SetPos( px - rank.offset, py )
end
if rank.icon and not rank.__iconmat:IsError() then
label.Paint = function( s, w, h )
surface.DisableClipping( true )
surface.SetDrawColor( color_white )
surface.SetMaterial( rank.__iconmat )
local posx = -6
if rank.name and EZS.ShowIconsWithRanks then
posx = 0 - s:GetTextSize() - EZS.ShiftRankIcon
end
surface.DrawTexturedRect( posx, -1, rank.__iconmat:Width(), rank.__iconmat:Height() )
surface.DisableClipping( false )
end
if not rank.name then return " " end
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
I have no idea if i did this right but when i go in the server it doesnt work.
this is the error that comes up
[QUOTE][ERROR] addons/ttt-easyscoreboard-master/lua/autorun/client/ttt_easyscoreboard.lua:1: '=' expected near 'EZS'
1. unknown - addons/ttt-easyscoreboard-master/lua/autorun/client/ttt_easyscoreboard.lua:0
[/QUOTE]
[QUOTE]E EZS = {} -- what's one more global to the fray
EZS.Ranks = {}
--[[ CONFIG ]]--
EZS.Enabled = true
-- you can set a silkicon to be used, by adding a "icon" field. for example: icon = "heart" will be drawn as "icon16/heart.png"
-- for a full list of silkicons, go to [url]http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png[/url]
--EZS.Ranks["rank OR steamid"] = { name = "displayname", color = RankColor, namecolor = (optional), admin = are they admin? (true/false) }
EZS.Ranks["owner"] = { name = "Owner", color = "rainbow", admin = true }
EZS.Ranks["headadmin"] = { name = "Head Admin", color = Color( 139, 0, 0 ), admin = true }
EZS.Ranks["admin"] = { name = "Admin", color = Color( 255, 109, 31 ), admin = true }
EZS.Ranks["mod"] = { name = "Moderator", color = Color( 139, 255, 30 ), admin = true }
EZS.Ranks["platinumdonator"] = { name = "Platinum", color = Color( 218, 218, 218 ), admin = false }
EZS.Ranks["golddonator"] = { name = "Gold", color = Color( 246, 201, 0 ), admin = false }
EZS.Ranks["donator"] = { name = "Supporter", color = Color( 0, 246, 246 ), admin = false }
Ranks["member"] = { name = "Member", color = Color( 255, 255, 30 ), admin = false }
EZS.Ranks["BlackCrystal"] = "rainbow"
-- it would be nice if you left this in :)
EZS.Ranks["STEAM_0:1:45852799"] = { name = "rejax", color = Color( 100, 200, 100 ), admin = false }
-- label enable on the top? what should it say?
EZS.CreateRankLabel = { enabled = true, text = "Rank" }
-- sadly there is no way to shift the background bar over as TTT draws it manually :c
EZS.HideBackground = false
-- the number of columns (not pixels!!!!!!!) to shift to the left
EZS.ShiftLeft = 0
-- shift tags, search marker, etc how much? (IN PIXELS)
EZS.ShiftOthers = 200
-- should we color the names?
EZS.UseNameColors = true
-- frequency of rainbow (if enabled)
EZS.RainbowFrequency = .5
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" },
},
{
["Mute"] = { func = function( ply )
RunConsoleCommand( "ulx", "mute", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/pill.png" },
["Un-Mute"] = { func = function( ply )
RunConsoleCommand( "ulx", "unmute", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/pill.png" },
},
{
["Gag"] = { func = function( ply )
RunConsoleCommand( "ulx", "gag", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound_mute.png" },
["Un-Gag"] = { func = function( ply )
RunConsoleCommand( "ulx", "ungag", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound.png" },
},
{
["Goto"] = { func = function( ply )
RunConsoleCommand( "ulx", "goto", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound_mute.png" },
["Bring"] = { func = function( ply )
RunConsoleCommand( "ulx", "bring", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound.png" },
},
_icon = "icon16/shield.png",
}
}
}
hook.Run( "EZS_AddRightClickFunction", EZS.RightClickFunction.functions )
--[[ END CONFIG ]]--
for id, rank in pairs( EZS.Ranks ) do
if rank.icon then
rank.__iconmat = Material( ("icon16/%s.png"):format( rank.icon ) )
end
end
local function RealUserGroup( ply )
if ply.EV_GetRank then return ply:EV_GetRank() end
return ply:GetUserGroup()
end
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
function EZS.HandleShift( sb )
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 )
EZS.HandleTags( s )
end
end
end
function EZS.HandleTags( sb )
if EZS.ShiftOthers <= 0 then return end
-- copy some from base
local cx = sb:GetWide() - 90
for k,v in ipairs(sb.cols) do
cx = cx - v.Width
end
sb.tag:SizeToContents()
sb.tag:SetPos((cx - sb.tag:GetWide()/2) - EZS.ShiftOthers, (SB_ROW_HEIGHT - sb.tag:GetTall()) / 2)
sb.sresult:SizeToContents()
sb.sresult:SetPos((cx - 8)-EZS.ShiftOthers, (SB_ROW_HEIGHT - 16) / 2)
end
function EZS.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 -- ttt pls
sb:AddColumn( "", function() return "" end, 0 )
end
sb:AddColumn( heading, function( ply, label )
local key = ply:SteamID()
if not EZS.Ranks[key] then key = RealUserGroup( ply ) end
local rank = EZS.Ranks[key]
local ov_name = hook.Run( "EZS_GetPlayerRankName", ply )
if ov_name and not rank then return ov_name end
if not rank and not ov_name then return "" end
label:SetName( "EZS" )
if rank.offset then
local px, py = label:GetPos()
label:SetPos( px - rank.offset, py )
end
if rank.icon and not rank.__iconmat:IsError() then
label.Paint = function( s, w, h )
surface.DisableClipping( true )
surface.SetDrawColor( color_white )
surface.SetMaterial( rank.__iconmat )
surface.DrawTexturedRect( -6, -1, rank.__iconmat:Width(), rank.__iconmat:Height() )
surface.DisableClipping( false )
end
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 ov_name then return ov_name end
return rank.name
end )
EZS.HandleShift( sb )
end
hook.Add( "TTTScoreboardColumns", "EZS_Columns", EZS.AddRankLabel )
local function AddNameColors( ply )
if not EZS.UseNameColors then return end
local col = EZS.Ranks[ply:SteamID(
First: use [lua] tags.
Second you got an E before EZS = {}
[editline]8th October 2014[/editline]
[QUOTE=Tomelyr;46182787]First: use [lua] tags.
Second you got an E before EZS = {}[/QUOTE]
EDIT: nvm fixed it
its still not working and I have another error
[ERROR] addons/ttt-easyscoreboard-master/lua/autorun/client/ttt_easyscoreboard.lua:98: bad key to string index (number expected, got string)
1. error - [C]:-1
2. __index - lua/includes/extensions/string.lua:274
3. unknown - addons/ttt-easyscoreboard-master/lua/autorun/client/ttt_easyscoreboard.lua:98
[CODE]EZS = {} -- what's one more global to the fray
EZS.Ranks = {}
--[[ CONFIG ]]--
EZS.Enabled = true
-- you can set a silkicon to be used, by adding a "icon" field. for example: icon = "heart" will be drawn as "icon16/heart.png"
-- for a full list of silkicons, go to http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png
--EZS.Ranks["rank OR steamid"] = { name = "displayname", color = RankColor, namecolor = (optional), admin = are they admin? (true/false) }
EZS.Ranks["owner"] = { name = "Owner", color = "rainbow", admin = true }
EZS.Ranks["headadmin"] = { name = "Head Admin", color = Color( 139, 0, 0 ), admin = true }
EZS.Ranks["admin"] = { name = "Admin", color = Color( 255, 109, 31 ), admin = true }
EZS.Ranks["mod"] = { name = "Moderator", color = Color( 139, 255, 30 ), admin = true }
EZS.Ranks["platinumdonator"] = { name = "Platinum", color = Color( 218, 218, 218 ), admin = false }
EZS.Ranks["golddonator"] = { name = "Gold", color = Color( 246, 201, 0 ), admin = false }
EZS.Ranks["donator"] = { name = "Supporter", color = Color( 0, 246, 246 ), admin = false }
EZS.Ranks["member"] = { name = "Member", color = Color( 255, 255, 30 ), admin = false }
-- it would be nice if you left this in :)
EZS.Ranks["STEAM_0:1:45852799"] = { name = "rejax", color = Color( 100, 200, 100 ), admin = false }
-- label enable on the top? what should it say?
EZS.CreateRankLabel = { enabled = true, text = "Rank" }
-- sadly there is no way to shift the background bar over as TTT draws it manually :c
EZS.HideBackground = false
-- the number of columns (not pixels!!!!!!!) to shift to the left
EZS.ShiftLeft = 0
-- shift tags, search marker, etc how much? (IN PIXELS)
EZS.ShiftOthers = 200
-- should we color the names?
EZS.UseNameColors = true
-- frequency of rainbow (if enabled)
EZS.RainbowFrequency = .5
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" },
},
{
["Mute"] = { func = function( ply )
RunConsoleCommand( "ulx", "mute", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/pill.png" },
["Un-Mute"] = { func = function( ply )
RunConsoleCommand( "ulx", "unmute", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/pill.png" },
},
{
["Gag"] = { func = function( ply )
RunConsoleCommand( "ulx", "gag", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound_mute.png" },
["Un-Gag"] = { func = function( ply )
RunConsoleCommand( "ulx", "ungag", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound.png" },
},
{
["Goto"] = { func = function( ply )
RunConsoleCommand( "ulx", "goto", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound_mute.png" },
["Bring"] = { func = function( ply )
RunConsoleCommand( "ulx", "bring", ply:Nick():gsub( ";", "" ) )
end, icon = "icon16/sound.png" },
},
_icon = "icon16/shield.png",
}
}
}
hook.Run( "EZS_AddRightClickFunction", EZS.RightClickFunction.functions )
--[[ END CONFIG ]]--
for id, rank in pairs( EZS.Ranks ) do
if rank.icon then
rank.__iconmat = Material( ("icon16/%s.png"):format( rank.icon ) )
end
end
local function RealUserGroup( ply )
if ply.EV_GetRank then return ply:EV_GetRank() end
return ply:GetUserGroup()
end
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
function EZS.HandleShift( sb )
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 )
EZS.HandleTags( s )
end
end
end
function EZS.HandleTags( sb )
if EZS.ShiftOthers <= 0 then return end
-- copy some from base
local cx = sb:GetWide() - 90
for k,v in ipairs(sb.cols) do
cx = cx - v.Width
end
sb.tag:SizeToContents()
sb.tag:SetPos((cx - sb.tag:GetWide()/2) - EZS.ShiftOthers, (SB_ROW_HEIGHT - sb.tag:GetTall()) / 2)
sb.sresult:SizeToContents()
sb.sresult:SetPos((cx - 8)-EZS.ShiftOthers, (SB_ROW_HEIGHT - 16) / 2)
end
function EZS.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 -- ttt pls
sb:AddColumn( "", function() return "" end, 0 )
end
sb:AddColumn( heading, function( ply, label )
local key = ply:SteamID()
if not EZS.Ranks[key] then key = RealUserGroup( ply ) end
local rank = EZS.Ranks[key]
local ov_name = hook.Run( "EZS_GetPlayerRankName", ply )
if ov_name and not rank then return ov_name end
if not rank and not ov_name then return "" end
label:SetName( "EZS" )
if rank.offset then
local px, py = label:GetPos()
label:SetPos( px - rank.offset, py )
end
if rank.icon and not rank.__iconmat:IsError() then
label.Paint = function( s, w, h )
surface.DisableClipping( true )
surface.SetDrawColor( color_white )
surface.SetMaterial( rank.__iconmat )
surface.DrawTexturedRect( -6, -1, rank.__iconmat:Width(), rank.__iconmat:Height() )
surface.DisableClipping( false )
end
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 ov_name then return ov_name end
return rank.name
end )
EZS.HandleShift( sb )
end
hook.Add( "TTTScoreboardColumns", "EZS_Colu
I don't know if this is related to this addon.
But how do I make my " Rank " box wider?
So I can fit a longer rank name and such.
Evening folks!
Fixed/Added/Broke some things tonight!
[QUOTE=Changelog]
- Fixed all the name color issues, sorry about that!
- Improved handling of name color
+ Added EZS.ColumnWidth, to customize the width of columns! (sorry it took so long)
developers:
+ Added function EZS.AddSpacer, which basically pads the column to the amount of the first argument
+ Added hook EZS_AddColumns, add all your columns in here, as you would with the normal hook. This just makes sure EZS gets priority :)
[/QUOTE]
Sorry for being absent, please tell me if there are any issues!
Cheers
You added the width change...
I'm so in love with you man.. fuck you're the best <3
//
Also is there anyway to adjust what color the rainbow alternates between?
Like if you wanted it to alternate between 3 colors, Red, White, Blue, etc..
[CODE]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[/CODE]
I see this.. but I don't know if changing the name of the color would actually do it?
But the width change is already enough, thank you for making it easier on dummies like me =]
This is a little bug for your ask admins function
[CODE]
local function AddMenu( menu )
local RCF = EZS.RightClickFunction
if not RCF.enabled then return nil end
local rank = EZS.Ranks[RealUserGroup( LocalPlayer() )]
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
if istable( f ) then
if f.func then
local option = menu:AddOption( name )
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
for n, d in pairs( f ) do
local option = menu:AddOption( n )
option.DoClick = function()
if not IsValid( ply ) then return end
if RCF.ask_admins then
Derma_Query( "Execute '" .. n .. "' on player " .. ply:Nick() .. "?", "Admin Command",
"Yes", function() d.func( ply ) end,
"No", function() end )
else
f.func( ply ) -- This should be d.func(ply) otherwise the function for turning off ask admins will not work
end
end
option:SetIcon( d.icon )
end
menu:AddSpacer()
end
else
menu:AddOption( name ).DoClick = function() f( ply ) end
end
end
end
[/CODE]
Also nice update with the column sizes :smile:
[QUOTE=Niomi;46278653]You added the width change...
I'm so in love with you man.. fuck you're the best <3
[/QUOTE]
Hey, can I get some of that love too? This was me: [url]https://github.com/garrynewman/garrysmod/pull/656[/url]
[URL=https://github.com/rejax/TTT-EasyScoreboard/commit/e36aa40d88a5e31854f59b02d8342d5b0d8ef5a9]just pushed another update[/URL]
[QUOTE=changelog]
+ dynamic colors
instead of just setting "rainbow" as the color, you now add an entry into EZS.DynamicColors and use whatever the key is (rainbow still works)
+ more config options
EZS.DefaultLabel: if there is no rank set for a user - use this
EZS.DefaultNameColorToRankColor: use rank color if no name color?
EZS.AllowNamesToHaveDynamicColor: pretty much EZS.AllowNamesToHaveRainbow, but for the new system
+ Right Click Menu functionality
you can now add an 'allowed' table to a command to set who can see it (this goes on top of the admin system already in place)
~ Code cleanup
minor changes
[/QUOTE]
some how out of nowhere the scoreboard stopped showing the karma for people.
I'm not on the latest version yet but do you have any idea what could cause this?
Is there a way to change the individual icon position using EZS.ShiftRankIcon ?
So I had a question about the ezs tags.lua file.
I noticed that there are database commands for it to save information for tags. Now is that actually working or a work in progress?
I attempted to connect it to a database that I created with those inputs that are in the lua file, but when I try to add a tag to myself and then do a map change, it deletes the tag.
[QUOTE=RDGXTECHX;46701157]So I had a question about the ezs tags.lua file.
I noticed that there are database commands for it to save information for tags. Now is that actually working or a work in progress?
I attempted to connect it to a database that I created with those inputs that are in the lua file, but when I try to add a tag to myself and then do a map change, it deletes the tag.[/QUOTE]
It uses the local SQLite database, and it was stable the last time I updated it.
You shouldn't need to set anything up, just drop the file in autorun/ and set a player's tag in-game.
I'll test it out later, though.
Hi. Great updates. Just wondering, though, how do I use the dynamic colors?
[QUOTE=rejax;46703458]It uses the local SQLite database, and it was stable the last time I updated it.
You shouldn't need to set anything up, just drop the file in autorun/ and set a player's tag in-game.
I'll test it out later, though.[/QUOTE]
That's strange because I do have it in that folder,
I have it in the:
TTT-EasyScoreboard-master/lua/autorun/
and the TTT-EasyScoreboard-master is in the addons folder of my server and I didn't touch/move anything else.
[QUOTE=Nick_515;46705396]Hi. Great updates. Just wondering, though, how do I use the dynamic colors?[/QUOTE]
add a function entry to the EZS.DynamicColors table, like [URL=https://github.com/rejax/TTT-EasyScoreboard/blob/master/lua/autorun/client/TTT_EasyScoreboard.lua#L53-L59]this.[/URL] You are given the player as an argument. Then just set a rank/players color to the key. (eg "rainbow")
[QUOTE=RDGXTECHX;46706451]That's strange because I do have it in that folder,
I have it in the:
TTT-EasyScoreboard-master/lua/autorun/
and the TTT-EasyScoreboard-master is in the addons folder of my server and I didn't touch/move anything else.[/QUOTE]
Run me through what you're doing in-game to set tags.
Just need to bump this but my scoreboard has icons that do not line up, it appears the longer the ranks title is, the further left it is.
[QUOTE=RattleEDG;46709806]Just need to bump this but my scoreboard has icons that do not line up, it appears the longer the ranks title is, the further left it is.[/QUOTE]
-oops, misread this-
I'll add a config option soon
[QUOTE=rejax;46707829]Run me through what you're doing in-game to set tags.[/QUOTE]
I go into my server and then I right-click a player's name/tag section of the scoreboard, then I select "set tag" then I write something like "TEST" and then I do !maprestart or do a map rotation and then it goes back to my original tag.
I do have custom settings for ranks on the ulx menu and I have a Steam ID rank for myself, but it should still overwrite those settings. I did a test where I commented out the Steam rank for ulx and did the same thing as above and it still deletes it. I can't test it with the default ranks because it'll remove my access for that setting for the right-click menu.
There's also a weird glitch for the Steam ID Tags as well, even if I were to add the admin = true in the table, it won't allow me to use those options in the right-click menu, it'll just give me the default user settings.
[URL=https://github.com/rejax/TTT-EasyScoreboard/commit/4c456a0882aeccb95c2e45e42a386f79683447bb]update[/URL]
Fixed SteamID admin privileges
added
(bool) EZS.ShiftIconsWithLabels
(number) EZS.ShiftIconsLeft
Code cleanup
Haven't tested too thoroughly, please report any issues
[QUOTE=rejax;46741389][URL=https://github.com/rejax/TTT-EasyScoreboard/commit/4c456a0882aeccb95c2e45e42a386f79683447bb]update[/URL]
Fixed SteamID admin privileges
added
(bool) EZS.ShiftIconsWithLabels
(number) EZS.ShiftIconsLeft
Code cleanup
Haven't tested too thoroughly, please report any issues[/QUOTE]
Well I will be testing these in a little while, so I will let you know.
The SteamID Admin Privileges work now, thank you! :rock:
With the Dynamic Colors, it's a little strange to setup because of the whole equation to have them change colors and it's only the pure red, pure blue, and pure green colors that it can change to. If you want to do something like Orange to Black, you have to fill those RGB colors with the correct values. This makes it impossible to have the correct colors to display because of the static color values.
Is there something simpler than this: [CODE]math.sin( frequency * time ) * 127 + 128[/CODE]
It works, but it restricts other color variations. Unless there's something else that can be changed in the equation to make it work for the different colors?
Also, do you know what could be my issue with the tags deleting themselves? Is there anyone else that had this issue and could possibly help me? I know SQLite is built in for gmod servers but for some odd reason it doesn't work for me...
EDIT: Here's another cool idea for this too, is there a way to limit the amount of characters for the tag? This would prevent people from making a tag that can cluster the scoreboard.
It annoys me because some of the icons are still a few places out of line. However, it works a lot better than it did.
Very great work from rejax!!!
However we get the following error on our server:
[ERROR] addons/easyscoreboard/lua/autorun/client/ttt_easyscoreboard.lua:162: Tried to use a NULL entity!
1. SteamID - [C]:-1
2. GetRank - addons/easyscoreboard/lua/autorun/client/ttt_easyscoreboard.lua:162
3. unknown - addons/easyscoreboard/lua/autorun/client/ttt_easyscoreboard.lua:297
Has anyone an idea how to solve this?
Keep up this great work!
Sorry, you need to Log In to post a reply to this thread.