1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
local SCOREBOARD_FADE = Color(20,20,20,70)
local SCOREBOARD_OFF = 101
local SCOREBOARD_WIDTH = 700
local SCOREBOARD_X = ScrW() / 2 - SCOREBOARD_WIDTH / 2
local scoreboard = nil
function GM:ScoreboardShow()
local NPly = #player.GetAll()
local Tall = SCOREBOARD_OFF + 20 * NPly
local y = ScrH() / 2 - Tall / 2
local by = y + SCOREBOARD_OFF
scoreboard = vgui.Create("MBFrame")
if(!scoreboard) then return end
scoreboard:SetPos(SCOREBOARD_X,y)
scoreboard:SetSize(SCOREBOARD_WIDTH,Tall)
scoreboard:SetTitle("Scoreboard")
scoreboard:ShowCloseButton(false)
for i,v in pairs(player.GetAll()) do
print("Makeing label for " .. v:Nick())
local ypos = (20*(i-1))+24
local playerlabel = vgui.Create("MBLabel")
playerlabel:SetParent(scoreboard)
playerlabel:SetPos(2, ypos)
local ptext = v:Nick()
if(v:IsPigeon()) then
ptext = ptext .. " (Dead)"
end
playerlabel:AddText(ptext)
playerlabel:SetupLines()
local pinglabel = vgui.Create("MBLabel")
pinglabel:SetParent(scoreboard)
pinglabel:SetPos(SCOREBOARD_WIDTH-100,ypos)
pinglabel:AddText(v:Ping())
pinglabel:SetupLines()
--if(v == LocalPlayer()) then continue end
local mutebutton = vgui.Create("MBButton")
mutebutton:SetParent(scoreboard)
mutebutton:SetPos(SCOREBOARD_X,ypos)
if(v:IsMuted()) then
mutebutton.Text = "Mute"
mutebutton.OnClick = function()
self.Text = "Unmute"
print("Muteing " .. v:Nick())
v:SetMuted(true)
end
else
mutebutton.Text = "Unmute"
mutebutton.OnClick = function()
self.Text = "Mute"
print("Unmuteing " .. v:Nick())
v:SetMuted(false)
end
end
end
scoreboard:MakePopup()
--self.ShowSB = true
end
function GM:ScoreboardHide()
if(scoreboard) then
scoreboard:SetVisible(false)
end
--self.ShowSB = false
end
function GM:HUDDrawScoreBoard()
if (!self.ShowSB) then return end
local NPly = #player.GetAll()
local Tall = SCOREBOARD_OFF + 20 * NPly
local y = ScrH() / 2 - Tall / 2
local by = y + SCOREBOARD_OFF
DrawRect(SCOREBOARD_X, y, SCOREBOARD_WIDTH, Tall, MAIN_COLOR)
DrawRect(SCOREBOARD_X, by, SCOREBOARD_WIDTH, NPly*20, MAIN_COLORD)
DrawText(self.Name, "ScoreboardFont", ScrW()/2, y + 50, MAIN_TEXTCOLOR,1)
DrawText("By The Maw", "Trebuchet18", ScrW()/2-150, y + 80, MAIN_TEXTCOLOR,1)
for k,v in pairs( player.GetAll() ) do
local Y = by + 20 * (k-1)
DrawText("")
if (v:IsPigeon()) then
DrawText(v:Nick(), "Trebuchet18", SCOREBOARD_X + 2, Y, MAIN_GREYCOLOR)
DrawText(v:Ping(), "Trebuchet18", SCOREBOARD_X + SCOREBOARD_WIDTH - 30, Y, MAIN_GREYCOLOR)
else
DrawText(v:Nick(), "Trebuchet18", SCOREBOARD_X + 2, Y, MAIN_TEXTCOLOR)
DrawText(v:Ping(), "Trebuchet18", SCOREBOARD_X + SCOREBOARD_WIDTH - 30, Y, MAIN_TEXTCOLOR)
end
end
end
|