Hi everyone! I put aTags on my server, but i can't make this work with my custom scoreboard and ikefi is inactive from Gmodstore =/ I really need help (Sorry for my bad English :p)
Have you tried this thing from FAQ?[code]local tag, color = hook.Call("aTag_GetScoreboardTag", nil, PLAYER)[/code]
Yeah, but i don't know why this not work :(
[QUOTE=Ikyi;52747137]Yeah, but i don't know why this not work :([/QUOTE]
Post your error/code?
[QUOTE]local tag, color = hook.Call("aTag_GetScoreboardTag", nil, Player)[/QUOTE]
Ok, i don't know what i make with this thing =/
You have to post your scoreboard code and wait when someone decide to help you :s:
I'll try this, thanks
I can't make an column, i've tried in every way =/ (Btw i use an custom Scoreboard without support: [URL="https://www.gmodstore.com/scripts/view/1006"]This[/URL]) Anyone help me ;-; I'm an noob on Lua Scripting
[QUOTE=Ikyi;52750819]I can't make an column, i've tried in every way =/ (Btw i use an custom Scoreboard without support: [URL="https://www.gmodstore.com/scripts/view/1006"]This[/URL]) Anyone help me ;-; I'm an noob on Lua Scripting[/QUOTE]
You say you've tried, but you really need to post your code.
My sb_row (i think that's enough)
[QUOTE]
local GetTranslation = LANG.GetTranslation
local GetPTranslation = LANG.GetParamTranslation
SB_ROW_HEIGHT = 24 --16
local PANEL = {}
function PANEL:Init()
self.info = nil
self.open = false
self.cols = {}
self:AddColumn( GetTranslation("sb_ping"), function(ply) return ply:Ping() end )
self:AddColumn( GetTranslation("sb_deaths"), function(ply) return ply:Deaths() end )
self:AddColumn( GetTranslation("sb_score"), function(ply) return ply:Frags() end )
if KARMA.IsEnabled() then
self:AddColumn( GetTranslation("sb_karma"), function(ply) return math.Round(ply:GetBaseKarma()) end )
end
-- if ScoreboardConfig.Use_aTags then
-- self:AddColumn("Tags", -- aTags hate me xD i erased my old attempts, sorry
-- end
if ScoreboardConfig.RankTextEnabled then
self:AddColumn("Rank", function(ply) if ScoreboardConfig.RankText[ply:GetUserGroup()] then return ScoreboardConfig.RankText[ply:GetUserGroup()][1] else return "" end end, ScoreboardConfig.RankTextColumnWidth, true)
end
hook.Call("TTTScoreboardColumns", nil, self)
for _, c in ipairs(self.cols) do
c:SetMouseInputEnabled(false)
end
self.tag = vgui.Create("DLabel", self)
self.tag:SetText("")
self.tag:SetMouseInputEnabled(false)
self.sresult = vgui.Create("DImage", self)
self.sresult:SetSize(16,16)
self.sresult:SetMouseInputEnabled(false)
self.avatar = vgui.Create( "AvatarImage", self )
self.avatar:SetSize(SB_ROW_HEIGHT, SB_ROW_HEIGHT)
self.avatar:SetMouseInputEnabled(false)
self.nick = vgui.Create("DLabel", self)
self.nick:SetMouseInputEnabled(false)
self.voice = vgui.Create("DImageButton", self)
self.voice:SetSize(16,16)
self.rankicon = vgui.Create("DImageButton", self)
self.rankicon:SetSize(16,16)
self:SetCursor( "hand" )
end
function PANEL:AddColumn( label, func, width, boolean )
local lbl = vgui.Create( "DLabel", self )
lbl.GetPlayerText = func
lbl.IsHeading = false
lbl.Width = width or 50
lbl.Rank = boolean
table.insert( self.cols, lbl )
return lbl
end
function GAMEMODE:TTTScoreboardColorForPlayer(ply)
if not IsValid(ply) then return ScoreboardConfig.DefaultPlayerColor end
for v,z in pairs(ScoreboardConfig.SB_RankNameColors) do
if ply:GetUserGroup() == z[1] then return z[2] end
end
if ply:IsAdmin() and GetGlobalBool("ttt_highlight_admins", true) then
return ScoreboardConfig.DefaultAdminColor
end
return ScoreboardConfig.DefaultPlayerColor
end
local function ColorForPlayer(ply)
if IsValid(ply) then
local c = hook.Call("TTTScoreboardColorForPlayer", GAMEMODE, ply)
if c and type(c) == "table" and c.r and c.b and c.g and c.a then
return c
else
ErrorNoHalt("TTTScoreboardColorForPlayer hook returned something that isn't a color!\n")
end
end
return ScoreboardConfig.DefaultPlayerColor
end
function PANEL:Paint()
if not IsValid(self.Player) then return end
local ply = self.Player
if ply:IsTraitor() then
surface.SetDrawColor(255, 0, 0, 30)
surface.DrawRect(0, 0, self:GetWide(), SB_ROW_HEIGHT)
elseif ply:IsDetective() then
surface.SetDrawColor(0, 0, 255, 30)
surface.DrawRect(0, 0, self:GetWide(), SB_ROW_HEIGHT)
end
if ply == LocalPlayer() then
surface.SetDrawColor( 200, 200, 200, math.Clamp(math.sin(RealTime() * 2) * 50, 0, 100))
surface.DrawRect(0, 0, self:GetWide(), SB_ROW_HEIGHT )
end
return true
end
function PANEL:SetPlayer(ply)
self.Player = ply
self.avatar:SetPlayer(ply)
if not self.info then
local g = ScoreGroup(ply)
if g == GROUP_TERROR and ply != LocalPlayer() then
self.info = vgui.Create("TTTScorePlayerInfoTags", self)
self.info:SetPlayer(ply)
self:InvalidateLayout()
elseif g == GROUP_FOUND or g == GROUP_NOTFOUND then
self.info = vgui.Create("TTTScorePlayerInfoSearch", self)
self.info:SetPlayer(ply)
self:InvalidateLayout()
end
else
self.info:SetPlayer(ply)
self:InvalidateLayout()
end
self.voice.DoClick = function()
if IsValid(ply) and ply != LocalPlayer() then
ply:SetMuted(not ply:IsMuted())
end
end
self:UpdatePlayerData()
end
function PANEL:GetPlayer() return self.Player end
function PANEL:UpdatePlayerData()
if not IsValid(self.Player) then return end
local ply = self.Player
for i=1,#self.cols do
if self.cols[i].Rank and ScoreboardConfig.RankText[ply:GetUserGroup()] then
self.cols[i].color = ScoreboardConfig.RankText[ply:GetUserGroup()][2]
self.cols[i]:SetTextColor(ScoreboardConfig.RankText[ply:GetUserGroup()][2] or Color(255,255,255))
end
self.cols[i]:SetText( self.cols[i].GetPlayerText(ply, self.cols[i]) or "")
end
self.nick:SetText(ply:Nick())
self.nick:SizeToContents()
self.nick:SetTextColor(ColorForPlayer(ply))
local ptag = ply.sb_tag
if ScoreGroup(ply) != GROUP_TERROR then
ptag = nil
end
self.tag:SetText(ptag and GetTranslation(ptag.txt) or "")
self.tag:SetTextColor(ptag and ptag.color or COLOR_WHITE)
self.sresult:SetVisible(ply.search_result != nil)
if ply.search_result and (LocalPlayer():IsDetective() or (not ply.search_result.show)) then
self.sresult:SetImageColor(Color(200, 200, 255))
end
self:LayoutColumns()
if self.info then
self.info:UpdatePlayerData()
end
if self.Player != LocalPlayer() then
local muted = self.Player:IsMuted()
self.voice:SetImage(muted and "icon16/sound_mute.png" or "icon16/sound.png")
else
self.voice:Hide()
end
for v,z in pairs(ScoreboardConfig.SB_Ranks) do
if self.Player:GetUserGroup() == z[1] then self.rankicon:SetImage(z[2]) end
end
end
function PANEL:ApplySchemeSettings()
for k,v in pairs(self.cols) do
v:SetFont("minimal_small")
if v.Rank then
v:SetTextColor(v.color)
else
v:SetTextColor(COLOR_WHITE)
end
end
self.nick:SetFont("minimal_small")
self.nick:SetTextColor(ColorForPlayer(self.Player))
local ptag = self.Player and self.Player.sb_tag
self.tag:SetTextColor(ptag and ptag.color or COLOR_WHITE)
self.tag:SetFont("minimal_small")
self.sresult:SetImage("icon16/magnifier.png")
self.sresult:SetImageColor(Color(170, 170, 170, 150))
end
function PANEL:LayoutColumns()
local cx = self:GetWide()
for k,v in ipairs(self.cols) do
v:SizeToContents()
cx = cx - v.Width
v:SetPos(cx - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
end
self.tag:SizeToContents()
cx = cx - 90
self.tag:SetPos(cx - self.tag:GetWide()/2 - 15, (SB_ROW_HEIGHT - self.tag:GetTall()) / 2)
self.sresult:SetPos(cx - 8, (SB_ROW_HEIGHT - 16) / 2)
end
function PANEL:PerformLayout()
self.avatar:SetPos(0,0)
self.avatar:SetSize(SB_ROW_HEIGHT,SB_ROW_HEIGHT)
local fw = sboard_panel.ply_frame:GetWide()
self:SetWide( fw )
if not self.open then
self:SetSize(self:GetWide(), SB_ROW_HEIGHT)
if self.info then self.info:SetVisible(false) end
elseif self.info then
self:SetSize(self:GetWide(), 100 + SB_ROW_HEIGHT)
self.info:SetVisible(true)
self.info:SetPos(5, SB_ROW_HEIGHT + 5)
self.info:SetSize(self:GetWide(), 100)
self.info:PerformLayout()
self:SetSize(self:GetWide(), SB_ROW_HEIGHT + self.info:GetTall())
end
self.nick:SizeToContents()
self.nick:SetPos(SB_ROW_HEIGHT + 10, (SB_ROW_HEIGHT - self.nick:GetTall()) / 2)
self:LayoutColumns()
self.voice:SetVisible(not self.open)
self.voice:SetSize(16, 16)
self.voice:DockMargin(4, 4, 4, 4)
self.voice:Dock(RIGHT)
self.rankicon:SetVisible(true)
self.rankicon:SetSize(16,16)
self.rankicon:SetPos(self.nick:GetWide() +40, 4)
end
function PANEL:DoClick(x, y)
self:SetOpen(not self.open)
end
function PANEL:SetOpen(o)
if self.open then
surface.PlaySound("ui/buttonclickrelease.wav")
else
surface.PlaySound("ui/buttonclick.wav")
end
self.open = o
self:PerformLayout()
self:GetParent():PerformLayout()
sboard_panel:PerformLayout()
end
[/QUOTE]
Both of them (aTags and Modern Scoreboard) has a author inactive, sadly =/ But thank you so much, Shenesis! :)
Sorry, you need to Log In to post a reply to this thread.