Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.93 KB | None | 0 0
  1. // ---------------------------------------------------
  2.  
  3. // Scoreboard 99% created by Jackool/Alex Frison
  4.  
  5. // www.AlexFrison.us www.Devolved.us community
  6.  
  7. // ---------------------------------------------------
  8.  
  9.  
  10.  
  11. surface.CreateFont( "SB_TTT_Title", {
  12.  
  13. font = "Arial",
  14.  
  15. size = 37,
  16.  
  17. weight = 900,
  18.  
  19. blursize = 0,
  20.  
  21. scanlines = 0,
  22.  
  23. antialias = true,
  24.  
  25. underline = false,
  26.  
  27. italic = false,
  28.  
  29. strikeout = false,
  30.  
  31. symbol = false,
  32.  
  33. rotary = false,
  34.  
  35. shadow = false,
  36.  
  37. additive = false,
  38.  
  39. outline = true
  40.  
  41. } )
  42.  
  43.  
  44.  
  45. surface.CreateFont( "SB_TTT_Mute", {
  46.  
  47. font = "Arial",
  48.  
  49. size = 20,
  50.  
  51. weight = 600,
  52.  
  53. blursize = 0,
  54.  
  55. scanlines = 0,
  56.  
  57. antialias = true,
  58.  
  59. underline = false,
  60.  
  61. italic = false,
  62.  
  63. strikeout = false,
  64.  
  65. symbol = false,
  66.  
  67. rotary = false,
  68.  
  69. shadow = true,
  70.  
  71. additive = false,
  72.  
  73. outline = true
  74.  
  75. } )
  76.  
  77.  
  78.  
  79.  
  80.  
  81. surface.CreateFont( "SB_TTT_Map", {
  82.  
  83. font = "Arial",
  84.  
  85. size = 19,
  86.  
  87. weight = 900,
  88.  
  89. blursize = 0,
  90.  
  91. scanlines = 0,
  92.  
  93. antialias = true,
  94.  
  95. underline = false,
  96.  
  97. italic = false,
  98.  
  99. strikeout = false,
  100.  
  101. symbol = false,
  102.  
  103. rotary = false,
  104.  
  105. shadow = false,
  106.  
  107. additive = false,
  108.  
  109. outline = true
  110.  
  111. } )
  112.  
  113.  
  114.  
  115. surface.CreateFont( "SB_TTT_Header", {
  116.  
  117. font = "coolvetica",
  118.  
  119. size = 21,
  120.  
  121. weight = 20,
  122.  
  123. blursize = 0,
  124.  
  125. scanlines = 0,
  126.  
  127. antialias = true,
  128.  
  129. underline = false,
  130.  
  131. italic = false,
  132.  
  133. strikeout = false,
  134.  
  135. symbol = false,
  136.  
  137. rotary = false,
  138.  
  139. shadow = false,
  140.  
  141. additive = false,
  142.  
  143. outline = true
  144.  
  145. } )
  146.  
  147.  
  148.  
  149. surface.CreateFont( "SB_TTT_Ply", {
  150.  
  151. font = "Arial",
  152.  
  153. size = 20,
  154.  
  155. weight = 640,
  156.  
  157. blursize = 0,
  158.  
  159. scanlines = 0,
  160.  
  161. antialias = true,
  162.  
  163. underline = false,
  164.  
  165. italic = false,
  166.  
  167. strikeout = false,
  168.  
  169. symbol = false,
  170.  
  171. rotary = false,
  172.  
  173. shadow = false,
  174.  
  175. additive = false,
  176.  
  177. outline = false
  178.  
  179. } )
  180.  
  181.  
  182.  
  183. surface.CreateFont( "SB_TTT_PInfo", {
  184.  
  185. font = "Arial",
  186.  
  187. size = 17,
  188.  
  189. weight = 640,
  190.  
  191. blursize = 0,
  192.  
  193. scanlines = 0,
  194.  
  195. antialias = true,
  196.  
  197. underline = false,
  198.  
  199. italic = false,
  200.  
  201. strikeout = false,
  202.  
  203. symbol = false,
  204.  
  205. rotary = false,
  206.  
  207. shadow = false,
  208.  
  209. additive = false,
  210.  
  211. outline = false
  212.  
  213. } )
  214.  
  215.  
  216.  
  217.  
  218.  
  219. surface.CreateFont( "SB_TTT_Lvl", {
  220.  
  221. font = "Arial",
  222.  
  223. size = 15,
  224.  
  225. weight = 650,
  226.  
  227. blursize = 0,
  228.  
  229. scanlines = 0,
  230.  
  231. antialias = false,
  232.  
  233. underline = false,
  234.  
  235. italic = false,
  236.  
  237. strikeout = false,
  238.  
  239. symbol = false,
  240.  
  241. rotary = false,
  242.  
  243. shadow = false,
  244.  
  245. additive = false,
  246.  
  247. outline = true
  248.  
  249. } )
  250.  
  251.  
  252.  
  253. surface.CreateFont( "SB_TTT_GraphNum", {
  254.  
  255. font = "Arial",
  256.  
  257. size = 12,
  258.  
  259. weight = 0,
  260.  
  261. blursize = 0,
  262.  
  263. scanlines = 0,
  264.  
  265. antialias = true,
  266.  
  267. underline = false,
  268.  
  269. italic = false,
  270.  
  271. strikeout = false,
  272.  
  273. symbol = false,
  274.  
  275. rotary = false,
  276.  
  277. shadow = false,
  278.  
  279. additive = false,
  280.  
  281. outline = false
  282.  
  283. } )
  284.  
  285.  
  286.  
  287. surface.CreateFont( "SB_TTT_TopTxt", {
  288.  
  289. font = "Arial",
  290.  
  291. size = 18,
  292.  
  293. weight = 650,
  294.  
  295. blursize = 0,
  296.  
  297. scanlines = 0,
  298.  
  299. antialias = true,
  300.  
  301. underline = false,
  302.  
  303. italic = false,
  304.  
  305. strikeout = false,
  306.  
  307. symbol = false,
  308.  
  309. rotary = false,
  310.  
  311. shadow = false,
  312.  
  313. additive = false,
  314.  
  315. outline = true
  316.  
  317. } )
  318.  
  319.  
  320.  
  321.  
  322.  
  323. // This part is from the TTT scoreboard
  324.  
  325. GROUP_TERROR = 1
  326.  
  327. GROUP_NOTFOUND = 2
  328.  
  329. GROUP_FOUND = 3
  330.  
  331. GROUP_SPEC = 4
  332.  
  333.  
  334.  
  335. local function ScoreGroup(p)
  336.  
  337. if not IsValid(p) then return -1 end -- will not match any group panel
  338.  
  339.  
  340.  
  341. if DetectiveMode() then
  342.  
  343. if (p:IsSpec() and (not p:Alive())) or p.DeathDM then
  344.  
  345. if p:GetNWBool("body_found", false) then
  346.  
  347. return GROUP_FOUND
  348.  
  349. else
  350.  
  351. local client = LocalPlayer()
  352.  
  353. -- To terrorists, missing players show as alive
  354.  
  355. if client:IsSpec() or
  356.  
  357. client:IsActiveTraitor() or
  358.  
  359. client.DeathDM or
  360.  
  361. ((GAMEMODE.round_state != ROUND_ACTIVE) and client:IsTerror()) then
  362.  
  363. return GROUP_NOTFOUND
  364.  
  365. else
  366.  
  367. return GROUP_TERROR
  368.  
  369. end
  370.  
  371. end
  372.  
  373. end
  374.  
  375. end
  376.  
  377.  
  378.  
  379. return (p:IsTerror() and GROUP_TERROR) or (p.DeathDM and ((!p:GetNWBool("body_found") and ((LocalPlayer():IsTraitor() and GROUP_NOTFOUND) or GROUP_TERROR)) or GROUP_FOUND)) or GROUP_SPEC
  380.  
  381. end
  382.  
  383.  
  384.  
  385. // The rest created by Jackool/Alex Frison
  386.  
  387. // www.Devolved.us
  388.  
  389.  
  390.  
  391. local Dev = {}
  392.  
  393.  
  394.  
  395. function Dev.ViewStats(ply)
  396.  
  397. net.Start("Dev_OpenStats")
  398.  
  399. net.WriteEntity(ply)
  400.  
  401. net.SendToServer()
  402.  
  403. end
  404.  
  405.  
  406.  
  407. function Dev.ViewPT(ply)
  408.  
  409. net.Start("Dev_OpenPlaytime")
  410.  
  411. net.WriteEntity(ply)
  412.  
  413. net.SendToServer()
  414.  
  415. end
  416.  
  417.  
  418.  
  419. Dev.NiceStatNames = {tkills = "T Kills",maprate = "Maps Rated",scratch = "Scratch Cards Scratched",crateopen = "Crates Unlocked",cratefound="Crate Drops Found",postalive = "Post Survivals",postround = "Post Round Kills",drunkkill = "Drunk Kills",specdm = "Spec DM Kills",headshot = "Headshot Kills",lstand = "Last Stands",beers = "Beers Consumed",jihad = "Jihads",bucks="DevBucks",harda="Hard Alcohol Consumed"}
  420.  
  421. function Dev.StatsWindow(size)
  422.  
  423. local who,stats = net.ReadEntity(),net.ReadTable()
  424.  
  425. if who and who:IsValid() and stats then
  426.  
  427. local Count = 0
  428.  
  429. for k,v in pairs(stats) do Count = Count+1 end
  430.  
  431.  
  432.  
  433. // Stats frame (right click > view stats on SB)
  434.  
  435. local Stats,SizeY = vgui.Create("DFrame"),(Count*15+38)
  436.  
  437. Stats:SetSize(200,SizeY)
  438.  
  439. Stats:MakePopup()
  440.  
  441. Stats:SetPos(ScrW()*.5-100,ScrH()+SizeY+10)
  442.  
  443. Stats:MoveTo(ScrW()*.5-100,ScrH()*.5-(SizeY*.5),.26,0,.3)
  444.  
  445. Stats:SetTitle("Stats for: " .. who:Name())
  446.  
  447. Stats.Paint = function(s,w,h)
  448.  
  449. draw.RoundedBox(0,0,0,w,h,Color(0,0,0,250))
  450.  
  451. draw.RoundedBox(0,2,2,w-4,h-4,Color(80,80,80,140))
  452.  
  453. draw.RoundedBox(0,2,2,w-4,24,Color(120,120,120,140))
  454.  
  455. end
  456.  
  457.  
  458.  
  459. // Total level first
  460.  
  461. local stat = vgui.Create("DLabel",Stats)
  462.  
  463. stat:SetPos(9,30)
  464.  
  465. stat:SetText("Total Level: " .. stats.totallvl)
  466.  
  467. stat:SizeToContents()
  468.  
  469. stat:SetColor(Color(200,0,0))
  470.  
  471.  
  472.  
  473. // Then DevBucks
  474.  
  475. local stat = vgui.Create("DLabel",Stats)
  476.  
  477. stat:SetPos(9,45)
  478.  
  479. stat:SetText("DevBucks: " .. stats.bucks)
  480.  
  481. stat:SizeToContents()
  482.  
  483. stat:SetColor(Color(0,200,0))
  484.  
  485.  
  486.  
  487. local num = 1
  488.  
  489. for k,v in pairs(stats) do
  490.  
  491. if k == "totallvl" or k == "bucks" then continue end
  492.  
  493. num = num+1
  494.  
  495. local stat = vgui.Create("DLabel",Stats)
  496.  
  497. stat:SetPos(9,num*15+30)
  498.  
  499. stat:SetText((Dev.NiceStatNames[k] or k) .. ": " .. v)
  500.  
  501. stat:SizeToContents()
  502.  
  503. end
  504.  
  505. end
  506.  
  507. end
  508.  
  509. net.Receive("Dev_SendStats",Dev.StatsWindow)
  510.  
  511.  
  512.  
  513. Dev.GraphDot = Material("Devolved/graph_dot.png","nocull")
  514.  
  515. Dev.GraphDotLrg = Material("Devolved/graph_dot_lrg.png","nocull")
  516.  
  517.  
  518.  
  519. function Dev.SendPlaytime(size)
  520.  
  521. local Year,Month,Day,Hour = net.ReadFloat(),net.ReadFloat(),net.ReadFloat(),net.ReadFloat()
  522.  
  523. local PT = net.ReadTable()
  524.  
  525. local B = {TopTxt = "",TotalTime = 0}
  526.  
  527.  
  528.  
  529. B.Display = "Week"
  530.  
  531.  
  532.  
  533. local WindowW,WindowH = math.Clamp(900,0,ScrW()),math.Clamp(250,0,ScrH())
  534.  
  535. B.BG = vgui.Create("DFrame")
  536.  
  537. B.BG:SetSize(WindowW,WindowH)
  538.  
  539. B.BG:MakePopup()
  540.  
  541. B.BG:Center()
  542.  
  543. B.BG.Paint = function(s,w,h)
  544.  
  545. draw.RoundedBox(0,0,0,w,h,Color(0,0,0,250))
  546.  
  547. draw.RoundedBox(0,2,2,w-4,h-4,Color(80,80,80,140))
  548.  
  549. draw.RoundedBox(0,2,2,w-4,24,Color(120,120,120,140))
  550.  
  551.  
  552.  
  553. draw.DrawText(B.TopTxt .. B.TotalTime .. " minutes", "SB_TTT_TopTxt", w*.5, 32, Color(255,255,255,200),TEXT_ALIGN_CENTER)
  554.  
  555. end
  556.  
  557. B.BG:SetTitle("Playtime graph for " .. net.ReadString())
  558.  
  559. B.BG:SetPos(ScrW()*.5-(WindowW*.5),ScrH()+WindowH*.5)
  560.  
  561. B.BG:MoveTo(ScrW()*.5-(WindowW*.5),ScrH()*.5-(WindowH*.5),.26,0,.3)
  562.  
  563.  
  564.  
  565. local function GeneratePlots(Days)
  566.  
  567. B.TotalTime = 0
  568.  
  569. B.GraphDivide = 1440
  570.  
  571. B.Graph = {}
  572.  
  573. local Before = Day-Days
  574.  
  575. if Before <= 0 then
  576.  
  577. Before = Days+Before
  578.  
  579. local PlotNum = 1
  580.  
  581. local NewYear = (Month-1 <= 0 and Year-1) or Year
  582.  
  583. local NewMonth = (Month-1 <= 0 and 12+(Month-1)) or (Month-1)
  584.  
  585.  
  586.  
  587. for i=Before,Days do
  588.  
  589. local check = 0
  590.  
  591.  
  592.  
  593. if PT[NewYear] and PT[NewYear][NewMonth-1] and PT[NewYear][NewMonth-1][i] then
  594.  
  595. for k,v in pairs(PT[NewYear][NewMonth-1][i]) do check=check+v end
  596.  
  597. end
  598.  
  599. B.Graph[PlotNum] = {}
  600.  
  601. B.Graph[PlotNum].time = check
  602.  
  603. B.Graph[PlotNum].str = NewMonth .. "/" .. i .. "/" .. NewYear
  604.  
  605. PlotNum = PlotNum+1
  606.  
  607. B.TotalTime = B.TotalTime+check
  608.  
  609. end
  610.  
  611. for i=1,Day do
  612.  
  613. local check = 0
  614.  
  615.  
  616.  
  617. if PT[Year] and PT[Year][Month] and PT[Year][Month][i] then
  618.  
  619. for k,v in pairs(PT[Year][Month][i]) do check=check+v end
  620.  
  621. end
  622.  
  623. B.Graph[PlotNum] = {}
  624.  
  625. B.Graph[PlotNum].time = check
  626.  
  627. B.Graph[PlotNum].str = Month .. "/" .. i .. "/" .. Year
  628.  
  629. PlotNum = PlotNum+1
  630.  
  631. B.TotalTime = B.TotalTime+check
  632.  
  633. end
  634.  
  635. else
  636.  
  637. local PlotNum = 1
  638.  
  639. for i=Before,Day do
  640.  
  641. local check = 0
  642.  
  643. if PT[Year] and PT[Year][Month] and PT[Year][Month][i] then
  644.  
  645. for k,v in pairs(PT[Year][Month][i]) do check = check+v end
  646.  
  647. end
  648.  
  649.  
  650.  
  651. B.Graph[PlotNum] = {}
  652.  
  653. B.Graph[PlotNum].time = check
  654.  
  655. B.Graph[PlotNum].str = Month .. "/" .. i
  656.  
  657. B.TotalTime = B.TotalTime+check
  658.  
  659. PlotNum = PlotNum+1
  660.  
  661. end
  662.  
  663. end
  664.  
  665.  
  666.  
  667. end
  668.  
  669.  
  670.  
  671. local function GeneratePlotsHour(Hrs)
  672.  
  673. B.TotalTime = 0
  674.  
  675. B.GraphDivide = 60
  676.  
  677. B.Graph = {}
  678.  
  679. local Before = Hour-Hrs
  680.  
  681. if Before <= 0 then
  682.  
  683. Before = 23+Before
  684.  
  685. local PlotNum = 1
  686.  
  687.  
  688.  
  689. local datetbl = os.time({year = Year,month = Month, day=Day-1})
  690.  
  691. local NewYear = tonumber(os.date("%Y",datetbl))
  692.  
  693. local NewMonth = tonumber(os.date("%m",datetbl))
  694.  
  695. local NewDay = tonumber(os.date("%d",datetbl))
  696.  
  697.  
  698.  
  699. for i=Before+1,24 do
  700.  
  701. local check = 0
  702.  
  703.  
  704.  
  705. if PT[NewYear] and PT[NewYear][NewMonth] and PT[NewYear][NewMonth][NewDay] and PT[NewYear][NewMonth][NewDay][i] then
  706.  
  707. check = PT[NewYear][NewMonth][NewDay][i]
  708.  
  709. end
  710.  
  711. B.Graph[PlotNum] = {}
  712.  
  713. B.Graph[PlotNum].time = check
  714.  
  715. B.Graph[PlotNum].str = NewMonth .. "/" .. NewDay .. "\n" .. os.date("%I %p",os.time({year = NewYear,month = NewMonth, day=NewDay, hour=i}))
  716.  
  717. PlotNum = PlotNum+1
  718.  
  719. B.TotalTime = B.TotalTime+check
  720.  
  721. end
  722.  
  723. for i=1,(Hrs-(23-Before)) do
  724.  
  725. local check = 0
  726.  
  727.  
  728.  
  729. if PT[Year] and PT[Year][Month] and PT[Year][Month][Day] and PT[Year][Month][Day][i] then
  730.  
  731. check = PT[Year][Month][Day][i]
  732.  
  733. end
  734.  
  735. B.Graph[PlotNum] = {}
  736.  
  737. B.Graph[PlotNum].time = check
  738.  
  739. B.Graph[PlotNum].str = Month .. "/" .. Day .. "\n" .. os.date("%I %p",os.time({year = Year,month = Month, day=Day, hour=i}))
  740.  
  741. PlotNum = PlotNum+1
  742.  
  743. B.TotalTime = B.TotalTime+check
  744.  
  745. end
  746.  
  747. else
  748.  
  749. local PlotNum = 1
  750.  
  751. for i=0,23 do
  752.  
  753. local check = 0
  754.  
  755. if PT[Year] and PT[Year][Month] and PT[Year][Month][Day] and PT[Year][Month][Day][i] then
  756.  
  757. check = PT[Year][Month][Day][i]
  758.  
  759. end
  760.  
  761.  
  762.  
  763. B.Graph[PlotNum] = {}
  764.  
  765. B.Graph[PlotNum].time = check
  766.  
  767. B.Graph[PlotNum].str = Month .. "/" .. i .. "\n" .. i .. ":00"
  768.  
  769. B.TotalTime = B.TotalTime+check
  770.  
  771. PlotNum = PlotNum+1
  772.  
  773. end
  774.  
  775. end
  776.  
  777.  
  778.  
  779. end
  780.  
  781.  
  782.  
  783. B.LastMonth = vgui.Create("DButton",B.BG)
  784.  
  785. B.LastMonth:SetPos(6,30)
  786.  
  787. B.LastMonth:SetSize(65,20)
  788.  
  789. B.LastMonth:SetText("Last Month")
  790.  
  791. B.LastMonth.DoClick = function()
  792.  
  793. GeneratePlots(31)
  794.  
  795. B.TopTxt = "Last Month: "
  796.  
  797. end
  798.  
  799.  
  800.  
  801. B.Last2Week = vgui.Create("DButton",B.BG)
  802.  
  803. B.Last2Week:SetPos(73,30)
  804.  
  805. B.Last2Week:SetSize(74,20)
  806.  
  807. B.Last2Week:SetText("Last 2 Weeks")
  808.  
  809. B.Last2Week.DoClick = function()
  810.  
  811. GeneratePlots(14)
  812.  
  813. B.TopTxt = "Last 2 Weeks: "
  814.  
  815. end
  816.  
  817.  
  818.  
  819. B.LastWeek = vgui.Create("DButton",B.BG)
  820.  
  821. B.LastWeek:SetPos(149,30)
  822.  
  823. B.LastWeek:SetSize(65,20)
  824.  
  825. B.LastWeek:SetText("Last Week")
  826.  
  827. B.LastWeek.DoClick = function()
  828.  
  829. GeneratePlots(7)
  830.  
  831. B.TopTxt = "Last Week: "
  832.  
  833. end
  834.  
  835.  
  836.  
  837. B.LastDay = vgui.Create("DButton",B.BG)
  838.  
  839. B.LastDay:SetPos(216,30)
  840.  
  841. B.LastDay:SetSize(65,20)
  842.  
  843. B.LastDay:SetText("Last Day")
  844.  
  845. B.LastDay.DoClick = function()
  846.  
  847. B.TopTxt = "Last Day: "
  848.  
  849. GeneratePlotsHour(24)
  850.  
  851. end
  852.  
  853.  
  854.  
  855. GeneratePlots(7)
  856.  
  857. B.TopTxt = "Last Week: "
  858.  
  859.  
  860.  
  861. //ply.DTTT.playtime[Year] = ply.DTTT.playtime[Year] or {}
  862.  
  863. //ply.DTTT.playtime[Year][Day] = ply.DTTT.playtime[Year][Day] or {}
  864.  
  865. //ply.DTTT.playtime[Year][Day][Hour] = ply.DTTT.playtime[Year][Day][Hour] or 0
  866.  
  867.  
  868.  
  869. local GraphW,GraphH = WindowW-12,WindowH-60
  870.  
  871.  
  872.  
  873. local LineH = GraphH-2
  874.  
  875.  
  876.  
  877. B.GraphDisplay = vgui.Create("DPanel",B.BG)
  878.  
  879. B.GraphDisplay:SetPos(6,54)
  880.  
  881. B.GraphDisplay:SetSize(GraphW,GraphH)
  882.  
  883. B.GraphDisplay.Paint = function(s,w,h)
  884.  
  885. draw.RoundedBox(0,0,0,w,h,Color(120,120,120,140))
  886.  
  887.  
  888.  
  889. local MaxNum = table.Count(B.Graph)
  890.  
  891.  
  892.  
  893. local Pts = (1/(MaxNum-1))*GraphW
  894.  
  895. local CurPt = 0
  896.  
  897.  
  898.  
  899. local mX,mY = gui.MousePos()
  900.  
  901. local addX,addY = B.GraphDisplay:LocalToScreen()
  902.  
  903.  
  904.  
  905. for k,v in pairs(B.Graph) do
  906.  
  907. local nexttotal = (B.Graph[k+1] and B.Graph[k+1].time) or 0
  908.  
  909. surface.SetDrawColor(Color(0,0,0))
  910.  
  911. surface.DrawLine(CurPt*Pts,LineH-(LineH*(v.time/B.GraphDivide)),CurPt*Pts+Pts,LineH-(LineH*(nexttotal/B.GraphDivide)))
  912.  
  913. //surface.DrawCircle(CurPt*Pts,LineH-(LineH*(total/B.GraphDivide)),1,Color(0,0,0))
  914.  
  915. /*
  916.  
  917. surface.DrawRect((CurPt*Pts)-3,(LineH-(LineH*(v.time/B.GraphDivide)))-1,6,6)
  918.  
  919. */
  920.  
  921. local dotX,dotY = (CurPt*Pts)-3,(LineH-(LineH*(v.time/B.GraphDivide)))-3
  922.  
  923. local DotX,DotY = addX+dotX,addY+dotY
  924.  
  925. if (mX >= DotX-9 and mX <= DotX+17 and mY >= DotY-8 and mY <= DotY+16) then
  926.  
  927.  
  928.  
  929. surface.SetDrawColor( 255, 255, 255, 255 )
  930.  
  931. surface.SetMaterial(Dev.GraphDotLrg)
  932.  
  933. surface.DrawTexturedRect((CurPt*Pts)-5,(LineH-(LineH*(v.time/B.GraphDivide)))-5, 13, 13 )
  934.  
  935.  
  936.  
  937. local TxtY = (LineH-(LineH*(v.time/B.GraphDivide)))-38
  938.  
  939. if TxtY <= 10 then TxtY = 10 end
  940.  
  941.  
  942.  
  943. draw.DrawText(v.str .. "\n" .. v.time .. " min.", "SB_TTT_GraphNum", dotX+8-(k == MaxNum and 10 or 0), TxtY, Color(255,255,255),(k == MaxNum and TEXT_ALIGN_RIGHT) or TEXT_ALIGN_LEFT)
  944.  
  945. else
  946.  
  947. surface.SetDrawColor( 255, 255, 255, 255 )
  948.  
  949. surface.SetMaterial(Dev.GraphDot)
  950.  
  951. surface.DrawTexturedRect(dotX,dotY, 8, 8 )
  952.  
  953. end
  954.  
  955.  
  956.  
  957. CurPt = CurPt+1
  958.  
  959. end
  960.  
  961.  
  962.  
  963. end
  964.  
  965.  
  966.  
  967. end
  968.  
  969. net.Receive("Dev_SendPlaytime",Dev.SendPlaytime)
  970.  
  971.  
  972.  
  973. // Rules
  974.  
  975. function RulesBrowser()
  976.  
  977. local Frame = vgui.Create("web_browser")
  978.  
  979. Frame:SetSize(ScrW()*.9,ScrH()*.9)
  980.  
  981. Frame:SetZPos(-50)
  982.  
  983. Frame:SetDrawOnTop(true)
  984.  
  985. Frame:MoveToFront()
  986.  
  987. Frame:MakePopup()
  988.  
  989. Frame.Paint = function(s,w,h)
  990.  
  991. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,40))
  992.  
  993. draw.RoundedBox(4,2,2,w-4,h-4,Color(0,0,0,200))
  994.  
  995. end
  996.  
  997. Frame:Center()
  998.  
  999. Frame:OpenURL("http://devolved.us/forum/index.php?topic=1674")
  1000.  
  1001. Frame:SetTitle("Devolved.us TTT Rules")
  1002.  
  1003. end
  1004.  
  1005.  
  1006.  
  1007. function LookupBans(name,sid)
  1008.  
  1009. local Frame = vgui.Create("web_browser")
  1010.  
  1011. Frame:SetSize(ScrW()*.9,ScrH()*.9)
  1012.  
  1013. Frame:SetZPos(-50)
  1014.  
  1015. Frame:SetDrawOnTop(true)
  1016.  
  1017. Frame:MoveToFront()
  1018.  
  1019. Frame:MakePopup()
  1020.  
  1021. Frame.Paint = function(s,w,h)
  1022.  
  1023. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,40))
  1024.  
  1025. draw.RoundedBox(4,2,2,w-4,h-4,Color(0,0,0,200))
  1026.  
  1027. end
  1028.  
  1029. Frame:Center()
  1030.  
  1031. Frame:OpenURL("http://devolved.us/bans/search/" .. sid .. "/")
  1032.  
  1033. Frame:SetTitle("Looking up bans for user: " .. name)
  1034.  
  1035. end
  1036.  
  1037.  
  1038.  
  1039. function SteamProfile(sid,name)
  1040.  
  1041. local Frame = vgui.Create("web_browser")
  1042.  
  1043. Frame:SetSize(ScrW()*.9,ScrH()*.9)
  1044.  
  1045. Frame:SetZPos(-50)
  1046.  
  1047. Frame:SetDrawOnTop(true)
  1048.  
  1049. Frame:MoveToFront()
  1050.  
  1051. Frame:MakePopup()
  1052.  
  1053. Frame.Paint = function(s,w,h)
  1054.  
  1055. draw.RoundedBox(4,0,0,w,h,Color(255,255,255,40))
  1056.  
  1057. draw.RoundedBox(4,2,2,w-4,h-4,Color(0,0,0,200))
  1058.  
  1059. end
  1060.  
  1061. Frame:Center()
  1062.  
  1063. Frame:OpenURL("steamcommunity.com/profiles/" .. sid .. "/")
  1064.  
  1065. Frame:SetTitle("Viewing Steam Profile for: " .. name)
  1066.  
  1067. end
  1068.  
  1069.  
  1070.  
  1071. COLOR_GREEN = Color(0,255,0)
  1072.  
  1073. COLOR_YELLOW = Color(200,200,0)
  1074.  
  1075. COLOR_RED = Color(255,0,0)
  1076.  
  1077. COLOR_WHITE = Color(255,255,255)
  1078.  
  1079. COLOR_BLACK = Color(0,0,0)
  1080.  
  1081.  
  1082.  
  1083. // Player tags (on click)
  1084.  
  1085. Dev.Tags = {
  1086.  
  1087. {txt="FRIEND",clr=COLOR_GREEN},
  1088.  
  1089. {txt="SUSPECT",clr=COLOR_YELLOW},
  1090.  
  1091. {txt="AVOID",clr=Color(255, 150, 0, 255)},
  1092.  
  1093. {txt="KILL",clr=COLOR_RED},
  1094.  
  1095. {txt="MISSING",clr=Color(130, 190, 130, 255)}
  1096.  
  1097. }
  1098.  
  1099.  
  1100.  
  1101. local SBText = "Devolved.us TTT West"
  1102.  
  1103.  
  1104.  
  1105. hook.Add("InitPostEntity","Change scoreboard text to east",function()
  1106.  
  1107. if string.find(string.lower(GetHostName()),"east") then
  1108.  
  1109. SBText = "Devolved.us TTT East"
  1110.  
  1111. end
  1112.  
  1113. end)
  1114.  
  1115.  
  1116.  
  1117. local FirstSend,DoMuteAll
  1118.  
  1119. Dev.SB_Logo = Material("Devolved/sb_ttt_logo.png")
  1120.  
  1121. Dev.SB_Top = Material("Devolved/sb_ttt_top.png")
  1122.  
  1123. Dev.SB_Header = Material("Devolved/sb_ttt_header.png")
  1124.  
  1125. Dev.SB_BG = Material("Devolved/sb_ttt_bg.png")
  1126.  
  1127. Dev.SB_Ply = Material("Devolved/sb_ttt_ply.png")
  1128.  
  1129. function Dev.CreateSB()
  1130.  
  1131. if Dev.SB and Dev.SB:IsValid() then Dev.SB:Close() end
  1132.  
  1133. if Dev_SB and Dev_SB:IsValid() then Dev_SB:Close() end
  1134.  
  1135.  
  1136.  
  1137. local function SB_AddPlayer() end
  1138.  
  1139. local function SB_AddHeader() end
  1140.  
  1141. local function SB_RefreshPList() end
  1142.  
  1143.  
  1144.  
  1145. if !FirstSend then
  1146.  
  1147. FirstSend = true
  1148.  
  1149. net.Start("Dev_SendPlysInfo")
  1150.  
  1151. net.SendToServer()
  1152.  
  1153. end
  1154.  
  1155.  
  1156.  
  1157. // Restore last mouse position
  1158.  
  1159. if Dev.MouseX and Dev.MouseY then
  1160.  
  1161. gui.SetMousePos(Dev.MouseX,Dev.MouseY)
  1162.  
  1163. end
  1164.  
  1165.  
  1166.  
  1167. local B = {} // vgui element table
  1168.  
  1169.  
  1170.  
  1171. local W,H = ScrW(),ScrH()
  1172.  
  1173.  
  1174.  
  1175. local SB_W,SB_H = math.Clamp(940,0,W),H*.94
  1176.  
  1177.  
  1178.  
  1179. if W < 1300 then SB_W = math.Clamp(750,0,W) end
  1180.  
  1181.  
  1182.  
  1183. local BG_Space = 96
  1184.  
  1185.  
  1186.  
  1187. // This holds all the elements
  1188.  
  1189. Dev.SB = vgui.Create("DFrame")
  1190.  
  1191. Dev.SB:SetSize(SB_W,SB_H)
  1192.  
  1193. Dev.SB.Paint = function(s,w,h)
  1194.  
  1195. // Main BG
  1196.  
  1197. draw.RoundedBox(0,0,61,SB_W,BG_Space,Color(0,0,0,220))
  1198.  
  1199.  
  1200.  
  1201. // Map change text
  1202.  
  1203. draw.DrawText("Map vote in " .. (5-(DevRound or 0)) .. " rounds (or type !rtv)", "SB_TTT_Map", w*.5, 132, Color(255,255,255,200),TEXT_ALIGN_CENTER)
  1204.  
  1205. draw.DrawText("Mute all players", "SB_TTT_Mute", w-21, 39, Color(255,255,255,190),TEXT_ALIGN_RIGHT)
  1206.  
  1207. end
  1208.  
  1209. Dev.SB:SetTitle("")
  1210.  
  1211. Dev.SB:SetDraggable(false)
  1212.  
  1213. Dev.SB:ShowCloseButton(false)
  1214.  
  1215. Dev.SB:SetDrawOnTop(false)
  1216.  
  1217. Dev.SB:SetZPos(-100)
  1218.  
  1219. Dev.SB:MoveToBack()
  1220.  
  1221. local oldClose = Dev.SB.Close
  1222.  
  1223. Dev.SB.Close = function(...)
  1224.  
  1225. if B.Opts and B.Opts:IsValid() then B.Opts:Remove() end
  1226.  
  1227. return oldClose(...)
  1228.  
  1229. end
  1230.  
  1231. Dev_SB = Dev.SB
  1232.  
  1233.  
  1234.  
  1235. B.Rules = vgui.Create("DButton",Dev.SB)
  1236.  
  1237. B.Rules:SetSize(150,24)
  1238.  
  1239. B.Rules:SetText("Click here to view the rules")
  1240.  
  1241. B.Rules.Paint = function(s,w,h)
  1242.  
  1243. draw.RoundedBox(0,0,0,w,h,Color(0,0,0,120+(s.In and 80 or 0)))
  1244.  
  1245. draw.RoundedBox(0,2,2,w-4,h-4,Color(255,255,255,150-(s.In and 40 or 0)))
  1246.  
  1247. end
  1248.  
  1249. B.Rules.OnCursorEntered = function(s) s.In = true end
  1250.  
  1251. B.Rules.OnCursorExited = function(s) s.In = false end
  1252.  
  1253. B.Rules.DoClick = function(s) RulesBrowser() end
  1254.  
  1255. B.Rules:SetPos(SB_W-158,130)
  1256.  
  1257.  
  1258.  
  1259. // Title/header element
  1260.  
  1261. B.HeaderAm = math.ceil((SB_W-4)/60)-1
  1262.  
  1263. B.Header = vgui.Create("DPanel",Dev.SB)
  1264.  
  1265. B.Header:SetPos(2,62)
  1266.  
  1267. B.Header:SetSize(SB_W-4,64)
  1268.  
  1269. B.Header.Paint = function(s,w,h)
  1270.  
  1271. // Header BG
  1272.  
  1273. draw.RoundedBox(0,0,0,w,h,Color(0,0,0,246))
  1274.  
  1275. for i=0,B.HeaderAm do
  1276.  
  1277. surface.SetDrawColor( 255, 255, 255, 255 )
  1278.  
  1279. surface.SetMaterial(Dev.SB_Top)
  1280.  
  1281. surface.DrawTexturedRect( i*60, 2, 60, 60 )
  1282.  
  1283. end
  1284.  
  1285.  
  1286.  
  1287. // Get title font width
  1288.  
  1289. local TitleW = 0
  1290.  
  1291. surface.SetFont("SB_TTT_Title")
  1292.  
  1293. TitleW = surface.GetTextSize(SBText)
  1294.  
  1295.  
  1296.  
  1297. // Title and title BG
  1298.  
  1299. draw.RoundedBox(4,(w-12)-TitleW-4-2,14,TitleW+12,38,Color(0,0,0,150))
  1300.  
  1301. draw.RoundedBox(4,(w-12)-TitleW-4,16,TitleW+8,34,Color(160,160,160,120))
  1302.  
  1303. draw.DrawText(SBText, "SB_TTT_Title", w-12, 14, Color(255,255,255,200),TEXT_ALIGN_RIGHT)
  1304.  
  1305.  
  1306.  
  1307. end
  1308.  
  1309.  
  1310.  
  1311. // Top left logo image
  1312.  
  1313. B.Logo = vgui.Create("DPanel",Dev.SB)
  1314.  
  1315. B.Logo:SetPos(2,6)
  1316.  
  1317. B.Logo:SetSize(176,152)
  1318.  
  1319. B.Logo.Paint = function()
  1320.  
  1321. surface.SetDrawColor( 255, 255, 255, 255 )
  1322.  
  1323. surface.SetMaterial(Dev.SB_Logo)
  1324.  
  1325. surface.DrawTexturedRect( 0, 0, 175.5, 151.2 )
  1326.  
  1327. end
  1328.  
  1329.  
  1330.  
  1331. // Mute everyone top right
  1332.  
  1333. B.Mute = vgui.Create("DCheckBox",Dev.SB)
  1334.  
  1335. B.Mute:SetPos(SB_W-18,42)
  1336.  
  1337. B.Mute:SetSize(16,16)
  1338.  
  1339. B.Mute.Paint = function(s,w,h)
  1340.  
  1341. draw.RoundedBox(0,0,0,w,h,Color(0,0,0,200))
  1342.  
  1343. local val = s:GetChecked()
  1344.  
  1345. if val then
  1346.  
  1347. draw.RoundedBox(0,2,2,w-4,h-4,Color(0,255,0,80))
  1348.  
  1349. else
  1350.  
  1351. draw.RoundedBox(0,2,2,w-4,h-4,Color(255,255,255,50))
  1352.  
  1353. end
  1354.  
  1355. end
  1356.  
  1357. B.Mute.OnChange = function(s)
  1358.  
  1359. DoMuteAll = s:GetChecked()
  1360.  
  1361. net.Start("Dev_MuteAll")
  1362.  
  1363. if DoMuteAll then net.WriteFloat(1) else net.WriteFloat(0) end
  1364.  
  1365. net.SendToServer()
  1366.  
  1367. end
  1368.  
  1369. B.Mute:SetChecked(DoMuteAll or false)
  1370.  
  1371.  
  1372.  
  1373. // Team section player lists ===============================
  1374.  
  1375.  
  1376.  
  1377. // Content BG (invisible)
  1378.  
  1379. B.Players = vgui.Create("DPanelList",Dev.SB)
  1380.  
  1381. B.Players:SetSize(SB_W,SB_H-153)
  1382.  
  1383. B.Players:SetPos(0,153)
  1384.  
  1385. B.Players.Paint = function() end
  1386.  
  1387. B.Players:SetSpacing(0)
  1388.  
  1389. B.Players:SetPadding(0)
  1390.  
  1391. B.Players:EnableVerticalScrollbar(true)
  1392.  
  1393.  
  1394.  
  1395. local BDG_X = SB_W*.6 // Store the position to start badges
  1396.  
  1397.  
  1398.  
  1399. // Add a player row (for under header/titles)
  1400.  
  1401. SB_AddPlayer = function(ply)
  1402.  
  1403. if !ply:IsValid() then return end
  1404.  
  1405. local PLY_W = B.Players:GetWide()
  1406.  
  1407.  
  1408.  
  1409. // Devolved player badges ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1410.  
  1411.  
  1412.  
  1413. local badges = {}
  1414.  
  1415.  
  1416.  
  1417. if ply.lvl then
  1418.  
  1419. table.insert(badges,{
  1420.  
  1421. txt = ply.lvl,
  1422.  
  1423. img = "icon16/shield.png"
  1424.  
  1425. })
  1426.  
  1427. end
  1428.  
  1429.  
  1430.  
  1431. if ply.TTTPlaytime then
  1432.  
  1433. table.insert(badges,{
  1434.  
  1435. txt = "TTT Playtime: " .. ply.TTTPlaytime .. " minutes",
  1436.  
  1437. img = "icon16/clock.png"
  1438.  
  1439. })
  1440.  
  1441. end
  1442.  
  1443.  
  1444.  
  1445. if ply.PostRank then
  1446.  
  1447. table.insert(badges,{
  1448.  
  1449. txt = "Forum Post Rank: " .. ply.PostRank .. " (" .. ply.PostCount .. " posts)" .. (ply.JoinDate and "\nForum Join Date: " .. ply.JoinDate or ""),
  1450.  
  1451. img = "Devolved/postrank.png"
  1452.  
  1453. })
  1454.  
  1455. end
  1456.  
  1457.  
  1458.  
  1459. if table.HasValue(ply.Ranks,"Gold Member") then
  1460.  
  1461. table.insert(badges,{
  1462.  
  1463. txt = "This player is a gold member.",
  1464.  
  1465. img = "icon16/award_star_gold_1.png"
  1466.  
  1467. })
  1468.  
  1469. elseif ply.ForumRank == "Silver Member" then
  1470.  
  1471. table.insert(badges,{
  1472.  
  1473. txt = "This player is a silver member.",
  1474.  
  1475. img = "icon16/award_star_silver_1.png"
  1476.  
  1477. })
  1478.  
  1479. elseif ply.ForumRank == "Member" then
  1480.  
  1481. table.insert(badges,{
  1482.  
  1483. txt = "This player is a forum member.",
  1484.  
  1485. img = "icon16/user.png"
  1486.  
  1487. })
  1488.  
  1489. elseif ply.ForumRank == "Donator" then
  1490.  
  1491. table.insert(badges,{
  1492.  
  1493. txt = "This player is a donator.",
  1494.  
  1495. img = "icon16/user_gray.png"
  1496.  
  1497. })
  1498.  
  1499. end
  1500.  
  1501.  
  1502.  
  1503. if table.HasValue(ply.Ranks,"Platinum Member") then
  1504.  
  1505. table.insert(badges,{
  1506.  
  1507. txt = "This player is a platinum member.",
  1508.  
  1509. img = "Devolved/icon_plat.png"
  1510.  
  1511. })
  1512.  
  1513. end
  1514.  
  1515.  
  1516.  
  1517. if ply.Reserved then
  1518.  
  1519. table.insert(badges,{
  1520.  
  1521. txt = "This player has a reserved slot.",
  1522.  
  1523. img = "icon16/key.png"
  1524.  
  1525. })
  1526.  
  1527. end
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533. if ply.Ranks then
  1534.  
  1535. for k,v in pairs(DA_SH.GroupIcons) do
  1536.  
  1537. if table.HasValue(ply.Ranks,k) then
  1538.  
  1539. table.insert(badges,{
  1540.  
  1541. txt = "This player has the rank '" .. k .. "'",
  1542.  
  1543. img = v
  1544.  
  1545. })
  1546.  
  1547. end
  1548.  
  1549. end
  1550.  
  1551. // DevolvedAdmin icon support here
  1552.  
  1553. end
  1554.  
  1555.  
  1556.  
  1557. local NumBadge = #badges
  1558.  
  1559. local BadgeW = (NumBadge*22)
  1560.  
  1561.  
  1562.  
  1563. // End finding badges ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1564.  
  1565.  
  1566.  
  1567. // Color gradient if T/D
  1568.  
  1569. local Extra,Extras = (ply:IsTraitor() and Color(255,0,0)) or (ply:IsDetective() and Color(0,0,255))
  1570.  
  1571. if Extra then
  1572.  
  1573. Extras = math.ceil((PLY_W)/200)-1
  1574.  
  1575. end
  1576.  
  1577.  
  1578.  
  1579. // Player main BG and player info
  1580.  
  1581. local P,Entered,Exited = vgui.Create("DButton")
  1582.  
  1583. P:SetSize(PLY_W,24)
  1584.  
  1585. P.Paint = function(s,w,h)
  1586.  
  1587. if !ply:IsValid() then SB_RefreshPList() return end
  1588.  
  1589.  
  1590.  
  1591. // Background
  1592.  
  1593. draw.RoundedBox(0,0,0,w,h,Color(0,0,0,230))
  1594.  
  1595. draw.RoundedBox(0,2,0,w-4,h-2,Color(100,100,100,90))
  1596.  
  1597.  
  1598.  
  1599. if Entered or Exited then
  1600.  
  1601. local clamped = math.Clamp((Entered and (CurTime()-Entered)/.06) or (Exited and (CurTime()-Exited)/.06),0,1)
  1602.  
  1603. draw.RoundedBox(0,2,0,w-4,h-2,Color(255,255,255,19*(Exited and 1-clamped or clamped)))
  1604.  
  1605. if Exited and CurTime()-Exited > .06 then Exited = nil end
  1606.  
  1607. end
  1608.  
  1609.  
  1610.  
  1611. // BG For T/D
  1612.  
  1613. if Extras then
  1614.  
  1615. for i=0,Extras do
  1616.  
  1617. surface.SetDrawColor( Extra.r, Extra.g, Extra.b, 60 )
  1618.  
  1619. surface.SetMaterial(Dev.SB_Ply)
  1620.  
  1621. surface.DrawTexturedRect( i*200, 0, 200, h-2 )
  1622.  
  1623. end
  1624.  
  1625. end
  1626.  
  1627.  
  1628.  
  1629. // Name
  1630.  
  1631. draw.DrawText(ply:Name(), "SB_TTT_Ply", 32, 2, Color(255,255,255,190),TEXT_ALIGN_LEFT)
  1632.  
  1633.  
  1634.  
  1635. // Ping
  1636.  
  1637. draw.RoundedBox(0,w-79,0,39,h-2,Color(0,0,0,150))
  1638.  
  1639. draw.DrawText(ply:Ping(), "SB_TTT_PInfo", w-60, 3, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  1640.  
  1641.  
  1642.  
  1643. // Deaths
  1644.  
  1645. draw.DrawText(ply:Deaths(), "SB_TTT_PInfo", w-111, 3, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  1646.  
  1647.  
  1648.  
  1649. // Score
  1650.  
  1651. draw.RoundedBox(0,w-191,0,49,h-2,Color(0,0,0,150))
  1652.  
  1653. draw.DrawText(ply:Frags(), "SB_TTT_PInfo", w-167, 3, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  1654.  
  1655.  
  1656.  
  1657. // Karma
  1658.  
  1659. draw.DrawText(math.Round(ply:GetBaseKarma()), "SB_TTT_PInfo", w-219, 3, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  1660.  
  1661.  
  1662.  
  1663. // SB Tags
  1664.  
  1665. local SBTag = ply.sb_tag
  1666.  
  1667. if SBTag then
  1668.  
  1669. draw.DrawText(SBTag.txt, "SB_TTT_PInfo", w-282, 3, SBTag.clr,TEXT_ALIGN_CENTER)
  1670.  
  1671. end
  1672.  
  1673.  
  1674.  
  1675. // Badge BG
  1676.  
  1677. if NumBadge > 0 then
  1678.  
  1679. draw.RoundedBox(0,BDG_X-BadgeW-4,0,BadgeW+2,h-2,Color(0,0,0,150))
  1680.  
  1681. end
  1682.  
  1683. end
  1684.  
  1685. function P:Think() if !ply or !ply:IsValid() then SB_RefreshPList() end end
  1686.  
  1687. P:SetText("")
  1688.  
  1689. P.OnCursorEntered = function() Exited = nil Entered = CurTime() end
  1690.  
  1691. P.OnCursorExited = function() Entered = nil Exited = CurTime() end
  1692.  
  1693. P.DoClick = function()
  1694.  
  1695. local g = ScoreGroup(ply)
  1696.  
  1697.  
  1698.  
  1699. if g == GROUP_FOUND or g == GROUP_NOTFOUND then
  1700.  
  1701. ply.ShowInfo = !ply.ShowInfo
  1702.  
  1703. SB_RefreshPList()
  1704.  
  1705. surface.PlaySound("Devolved/sb_click.wav")
  1706.  
  1707. return
  1708.  
  1709. end
  1710.  
  1711.  
  1712.  
  1713. if ply == LocalPlayer() then return end
  1714.  
  1715. surface.PlaySound("Devolved/sb_click.wav")
  1716.  
  1717.  
  1718.  
  1719. ply.SBTag = (ply.SBTag and ply.SBTag+1) or 1
  1720.  
  1721. if ply.SBTag > #Dev.Tags then ply.SBTag = nil end
  1722.  
  1723. ply.sb_tag = ply.SBTag and Dev.Tags[ply.SBTag]
  1724.  
  1725. end
  1726.  
  1727. P.DoRightClick = function()
  1728.  
  1729.  
  1730.  
  1731. surface.PlaySound("Devolved/sb_rclick.wav")
  1732.  
  1733.  
  1734.  
  1735. if ply == LocalPlayer() then
  1736.  
  1737. B.Opts = DermaMenu()
  1738.  
  1739. B.Opts:AddOption("View Stats",function() Dev.ViewStats(ply) end)
  1740.  
  1741. B.Opts:AddOption("View Playtime",function() Dev.ViewPT(ply) end)
  1742.  
  1743. B.Opts:AddOption("Lookup Bans",function()
  1744.  
  1745. LookupBans(ply:Name(),ply:SteamID())
  1746.  
  1747. end)
  1748.  
  1749. B.Opts:AddOption("View Steam Profile",function()
  1750.  
  1751. SteamProfile(ply:SteamID64(),ply:Name())
  1752.  
  1753. end)
  1754.  
  1755.  
  1756.  
  1757. if LocalPlayer().Ranks and (table.HasValue(LocalPlayer().Ranks,"Moderator") or table.HasValue(LocalPlayer().Ranks,"Administrator") or table.HasValue(LocalPlayer().Ranks,"Manager")) then
  1758.  
  1759. B.Opts:AddOption("View Bans",function()
  1760.  
  1761. for k,v in pairs(DA_SH.Plugins) do
  1762.  
  1763. if v.Name == "ViewBans" then
  1764.  
  1765. net.Start("DA2_RunCMD")
  1766.  
  1767. net.WriteFloat(k)
  1768.  
  1769. net.WriteEntity(ply)
  1770.  
  1771. net.SendToServer()
  1772.  
  1773. break
  1774.  
  1775. end
  1776.  
  1777. end
  1778.  
  1779. end)
  1780.  
  1781. end
  1782.  
  1783.  
  1784.  
  1785. B.Opts:Open()
  1786.  
  1787.  
  1788.  
  1789. return
  1790.  
  1791. end
  1792.  
  1793.  
  1794.  
  1795. B.Opts = DermaMenu()
  1796.  
  1797.  
  1798.  
  1799. // Set tag
  1800.  
  1801. local TagOpts = B.Opts:AddSubMenu("Set Tag")
  1802.  
  1803. TagOpts:AddOption("NONE",function() ply.SBTag = nil ply.sb_tag = nil surface.PlaySound("Devolved/sb_click.wav") end)
  1804.  
  1805. for k,v in pairs(Dev.Tags) do
  1806.  
  1807. TagOpts:AddOption(v.txt,function() ply.SBTag = k ply.sb_tag = Dev.Tags[ply.SBTag] surface.PlaySound("Devolved/sb_click.wav") end)
  1808.  
  1809. end
  1810.  
  1811.  
  1812.  
  1813. // Send trade
  1814.  
  1815. B.Opts:AddOption("Send Trade",function() net.Start("Dev_Trade_Send") net.WriteEntity(ply) net.SendToServer() end)
  1816.  
  1817. B.Opts:AddOption("View Stats",function() Dev.ViewStats(ply) end)
  1818.  
  1819. B.Opts:AddOption("View Playtime",function() Dev.ViewPT(ply) end)
  1820.  
  1821. B.Opts:AddOption("Lookup Bans",function()
  1822.  
  1823. LookupBans(ply:Name(),ply:SteamID())
  1824.  
  1825. end)
  1826.  
  1827. B.Opts:AddOption("View Steam Profile",function()
  1828.  
  1829. SteamProfile(ply:SteamID64(),ply:Name())
  1830.  
  1831. end)
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837. if LocalPlayer().Ranks and (table.HasValue(LocalPlayer().Ranks,"Moderator") or table.HasValue(LocalPlayer().Ranks,"Administrator") or table.HasValue(LocalPlayer().Ranks,"Manager")) then
  1838.  
  1839. B.Opts:AddOption("View Bans",function()
  1840.  
  1841. for k,v in pairs(DA_SH.Plugins) do
  1842.  
  1843. if v.Name == "ViewBans" then
  1844.  
  1845. net.Start("DA2_RunCMD")
  1846.  
  1847. net.WriteFloat(k)
  1848.  
  1849. net.WriteEntity(ply)
  1850.  
  1851. net.SendToServer()
  1852.  
  1853. break
  1854.  
  1855. end
  1856.  
  1857. end
  1858.  
  1859. end)
  1860.  
  1861. end
  1862.  
  1863.  
  1864.  
  1865. B.Opts:Open()
  1866.  
  1867. end
  1868.  
  1869.  
  1870.  
  1871. for k,v in pairs(badges) do
  1872.  
  1873. local BDG = vgui.Create("DImageButton", P)
  1874.  
  1875. BDG:SetPos(BDG_X-(k*22),3)
  1876.  
  1877. BDG:SetImage(v.img)
  1878.  
  1879. BDG:SetSize(16,16)
  1880.  
  1881. BDG.DoClick = P.DoClick
  1882.  
  1883. BDG.DoRightClick = P.DoRightClick
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889. // Draw level over shield icon
  1890.  
  1891. if v.img == "icon16/shield.png" then
  1892.  
  1893. BDG:SetTooltip("TTT Level " .. v.txt)
  1894.  
  1895. BDG.PaintOver = function(s,w,h)
  1896.  
  1897. draw.DrawText(v.txt, "SB_TTT_Lvl", 9, 1, Color(255,255,255,230),TEXT_ALIGN_CENTER)
  1898.  
  1899. end
  1900.  
  1901. else
  1902.  
  1903. BDG:SetTooltip(v.txt)
  1904.  
  1905. end
  1906.  
  1907. end
  1908.  
  1909.  
  1910.  
  1911. // End badges -------------------------------
  1912.  
  1913.  
  1914.  
  1915. // Player avatar
  1916.  
  1917. local Av = vgui.Create("AvatarImage",P)
  1918.  
  1919. Av:SetPos(2,0)
  1920.  
  1921. Av:SetSize(22,22)
  1922.  
  1923. Av:SetPlayer(ply)
  1924.  
  1925.  
  1926.  
  1927. // Mute player
  1928.  
  1929. if ply != LocalPlayer() then // No point in muting self
  1930.  
  1931. local Mute = vgui.Create("DButton",P)
  1932.  
  1933. Mute:SetPos(-100,0)
  1934.  
  1935. timer.Simple(.02,function() if Mute:IsValid() then Mute:SetPos(P:GetWide()-24,0) end end)
  1936.  
  1937. timer.Simple(.2,function() if Mute:IsValid() then Mute:SetPos(P:GetWide()-24,0) end end)
  1938.  
  1939. Mute:SetSize(22,22)
  1940.  
  1941. Mute.DoClick = function()
  1942.  
  1943. local muted = ply:IsMuted()
  1944.  
  1945. ply:SetMuted(!muted)
  1946.  
  1947. Mute.img = (!ply:IsMuted() and Material("icon16/sound_mute.png") or ply:IsMuted() and Material("icon16/sound.png"))
  1948.  
  1949. end
  1950.  
  1951. Mute.img = (!ply:IsMuted() and Material("icon16/sound_mute.png") or Material("icon16/sound.png"))
  1952.  
  1953. Mute.Paint = function(s,w,h)
  1954.  
  1955. surface.SetDrawColor( 255, 255, 255, 250 )
  1956.  
  1957. surface.SetMaterial(Mute.img)
  1958.  
  1959. surface.DrawTexturedRect( 3, 3, 16, 16 )
  1960.  
  1961. end
  1962.  
  1963. Mute:SetText("")
  1964.  
  1965. end
  1966.  
  1967.  
  1968.  
  1969. B.Players:AddItem(P)
  1970.  
  1971.  
  1972.  
  1973. // For left click menu in vanilla TTT
  1974.  
  1975. if ply.ShowInfo then
  1976.  
  1977. local Info
  1978.  
  1979.  
  1980.  
  1981. local g = ScoreGroup(ply)
  1982.  
  1983. if g == GROUP_FOUND or g == GROUP_NOTFOUND then
  1984.  
  1985. Info = vgui.Create("TTTScorePlayerInfoSearch")
  1986.  
  1987. Info:SetPlayer(ply)
  1988.  
  1989. Info:SetSize(PLY_W,70)
  1990.  
  1991. Info:UpdatePlayerData()
  1992.  
  1993. end
  1994.  
  1995. if Info then
  1996.  
  1997. B.Players:AddItem(Info)
  1998.  
  1999. BG_Space = BG_Space+Info:GetTall()
  2000.  
  2001. end
  2002.  
  2003. end
  2004.  
  2005.  
  2006.  
  2007. BG_Space = BG_Space+24
  2008.  
  2009. end
  2010.  
  2011.  
  2012.  
  2013. // Add a header/title (for teams)
  2014.  
  2015. SB_AddHeader = function(Text,Clr)
  2016.  
  2017. local H,PLY_W = vgui.Create("DPanel"),B.Players:GetWide()
  2018.  
  2019. H:SetSize(PLY_W,28)
  2020.  
  2021. H.Paint = function(s,w,h)
  2022.  
  2023. draw.RoundedBox(0,0,4,w,h-4,Color(0,0,0,200))
  2024.  
  2025. // Small header BG
  2026.  
  2027. for i=0,B.HeaderAm do
  2028.  
  2029. surface.SetDrawColor( Clr.r, Clr.g, Clr.b, 200 )
  2030.  
  2031. surface.SetMaterial(Dev.SB_Header)
  2032.  
  2033. surface.DrawTexturedRect( i*200, 6, 200, 20 )
  2034.  
  2035. end
  2036.  
  2037. draw.DrawText(Text, "SB_TTT_Header", 9, 6, Color(255,255,255,190),TEXT_ALIGN_LEFT)
  2038.  
  2039.  
  2040.  
  2041. // Ping
  2042.  
  2043. draw.RoundedBox(0,w-79,6,39,h-8,Color(0,0,0,150))
  2044.  
  2045. draw.DrawText("Ping", "SB_TTT_PInfo", w-60, 7, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  2046.  
  2047.  
  2048.  
  2049. // Deaths
  2050.  
  2051. draw.RoundedBox(0,w-140,6,59,h-8,Color(0,0,0,150))
  2052.  
  2053. draw.DrawText("Deaths", "SB_TTT_PInfo", w-111, 7, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  2054.  
  2055.  
  2056.  
  2057. // Score
  2058.  
  2059. draw.RoundedBox(0,w-191,6,49,h-8,Color(0,0,0,150))
  2060.  
  2061. draw.DrawText("Score", "SB_TTT_PInfo", w-167, 7, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  2062.  
  2063.  
  2064.  
  2065. // Karma
  2066.  
  2067. draw.RoundedBox(0,w-246,6,53,h-8,Color(0,0,0,150))
  2068.  
  2069. draw.DrawText("Karma", "SB_TTT_PInfo", w-219, 7, Color(255,255,255,190),TEXT_ALIGN_CENTER)
  2070.  
  2071.  
  2072.  
  2073. // Badges
  2074.  
  2075. draw.RoundedBox(0,BDG_X-60,6,58,h-8,Color(0,0,0,150))
  2076.  
  2077. draw.DrawText("Badges", "SB_TTT_PInfo", BDG_X-4, 7, Color(255,255,255,190),TEXT_ALIGN_RIGHT)
  2078.  
  2079.  
  2080.  
  2081. end
  2082.  
  2083.  
  2084.  
  2085. B.Players:AddItem(H)
  2086.  
  2087. BG_Space = BG_Space+28
  2088.  
  2089. end
  2090.  
  2091.  
  2092.  
  2093. SB_RefreshPList = function()
  2094.  
  2095. BG_Space = 96
  2096.  
  2097. B.Players:Clear()
  2098.  
  2099.  
  2100.  
  2101. local PLYS = {TERROR = {},NOTFOUND = {},FOUND = {},SPEC = {},DS = {},TS = {},DMERS = {}}
  2102.  
  2103.  
  2104.  
  2105. // So we can show DMers
  2106.  
  2107. local SelfGroup = ScoreGroup(SelfDead)
  2108.  
  2109. local SelfDead = LocalPlayer().DeathDM or LocalPlayer():IsSpec() or (SelfGroup == GROUP_SPEC) or (SelfGroup == GROUP_FOUND) or (SelfGroup == GROUP_NOTFOUND)
  2110.  
  2111.  
  2112.  
  2113. for k,v in pairs(player.GetAll()) do
  2114.  
  2115. if !v:IsValid() then continue end
  2116.  
  2117. v.ScoreGroup = ScoreGroup(v)
  2118.  
  2119. if SelfDead and v.DeathDM then table.insert(PLYS.DMERS,v) end
  2120.  
  2121. if v.ScoreGroup == GROUP_TERROR then
  2122.  
  2123. if v:IsDetective() then
  2124.  
  2125. table.insert(PLYS.DS,v)
  2126.  
  2127. elseif (v:IsTraitor() and (LocalPlayer():Alive() and !LocalPlayer():IsSpec() and !LocalPlayer().DeathDM)) then
  2128.  
  2129. table.insert(PLYS.TS,v)
  2130.  
  2131. else
  2132.  
  2133. table.insert(PLYS.TERROR,v)
  2134.  
  2135. end
  2136.  
  2137. elseif v.ScoreGroup == GROUP_FOUND then
  2138.  
  2139. table.insert(PLYS.FOUND,v)
  2140.  
  2141. elseif v.ScoreGroup == GROUP_NOTFOUND then
  2142.  
  2143. table.insert(PLYS.NOTFOUND,v)
  2144.  
  2145. elseif v.ScoreGroup == GROUP_SPEC then
  2146.  
  2147. table.insert(PLYS.SPEC,v)
  2148.  
  2149. end
  2150.  
  2151. end
  2152.  
  2153. for k,v in pairs(PLYS) do
  2154.  
  2155. table.sort(PLYS[k],function(a,b) return a:Frags() > b:Frags() end)
  2156.  
  2157. end
  2158.  
  2159.  
  2160.  
  2161. // Terrorist player list ----------------------
  2162.  
  2163.  
  2164.  
  2165. if #PLYS.TERROR > 0 or #PLYS.TS > 0 or #PLYS.DS > 0 then
  2166.  
  2167. // Terrorist header
  2168.  
  2169. SB_AddHeader("Terrorists (" .. (#PLYS.TERROR)+(#PLYS.DS)+(#PLYS.TS) .. ")",Color(0, 190, 0))
  2170.  
  2171.  
  2172.  
  2173. // Players
  2174.  
  2175. for k,v in pairs(PLYS.DS) do SB_AddPlayer(v) end
  2176.  
  2177. for k,v in pairs(PLYS.TS) do SB_AddPlayer(v) end
  2178.  
  2179. for k,v in pairs(PLYS.TERROR) do SB_AddPlayer(v) end
  2180.  
  2181. end
  2182.  
  2183.  
  2184.  
  2185. // Missing in action list ------------------
  2186.  
  2187.  
  2188.  
  2189. if #PLYS.NOTFOUND > 0 then
  2190.  
  2191. // MIC header
  2192.  
  2193. SB_AddHeader("Missing in Action (" .. #PLYS.NOTFOUND .. ")",Color(255, 205, 0))
  2194.  
  2195.  
  2196.  
  2197. // Players
  2198.  
  2199. for k,v in pairs(PLYS.NOTFOUND) do SB_AddPlayer(v) end
  2200.  
  2201. end
  2202.  
  2203.  
  2204.  
  2205. // Confirmed Dead list ------------------
  2206.  
  2207.  
  2208.  
  2209. if #PLYS.FOUND > 0 then
  2210.  
  2211. // CD header
  2212.  
  2213. SB_AddHeader("Confirmed Dead (" .. #PLYS.FOUND .. ")",Color(196, 0, 0))
  2214.  
  2215.  
  2216.  
  2217. // Players
  2218.  
  2219. for k,v in pairs(PLYS.FOUND) do SB_AddPlayer(v) end
  2220.  
  2221. end
  2222.  
  2223.  
  2224.  
  2225. // Spectator List -------------------
  2226.  
  2227.  
  2228.  
  2229. if #PLYS.SPEC > 0 then
  2230.  
  2231. // Spec header
  2232.  
  2233. SB_AddHeader("Spectators (" .. #PLYS.SPEC .. ")",Color(110, 190, 255))
  2234.  
  2235.  
  2236.  
  2237. // Players
  2238.  
  2239. for k,v in pairs(PLYS.SPEC) do SB_AddPlayer(v) end
  2240.  
  2241. end
  2242.  
  2243.  
  2244.  
  2245. // DMers list ---------------
  2246.  
  2247. if #PLYS.DMERS > 0 then
  2248.  
  2249. // Spec header
  2250.  
  2251. SB_AddHeader("Spectate DMers [F1 > Deathmatch] (" .. #PLYS.DMERS .. ")",Color(158,158,158))
  2252.  
  2253.  
  2254.  
  2255. // Players
  2256.  
  2257. for k,v in pairs(PLYS.DMERS) do SB_AddPlayer(v) end
  2258.  
  2259. end
  2260.  
  2261.  
  2262.  
  2263. GenerateScrollbar(B.Players)
  2264.  
  2265. Dev.SB:SetPos(W*.5-(SB_W*.5),math.Clamp(H*.5-((BG_Space+62)*.5),0,H*.15))
  2266.  
  2267. end
  2268.  
  2269.  
  2270.  
  2271. SB_RefreshPList()
  2272.  
  2273.  
  2274.  
  2275. function B.Players:Think()
  2276.  
  2277. for k,v in pairs(player.GetAll()) do
  2278.  
  2279. local SG = v.ScoreGroup
  2280.  
  2281. if !SG or SG != ScoreGroup(v) then
  2282.  
  2283. SB_RefreshPList()
  2284.  
  2285. end
  2286.  
  2287. end
  2288.  
  2289. end
  2290.  
  2291.  
  2292.  
  2293. // END PLAYER LISTS =============================
  2294.  
  2295.  
  2296.  
  2297. // Show mouse, restore last position
  2298.  
  2299. gui.EnableScreenClicker(true)
  2300.  
  2301.  
  2302.  
  2303. return Dev.SB
  2304.  
  2305. end
  2306.  
  2307.  
  2308.  
  2309. function Dev.DeleteSB()
  2310.  
  2311. if Dev.SB and Dev.SB:IsValid() then
  2312.  
  2313. local MX,MY = gui.MousePos()
  2314.  
  2315. Dev.MouseX = math.Clamp(MX,ScrW()*.2,ScrW()*.8)
  2316.  
  2317. Dev.MouseY = math.Clamp(MY,ScrH()*.14,ScrH()*.87)
  2318.  
  2319.  
  2320.  
  2321. Dev.Closed = CurTime()
  2322.  
  2323. Dev.SB:Close()
  2324.  
  2325. gui.EnableScreenClicker(false)
  2326.  
  2327. end
  2328.  
  2329. end
  2330.  
  2331.  
  2332.  
  2333. // No mouse disappearing/teleporting with scoreboard open!
  2334.  
  2335. local oldClick = gui.EnableScreenClicker
  2336.  
  2337. function gui.EnableScreenClicker(val,...)
  2338.  
  2339. if !val and Dev.SB and Dev.SB:IsValid() and (!Dev.Closed or CurTime()-Dev.Closed > .001) then return end
  2340.  
  2341. return oldClick(val,...)
  2342.  
  2343. end
  2344.  
  2345.  
  2346.  
  2347. local oldSetPos = gui.SetMousePos
  2348.  
  2349. function gui.SetMousePos(...)
  2350.  
  2351. if Dev.SB and Dev.SB:IsValid() and (!Dev.Closed or CurTime()-Dev.Closed > .001) then return end
  2352.  
  2353. return oldSetPos(...)
  2354.  
  2355. end
  2356.  
  2357.  
  2358.  
  2359. timer.Simple(1,function()
  2360.  
  2361. local LastTab = CurTime()
  2362.  
  2363.  
  2364.  
  2365. local GM = GM or GAMEMODE
  2366.  
  2367. function GM:ScoreboardShow()
  2368.  
  2369. if LocalPlayer().DeathDM then
  2370.  
  2371. if CurTime()-LastTab > .5 then
  2372.  
  2373. LastTab = CurTime()
  2374.  
  2375. hook.Call("Rust_TabMenuMain",GAMEMODE)
  2376.  
  2377. hook.Call("Rust_TabMenu",GAMEMODE)
  2378.  
  2379. end
  2380.  
  2381. return
  2382.  
  2383. end
  2384.  
  2385.  
  2386.  
  2387. Dev.CreateSB()
  2388.  
  2389. end
  2390.  
  2391.  
  2392.  
  2393. function GM:ScoreboardHide()
  2394.  
  2395. Dev.DeleteSB()
  2396.  
  2397. end
  2398.  
  2399. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement