Guys could i get a bit of help as im not sure whats wrong
this is the error im getting
[lua]
[ERROR] gamemodes/terrortown/gamemode/vgui/sb_main.lua:334: 'end' expected (to close 'function' at line 178) near '<eof>'
1. unknown - gamemodes/terrortown/gamemode/vgui/sb_main.lua:0
[/lua]
sb_row
[url]http://pastebin.com/jqd0jQE5[/url]
sb_main
[url]http://pastebin.com/sx0yF6YV[/url]
not to be a dick but doesn't it kinda exactly tell you what the problem is??
No actually is does not cause if i take our the rank code it fixes it, the error code seems to be unrelated
[QUOTE][ERROR] [B]gamemodes/terrortown/gamemode/vgui/sb_main.lua:334[/B]: [B]'end' expected[/B] (to close 'function' at line 178) near '<eof>'
1. unknown - gamemodes/terrortown/gamemode/vgui/sb_main.lua:0[/QUOTE]
Clue
[ERROR] gamemodes/terrortown/gamemode/vgui/sb_main.lua:334: '[b]end[/b]' expected (to [b]close 'function'[/b] at line [b]178[/b]) near '<eof>'
I can't really read through the code right now (I will later if you can't figure it out) but you're missing an end for a function, if your code is tabbed it'd be easy to find
I'm shocked, I actually got something that wasn't a box!
[LUA]
function PANEL:PerformLayout()
-- position groups and find their total size
local gy = 0
-- can't just use pairs (undefined ordering) or ipairs (group 2 and 3 might not exist)
for i=1, GROUP_COUNT do
local group = self.ply_groups[i]
if ValidPanel(group) then
if group:HasRows() then
group:SetVisible(true)
group:SetPos(0, gy)
group:SetSize(self.ply_frame:GetWide(), group:GetTall())
group:InvalidateLayout()
gy = gy + group:GetTall() + 5
else
group:SetVisible(false)
end
end
end
[/LUA]
Is that section
once how to do this properly is figured out please post the whole proper code because right now its all rather messy.
this is my problem
[IMG]http://img838.imageshack.us/img838/8610/helpmer.jpg[/IMG]
Sb_row
[CODE]---- Scoreboard player score row, based on sandbox version
include("sb_info.lua")
local GetTranslation = LANG.GetTranslation
local GetPTranslation = LANG.GetParamTranslation
SB_ROW_HEIGHT = 24 --16
local PANEL = {}
function PANEL:Init()
-- cannot create info card until player state is known
self.info = nil
self.open = false
self.cols = {}
self.cols[1] = vgui.Create("DLabel", self)
self.cols[1]:SetText(GetTranslation("sb_ping"))
self.cols[2] = vgui.Create("DLabel", self)
self.cols[2]:SetText(GetTranslation("sb_deaths"))
self.cols[3] = vgui.Create("DLabel", self)
self.cols[3]:SetText(GetTranslation("sb_score"))
self.cols[5] = vgui.Create("DLabel", self)
self.cols[5]:SetText("Guest")
if KARMA.IsEnabled() then
self.cols[4] = vgui.Create("DLabel", self)
self.cols[4]:SetText(GetTranslation("sb_karma"))
end
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:SetCursor( "hand" )
end
local namecolor = {
default = COLOR_WHITE,
admin = Color(220, 180, 0, 255),
dev = Color(100, 240, 105, 255)
};
function GM:TTTScoreboardColorForPlayer(ply)
if not IsValid(ply) then return namecolor.default end
if ply:SteamID() == "STEAM_0:0:1963640" then
return namecolor.dev
elseif ply:IsAdmin() and GetGlobalBool("ttt_highlight_admins", true) then
return namecolor.admin
end
return namecolor.default
end
local function ColorForPlayer(ply)
if IsValid(ply) then
local c = hook.Call("TTTScoreboardColorForPlayer", GAMEMODE, ply)
-- verify that we got a proper color
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 namecolor.default
end
function PANEL:Paint()
if not IsValid(self.Player) then return end
-- if ( self.Player:GetFriendStatus() == "friend" ) then
-- color = Color( 236, 181, 113, 255 )
-- 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
self.cols[1]:SetText(ply:Ping())
self.cols[2]:SetText(ply:Deaths())
self.cols[3]:SetText(ply:Frags())
if self.cols[4] then
self.cols[4]:SetText(math.Round(ply:GetBaseKarma()))
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)
-- more blue if a detective searched them
if ply.search_result and (LocalPlayer():IsDetective() or (not ply.search_result.show)) then
self.sresult:SetImageColor(Color(200, 200, 255))
end
-- cols are likely to need re-centering
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
if ply:IsUserGroup("superadmin") then
self.cols[5]:SetText("Owner")
self.cols[5]:SetTextColor(Color(210,0,0))
end
if ply:IsUserGroup("admin") then
self.cols[5]:SetText("Admin")
self.cols[5]:SetTextColor(Color(76,156,156))
end
if ply:IsUserGroup("vip") then
self.cols[5]:SetText("Donator")
self.cols[5]:SetTextColor(Color(234,155,62))
end
if ply:IsUserGroup("operator") then
self.cols[5]:SetText("Operator")
self.cols[5]:SetTextColor(Color(26,246,243))
end
if ply:IsUserGroup("mod") then
self.cols[5]:SetText("Mod")
self.cols[5]:SetTextColor(Color(75,108,251))
end
if ply:IsUserGroup("member") then
self.cols[5]:SetText("Member")
self.cols[5]:SetTextColor(Color(68,247,49))
end
end
function PANEL:ApplySchemeSettings()
for k,v in pairs(self.cols) do
v:SetFont("treb_small")
v:SetTextColor(COLOR_WHITE)
end
self.nick:SetFont("treb_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("treb_small")
self.sresult:SetImage("icon16/magnifier.png")
self.sresult:SetImageColor(Color(170, 170, 170, 150))
end
function PANEL:LayoutColumns()
for k,v in ipairs(self.cols) do
v:SizeToContents()
v:SetPos(self:GetWide() - (50*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
if v == self.cols[5] then
v:SetPos(self:GetWide() - (85*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
end
end
self.tag:SizeToContents()
self.tag:SetPos(self:GetWide() - (50 * 6) - self.tag:GetWide()/2, (SB_ROW_HEIGHT - self.tag:GetTall()) / 2)
self.sresult:SetPos(self:GetWide() - (50*6) - 8, (SB_ROW_HEIGHT - 16) / 2)
end
function PANEL:PerformLayout()
self.avatar:SetPos(0,0)
self.avatar:SetSize(SB_ROW_HEIGHT,SB_ROW_HEIGHT)
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)
s
Guys i still need help, i have got the error to now this
[lua]
[ERROR] gamemodes/terrortown/gamemode/vgui/sb_main.lua:336: '<eof>'
[/lua]
[QUOTE='[NG]Deadly;39032713']this is my problem
Sb_row
[CODE]
function PANEL:LayoutColumns()
for k,v in ipairs(self.cols) do
v:SizeToContents()
v:SetPos(self:GetWide() - (50*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
if v == self.cols[5] then
v:SetPos(self:GetWide() - (85*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
end
[/CODE]
sb_main
[CODE]
-- score columns
local cy = y_logo_off + 90
for k,v in ipairs(self.cols) do
v:SizeToContents()
v:SetPos( w - (85*k) - v:GetWide()/2 - 8, cy)
end
end
[/CODE][/QUOTE]
For sb_row.lua try this -
[CODE]
function PANEL:LayoutColumns()
for k,v in ipairs(self.cols) do
v:SizeToContents()
v:SetPos(self:GetWide() - (50*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
if v == self.cols[5] then
v:SetPos(self:GetWide() - (60*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
end
end
[/CODE]
and for sb_main.lua this -
[CODE]
-- score columns
local cy = y_logo_off + 90
for k,v in ipairs(self.cols) do
v:SizeToContents()
v:SetPos( w - (50*k) - v:GetWide()/2 - 8, cy)
end
[/CODE]
hope this helped :)
How can I make it so that it also makes the name coloured?
Got my positioning fine after a little tweaks.
[IMG]http://i46.tinypic.com/euh7b4.png[/IMG]
all i need to find is the yellow color code to match the default superadmin yellow or a way to change player name color to green and the rank color to the same green
Type end at the end for 336
[editline]22nd March 2013[/editline]
sb_row
---- Scoreboard player score row, based on sandbox version
include("sb_info.lua")
local GetTranslation = LANG.GetTranslation
local GetPTranslation = LANG.GetParamTranslation
SB_ROW_HEIGHT = 24 --16
local PANEL = {}
function PANEL:Init()
-- cannot create info card until player state is known
self.info = nil
self.open = false
self.cols = {}
self.cols[1] = vgui.Create("DLabel", self)
self.cols[1]:SetText(GetTranslation("sb_ping"))
self.cols[2] = vgui.Create("DLabel", self)
self.cols[2]:SetText(GetTranslation("sb_deaths"))
self.cols[3] = vgui.Create("DLabel", self)
self.cols[3]:SetText(GetTranslation("sb_score"))
self.cols[5] = vgui.Create("DLabel", self)
self.cols[5]:SetText("Rank")
if KARMA.IsEnabled() then
self.cols[4] = vgui.Create("DLabel", self)
self.cols[4]:SetText(GetTranslation("sb_karma"))
end
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:SetCursor( "hand" )
end
local namecolor = {
default = COLOR_WHITE,
admin = Color(220, 180, 0, 255),
dev = Color(100, 240, 105, 255)
};
function GM:TTTScoreboardColorForPlayer(ply)
if not IsValid(ply) then return namecolor.default end
if ply:SteamID() == "STEAM_0:0:1963640" then
return namecolor.dev
elseif ply:IsAdmin() and GetGlobalBool("ttt_highlight_admins", true) then
return namecolor.admin
end
return namecolor.default
end
local function ColorForPlayer(ply)
if IsValid(ply) then
local c = hook.Call("TTTScoreboardColorForPlayer", GAMEMODE, ply)
-- verify that we got a proper color
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 namecolor.default
end
function PANEL:Paint()
if not IsValid(self.Player) then return end
-- if ( self.Player:GetFriendStatus() == "friend" ) then
-- color = Color( 236, 181, 113, 255 )
-- 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
self.cols[1]:SetText(ply:Ping())
self.cols[2]:SetText(ply:Deaths())
self.cols[3]:SetText(ply:Frags())
if self.cols[4] then
self.cols[4]:SetText(math.Round(ply:GetBaseKarma()))
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
if ply:IsUserGroup("superadmin") then
self.cols[5]:SetText("Super Admin")
self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("admin") then
self.cols[5]:SetText("Admin")
self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("user") then
self.cols[5]:SetText("")
self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("rank") then
self.cols[5]:SetText("")
self.cols[5]:SetTextColor(Color(255,0,0,255))
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)
-- more blue if a detective searched them
if ply.search_result and (LocalPlayer():IsDetective() or (not ply.search_result.show)) then
self.sresult:SetImageColor(Color(200, 200, 255))
end
-- cols are likely to need re-centering
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
end
function PANEL:ApplySchemeSettings()
for k,v in pairs(self.cols) do
v:SetFont("treb_small")
v:SetTextColor(COLOR_WHITE)
end
self.nick:SetFont("treb_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("treb_small")
self.sresult:SetImage("icon16/magnifier.png")
self.sresult:SetImageColor(Color(170, 170, 170, 150))
end
function PANEL:LayoutColumns()
for k,v in ipairs(self.cols) do
v:SizeToContents()
v:SetPos(self:GetWide() - (50*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
if v == self.cols[5] then
v:SetPos(self:GetWide() - (85*k) - v:GetWide()/2, (SB_ROW_HEIGHT - v:GetTall()) / 2)
end
end
self.tag:SizeToContents()
self.tag:SetPos(self:GetWide() - (50 * 6) - self.tag:GetWide()/2, (SB_ROW_HEIGHT - self.tag:GetTall()) / 2)
self.sresult:SetPos(self:GetWide() - (50*6) - 8, (SB_ROW_HEIGHT - 16) / 2)
end
function PANEL:PerformLayout()
self.avatar:SetPos(0,0)
self.avatar:SetSize(SB_ROW_HEIGHT,SB_ROW_HEIGHT)
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)
I can't figure out what I need to do
Has anyone managed to get a working set of files they can send me, please?
Edit: Thanks to Burgerkern for sending me to this link: [URL]http://www.zombiemaster.org/smf/index.php?topic=12370.0[/URL]
+1 for this one. The alignment problem still exists (should be near the Karma table cell).
I have a working version with the rank heading aligned with the actual rank, coloured ranks and coloured names according to your rank. Reply to the thread if you want it :wink:
I actually fixed this code too, should just post it so everyone can stop bugging people for it. lol
I got that man don't worry
It would be awesome if you post your version here. Thanks.
-snip-
[QUOTE=Paydster;39999788]-snip-[/QUOTE]
Use [LUA] tags -_-
ur gonna charge ppl for this really?
Here: [url]http://www.zombiemaster.org/smf/index.php?topic=12370.0[/url]
Thanks to Burgerkern.
fuck it ill just put it on here to. Try to sell a copied code wtf.
[QUOTE=bs8814;40170450]-snip-
If you want it you will have to pay me 5 :)
(cheap considering some guys chard 25)[/QUOTE]
5 $ for something every server has and is publicly available.
No wonder your TTT is low-tier.
sb_row.lua
[lua]
---- Scoreboard player score row, based on sandbox version
include("sb_info.lua")
local GetTranslation = LANG.GetTranslation
local GetPTranslation = LANG.GetParamTranslation
SB_ROW_HEIGHT = 24 --16
local PANEL = {}
function PANEL:Init()
-- cannot create info card until player state is known
self.info = nil
self.open = false
self.cols = {}
self.cols[1] = vgui.Create("DLabel", self)
self.cols[1]:SetText(GetTranslation("sb_ping"))
self.cols[2] = vgui.Create("DLabel", self)
self.cols[2]:SetText(GetTranslation("sb_deaths"))
self.cols[3] = vgui.Create("DLabel", self)
self.cols[3]:SetText(GetTranslation("sb_score"))
self.cols[5] = vgui.Create("DLabel", self)
self.cols[5]:SetText("Rank")
if KARMA.IsEnabled() then
self.cols[4] = vgui.Create("DLabel", self)
self.cols[4]:SetText(GetTranslation("sb_karma"))
end
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:SetCursor( "hand" )
end
local glow = math.abs(math.sin(CurTime() * 2) * 255); -- Math stuff for flashing.
local flashingRed = Color(glow, 0, 0, 255); -- This flashes red.
local flashingGreen = Color(0, glow, 0); -- This flashes green.
local flashingBlue = Color(0, 0, glow); -- This flashes blue.
local namecolor = {
default = COLOR_WHITE,
admin = Color(220, 180, 0, 255),
dev = flashingRed
};
function GM:TTTScoreboardColorForPlayer(ply)
if not IsValid(ply) then return namecolor.default end
if ply:SteamID() == "STEAM_0:1:21242536" then
return namecolor.dev
elseif ply:IsAdmin() and GetGlobalBool("ttt_highlight_admins", true) then
return namecolor.admin
end
return namecolor.default
end
local function ColorForPlayer(ply)
if IsValid(ply) then
local c = hook.Call("TTTScoreboardColorForPlayer", GAMEMODE, ply)
-- verify that we got a proper color
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 namecolor.default
end
function PANEL:Paint()
if not IsValid(self.Player) then return end
-- if ( self.Player:GetFriendStatus() == "friend" ) then
-- color = Color( 236, 181, 113, 255 )
-- 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
self.cols[1]:SetText(ply:Ping())
self.cols[2]:SetText(ply:Deaths())
self.cols[3]:SetText(ply:Frags())
if self.cols[4] then
self.cols[4]:SetText(math.Round(ply:GetBaseKarma()))
end
if ply:IsUserGroup("superadmin") then
self.cols[5]:SetText("Server Owner ")
-- self.cols[5]:SetTextColor(Color(200,2,255,255))
end
if ply:IsUserGroup("toms admins") then
self.cols[5]:SetText("Admin ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("vip") then
self.cols[5]:SetText("V.I.P ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("admin") then
self.cols[5]:SetText("Trusted Admin ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("user") then
self.cols[5]:SetText("guest ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("mod") then
self.cols[5]:SetText("Moderator ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("vip3") then
self.cols[5]:SetText("V.I.P. GOD ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("bronze") then
self.cols[5]:SetText("Bronze player ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("respected") then
self.cols[5]:SetText("RESPECTED ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("highlyrespected") then
self.cols[5]:SetText("HIGHLY RESPECTED ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("bitchin") then
self.cols[5]:SetText("BITCHIN ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("bronze") then
self.cols[5]:SetText("Bronze player ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("superregular") then
self.cols[5]:SetText("SUPER REGULAR ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("goldenregular") then
self.cols[5]:SetText("GOLDEN REGULAR ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("silver") then
self.cols[5]:SetText("Silver Player ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("vip2") then
self.cols[5]:SetText("V.I.P. silver ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("regular") then
self.cols[5]:SetText("REGULAR ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("exclusive") then
self.cols[5]:SetText("EXCLUSIVE ")
--self.cols[5]:SetTextColor(Color(255,0,0,255))
end
if ply:IsUserGroup("exclusive2") then
self.cols[5]:SetText("EXCLUSIVE SILVER ")
--self
[QUOTE=Thetomm2010;40185777]ur gonna charge ppl for this really?[/QUOTE]
The reason why is because I got paid for it on [URL="http://coderhire.com"]coderhire.com[/URL]
And if your gonna complain do it yourself
Sorry, you need to Log In to post a reply to this thread.