Advertisement
XoXFaby

Untitled

Sep 13th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.99 KB | None | 0 0
  1. /*--------------------------------------------------*\
  2. | You can only change things before the warning text |
  3. \*--------------------------------------------------*/
  4.  
  5. local clbackground = Color(235,235,235,255) // Default color is 235,235,235,255
  6. local topbackground = Color(38,38,38,255) // Default color is 63,67,78,255
  7. local tagsbackground = Color(54,54,54,255) // Default color is 54,54,54,255
  8. local rowcolor = Color(79,83,95,255) // Default color is 79,83,95,255
  9. local rowhovercolor = Color(255,255,255,0) // Default color is 255,255,255,0
  10. local colorrowteam = true // Default false, if it is set to true the player row color will be changed based on the team color.
  11. -- The logo size has to be 263x75
  12. -- If logo is set to 0 then there will the blank space if you set a directory it will use that image as logo
  13. -- When adding a directory do it like this Material("directory/filename.png or jpg")
  14. local logo = 0
  15.  
  16. /*-------*\
  17. | Warning |
  18. \*-------*/
  19. local w,h = ScrW(),ScrH()
  20. local y,y2 = 0,0
  21.  
  22. -- 16:9
  23. if w == 1280 and h == 720 then y = 75 end
  24. if w == 1360 and h == 768 then y = 35 end
  25. if w == 1366 and h == 768 then y = 35 end
  26. if w == 1600 and h == 900 then y = 0 y2 = 80 end
  27. if w == 1920 and h == 1080 then y = 0 y2 = 235 end
  28. -- 16:10
  29. if w == 1680 and h == 1050 then y = 0 y2 = 120 end
  30. if w == 1600 and h == 1024 then y = 0 y2 = 80 end
  31. if w == 1440 and h == 900 then y = 0 y2 = 0 end
  32. if w == 1280 and h == 800 then y = 80 y2 = 0 end
  33. if w == 1280 and h == 768 then y = 80 y2 = 0 end
  34. -- 4:3
  35. if w == 1280 and h == 1024 then y = 80 y2 = 0 end
  36. if w == 1280 and h == 900 then y = 80 y2 = 0 end
  37. if w == 1152 and h == 864 then y = 140 y2 = 0 end
  38. --[[ Doesn't support the next resolutions
  39. 1024x768
  40. 800x600
  41. 720x576
  42. 640x480
  43. ]]
  44. surface.CreateFont( "Info", {
  45. font = "Bebas Neue",
  46. size = 19,
  47. weight = 500,
  48. antialias = true
  49. })
  50.  
  51. surface.CreateFont( "Title", {
  52. font = "Bebas Neue",
  53. size = 30,
  54. weight = 500,
  55. antialias = true
  56. })
  57.  
  58. surface.CreateFont( "OtherInfo", {
  59. font = "Bebas Neue",
  60. size = 24,
  61. weight = 500,
  62. antialias = true
  63. })
  64.  
  65. surface.CreateFont( "NameRank", {
  66. font = "Bebas Neue",
  67. size = 20,
  68. weight = 500,
  69. antialias = true
  70. })
  71.  
  72. local function formatNumber(n)
  73. n = tonumber(n)
  74. if (!n) then
  75. return 0
  76. end
  77. if n >= 1e14 then return tostring(n) end
  78. n = tostring(n)
  79. sep = sep or ","
  80. local dp = string.find(n, "%.") or #n+1
  81. for i=dp-4, 1, -3 do
  82. n = n:sub(1, i) .. sep .. n:sub(i+1)
  83. end
  84. return n
  85. end
  86.  
  87. function playercom(parent,x,y,text,image,color,name,command)
  88.  
  89. local userbtn = vgui.Create("DButton",parent)
  90. userbtn:SetPos(x,y)
  91. userbtn:SetSize(120,35)
  92. userbtn:SetTextColor(Color(255,255,255))
  93. userbtn:SetText(text)
  94. userbtn:SetImage(image)
  95. userbtn.Paint = function(self)
  96. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),Color(51,51,51,255))
  97. surface.SetDrawColor(color)
  98. surface.DrawOutlinedRect(0,0,self:GetWide(),self:GetTall())
  99. end
  100.  
  101. userbtn.DoClick = function()
  102. surface.PlaySound("buttons/button9.wav")
  103. SetClipboardText(command)
  104. end
  105. return userbtn
  106. end
  107.  
  108. function command(parent,x,y,text,image,color,command,...)
  109.  
  110. local btn = vgui.Create("DButton",parent)
  111. btn:SetPos(x,y)
  112. btn:SetSize(120,35)
  113. btn:SetTextColor(Color(255,255,255))
  114. btn:SetText(text)
  115. btn:SetImage(image)
  116. btn.Paint = function(self)
  117. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),Color(51,51,51,255))
  118. surface.SetDrawColor(color)
  119. surface.DrawOutlinedRect(0,0,self:GetWide(),self:GetTall())
  120. end
  121.  
  122. local cmdArgs = {...}
  123. btn.DoClick = function()
  124. surface.PlaySound("buttons/button9.wav")
  125. RunConsoleCommand(command,unpack(cmdArgs))
  126. end
  127. return btn
  128. end
  129.  
  130. function kick(parent,x,y,text,reason,image,color,command,ply)
  131.  
  132. local cbtn = vgui.Create("DButton",parent)
  133. cbtn:SetSize(120,35)
  134. cbtn:SetPos(x,y)
  135. cbtn:SetTextColor(Color(255,255,255))
  136. cbtn:SetText(text)
  137. cbtn:SetImage(image)
  138. cbtn.Paint = function(self)
  139. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),Color(51,51,51,255))
  140. surface.SetDrawColor(color)
  141. surface.DrawOutlinedRect(0,0,self:GetWide(),self:GetTall())
  142. end
  143. cbtn.DoClick = function()
  144. surface.PlaySound("buttons/button9.wav")
  145. local reportmsg = vgui.Create( "DFrame" )
  146. reportmsg:SetPos(ScrW() / 2 - 200, ScrH() / 2 - 120)
  147. reportmsg:SetSize(400,100)
  148. reportmsg:SetTitle("")
  149. reportmsg:SetVisible(true)
  150. reportmsg:SetDraggable(false)
  151. reportmsg:SetBackgroundBlur(true)
  152. reportmsg:ShowCloseButton(true)
  153. reportmsg:MakePopup()
  154.  
  155. local tellad = vgui.Create("DLabel",reportmsg)
  156. tellad:SetPos(reportmsg:GetWide()/2-100,22)
  157. tellad:SetText(reason)
  158. tellad:SizeToContents()
  159.  
  160. story = vgui.Create("DTextEntry",reportmsg)
  161. story:SetPos(10,42)
  162. story:SetTall(20)
  163. story:SetWide(reportmsg:GetWide()-20)
  164. story:RequestFocus()
  165.  
  166. local accept = vgui.Create("DButton",reportmsg)
  167. accept:SetPos(100,65)
  168. accept:SetSize(80,30)
  169. accept:SetImage('icon16/accept.png')
  170. accept:SetText('Accept')
  171. accept.DoClick = function()
  172. if IsValid(reportmsg) then
  173. reportmsg:Close()
  174. end
  175. AlertMessage = story:GetValue()
  176. RunConsoleCommand("ulx",command,ply,AlertMessage)
  177. end
  178.  
  179. local cancel = vgui.Create("DButton",reportmsg)
  180. cancel:SetPos(230,65)
  181. cancel:SetSize(80,30)
  182. cancel:SetImage('icon16/cross.png')
  183. cancel:SetText('Cancel')
  184. cancel.DoClick = function()
  185. if IsValid(reportmsg) then
  186. reportmsg:Close()
  187. end
  188. end
  189. end
  190. return btn
  191. end
  192.  
  193. function ban(parent,x,y,text,reason,image,color,command,ply)
  194.  
  195. local cbtn = vgui.Create("DButton",parent)
  196. cbtn:SetSize(120,35)
  197. cbtn:SetPos(x,y)
  198. cbtn:SetTextColor(Color(255,255,255))
  199. cbtn:SetText(text)
  200. cbtn:SetImage(image)
  201. cbtn.Paint = function(self)
  202. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),Color(51,51,51,255))
  203. surface.SetDrawColor(color)
  204. surface.DrawOutlinedRect(0,0,self:GetWide(),self:GetTall())
  205. end
  206. cbtn.DoClick = function()
  207. surface.PlaySound("buttons/button9.wav")
  208. local menu = DermaMenu()
  209. local Title = vgui.Create("DLabel")
  210. Title:SetText(" Ban Time:\n")
  211. Title:SetFont("UiBold")
  212. Title:SizeToContents()
  213. Title:SetTextColor(color_black)
  214. menu:AddPanel(Title)
  215. menu:AddOption("1 Hour", function() RunConsoleCommand("ulx",command,ply,60) end)
  216. menu:AddOption("5 Hour", function() RunConsoleCommand("ulx",command,ply,300) end)
  217. menu:AddOption("1 day", function() RunConsoleCommand("ulx",command,ply,1440) end)
  218. menu:AddOption("1 week", function() RunConsoleCommand("ulx",command,ply,10080) end)
  219. menu:AddOption("1 month", function() RunConsoleCommand("ulx",command,ply,40320) end)
  220. menu:AddOption("Permanently", function() RunConsoleCommand("ulx",command,ply,0) end)
  221. menu:Open()
  222. end
  223. return btn
  224. end
  225.  
  226. function CustomScoreBoard_Apply()
  227.  
  228. function GAMEMODE:ScoreboardShow()
  229. gui.EnableScreenClicker(true)
  230.  
  231. bg = vgui.Create("DFrame")
  232. bg:SetSize(800,ScrH() - 100)
  233. bg:SetPos(ScrW()/2-400+y,50)
  234. bg:SetDraggable(false)
  235. bg:ShowCloseButton(false)
  236. bg:SetTitle("")
  237. bg.Paint = function(self)
  238. draw.RoundedBox(8,0,0,self:GetWide(),self:GetTall(),Color(0,0,0,255))
  239. draw.RoundedBox(8,1,1,self:GetWide()-2,self:GetTall()-2,clbackground)
  240. draw.RoundedBox(0,0,0,self:GetWide(),75,topbackground)
  241. surface.SetDrawColor(61,61,61,255)
  242. surface.DrawLine(0,0,self:GetWide(),0)
  243. surface.SetFont("Title")
  244. draw.DrawText("CubeSquared DarkRP -- Click on a Players name to pull up the menu","Title",5,2.5,color_white,TEXT_ALIGN_LEFT)
  245. draw.DrawText("Players: "..table.Count(player.GetAll()),"Info",5,55,color_white,TEXT_ALIGN_LEFT)
  246. end
  247.  
  248. local plytext = vgui.Create("DPanel",bg)
  249. plytext:SetSize(bg:GetWide()-2,25)
  250. plytext:SetPos(1,75)
  251. plytext.Paint = function(self)
  252. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),tagsbackground)
  253. surface.SetDrawColor(0,0,0,255)
  254. surface.DrawLine(0,0,self:GetWide(),0)
  255. surface.SetDrawColor(61,61,61,255)
  256. surface.DrawLine(0,1,self:GetWide(),1)
  257. draw.DrawText("Name","Info",5,2.5,color_white,TEXT_ALIGN_LEFT)
  258. draw.DrawText("Job","Info",self:GetWide()/2,2.5,color_white,TEXT_ALIGN_CENTER)
  259. --draw.DrawText("Kills / Deaths","Info",self:GetWide()/1.2,2.5,color_white,TEXT_ALIGN_CENTER)
  260. draw.DrawText("Ping","Info",self:GetWide()/1.03,2.5,color_white,TEXT_ALIGN_RIGHT)
  261. end
  262.  
  263.  
  264. plist = vgui.Create("DScrollPanel",bg)
  265. plist:SetSize(bg:GetWide()-2,799)
  266. plist:SetPos(1,100)
  267. plist:SetPadding(5)
  268. plist.Paint = function(self)
  269. draw.RoundedBoxEx(6,0,0,self:GetWide(),self:GetTall(),Color(0,0,0,0),false,false,true,true)
  270. end
  271.  
  272. local plys = player.GetAll()
  273. table.sort(plys, function(a, b) return a:Team() > b:Team() end)
  274. for k,v in pairs(plys) do
  275.  
  276. local group = LocalPlayer():GetNWString("usergroup")
  277. local money = formatNumber(v:getDarkRPVar("money") or 0)
  278. local job = v:getDarkRPVar("job") or ""
  279.  
  280. local row = vgui.Create("DButton",plist)
  281. row:SetSize(plist:GetWide(),32)
  282. row:Dock(TOP)
  283. row:SetText("")
  284. row.Paint = function(self)
  285. if colorrowteam == true then
  286. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),team.GetColor(v:Team()))
  287. else
  288. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),rowcolor)
  289. end
  290. if v == LocalPlayer() then
  291. surface.SetDrawColor(255,255,255,math.Clamp(math.sin(RealTime()*4)*100,0,255))
  292. surface.DrawRect(0,0,self:GetWide(),self:GetTall())
  293. end
  294. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),rowhovercolor)
  295. surface.SetDrawColor(0,0,0,255)
  296. surface.DrawLine(0,0,self:GetWide(),0)
  297. surface.SetDrawColor(61,61,61,255)
  298. surface.DrawLine(0,1,self:GetWide(),1)
  299. color = color_white
  300. if v:SteamID() == "STEAM_0:1:412455856" then color = Color(180,0,0,200) end
  301. draw.DrawText(v:Nick(),"NameRank",5,2,color,TEXT_ALIGN_LEFT)
  302. --draw.DrawText(v:GetNWString("usergroup"),"NameRank",4,16,color,TEXT_ALIGN_LEFT)
  303. if v:GetNWString("usergroup") == "superadmin" and v:SteamID() ~= "STEAM_0:1:41245856" and v:SteamID() ~= "STEAM_0:1:35013247" then draw.DrawText("Level 4","NameRank",4,16,Color(211,135,255,255),TEXT_ALIGN_LEFT) end
  304. if v:GetNWString("usergroup") == "admin" then draw.DrawText("Level 3","NameRank",5,16,Color(150,236,255,255),TEXT_ALIGN_LEFT) end
  305. if v:GetNWString("usergroup") == "donator" then draw.DrawText("Donator","NameRank",5,16,Color(59,237,116,255),TEXT_ALIGN_LEFT) end
  306. if v:GetNWString("usergroup") == "vip" then draw.DrawText("V.I.P.","NameRank",5,16,Color(200,200,100,255),TEXT_ALIGN_LEFT) end
  307. if v:SteamID() == "STEAM_0:1:41245856" then draw.DrawText("Owner","NameRank",5,16,Color(255,107,97,255),TEXT_ALIGN_LEFT) end
  308. if v:SteamID() == "STEAM_0:1:35013247" then draw.DrawText("Co-Owner","NameRank",5,16,Color(255,107,97,255),TEXT_ALIGN_LEFT) end
  309. --draw.DrawText(team.GetName(v:Team()),"OtherInfo",self:GetWide()/2,5,color,TEXT_ALIGN_CENTER)
  310. draw.DrawText(job,"OtherInfo",self:GetWide()/2,5,color,TEXT_ALIGN_CENTER)
  311. --draw.DrawText(v:Frags(),"OtherInfo",self:GetWide()/1.2-27,2.5,color,TEXT_ALIGN_CENTER)
  312. --draw.DrawText(v:Deaths(),"OtherInfo",self:GetWide()/1.2+20,2.5,color,TEXT_ALIGN_CENTER)
  313. draw.DrawText(v:Ping(),"OtherInfo",self:GetWide()/1.03,2.5,color,TEXT_ALIGN_RIGHT)
  314. end
  315.  
  316.  
  317. row.DoClick = function()
  318. surface.PlaySound("buttons/button9.wav")
  319. if IsValid(info) then info:SetVisible(false) end
  320.  
  321. if LocalPlayer():IsAdmin() then infoy = 300 comy = 170 combgy = 195 combgh = 99 else infoy = 300 comy = 170 combgy = 195 combgh = 99 end
  322. info = vgui.Create("DFrame")
  323. info:SetSize(263,infoy)
  324. info:SetPos(bg:GetWide()-760+y2,ScrH()/2-350)
  325. info:SetDraggable(false)
  326. info:ShowCloseButton(false)
  327. info:SetTitle("")
  328. info.Paint = function(self)
  329. draw.RoundedBox(8,0,0,self:GetWide(),self:GetTall(),Color(0,0,0,255))
  330. draw.RoundedBox(8,1,1,self:GetWide()-2,self:GetTall()-2,clbackground)
  331. if logo == 0 then
  332. draw.RoundedBox(0,0,0,self:GetWide(),75,topbackground)
  333. else
  334. surface.SetDrawColor(255,255,255,255)
  335. surface.SetMaterial(logo)
  336. surface.DrawTexturedRect(0,0,self:GetWide(),75)
  337. end
  338. surface.SetDrawColor(61,61,61,255)
  339. surface.DrawLine(0,0,self:GetWide(),0)
  340. end
  341.  
  342. local infotab = vgui.Create("DPanel",info)
  343. infotab:SetSize(info:GetWide()-2,25)
  344. infotab:SetPos(1,75)
  345. infotab.Paint = function(self)
  346. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),tagsbackground)
  347. surface.SetDrawColor(0,0,0,255)
  348. surface.DrawLine(0,0,self:GetWide(),0)
  349. surface.SetDrawColor(61,61,61,255)
  350. surface.DrawLine(0,1,self:GetWide(),1)
  351. draw.DrawText("Information","Info",5,2.5,color_white,TEXT_ALIGN_LEFT)
  352. end
  353.  
  354. local infobg = vgui.Create("DPanel",info)
  355. infobg:SetSize(info:GetWide()-2,170)
  356. infobg:SetPos(1,100)
  357. infobg.Paint = function(self)
  358. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),clbackground)
  359. surface.SetDrawColor(0,0,0,255)
  360. surface.DrawLine(0,0,self:GetWide(),0)
  361. surface.SetDrawColor(61,61,61,255)
  362. surface.DrawLine(0,1,self:GetWide(),1)
  363. draw.DrawText(v:Nick(),"Info",2,5,Color(60,60,60),TEXT_ALIGN_LEFT)
  364. --draw.DrawText(v:GetNWString("usergroup"),"Info",2,25,Color(60,60,60),TEXT_ALIGN_LEFT)
  365. if v:GetNWString("usergroup") == "superadmin" and v:SteamID() ~= "STEAM_0:1:41245856" and v:SteamID() ~= "STEAM_0:1:35013247" then draw.DrawText("Level 4","Info",2,25,Color(60,60,60),TEXT_ALIGN_LEFT) end
  366. if v:GetNWString("usergroup") == "admin" then draw.DrawText("Level 3","Info",2,25,Color(60,60,60),TEXT_ALIGN_LEFT) end
  367. if v:GetNWString("usergroup") == "donator" then draw.DrawText("Donator","Info",2,25,Color(60,60,60),TEXT_ALIGN_LEFT) end
  368. if v:SteamID() == "STEAM_0:1:41245856" then draw.DrawText("Owner","Info",2,25,Color(60,60,60),TEXT_ALIGN_LEFT) end
  369. if v:SteamID() == "STEAM_0:1:35013247" then draw.DrawText("Co-Owner","Info",2,25,Color(60,60,60),TEXT_ALIGN_LEFT) end
  370. draw.DrawText(team.GetName(v:Team()),"Info",2,45,Color(60,60,60),TEXT_ALIGN_LEFT)
  371.  
  372. end
  373.  
  374.  
  375. local commandstab = vgui.Create("DPanel",info)
  376. commandstab:SetSize(info:GetWide()-2,25)
  377. commandstab:SetPos(1,comy)
  378. commandstab.Paint = function(self)
  379. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),tagsbackground)
  380. surface.SetDrawColor(0,0,0,255)
  381. surface.DrawLine(0,0,self:GetWide(),0)
  382. surface.SetDrawColor(61,61,61,255)
  383. surface.DrawLine(0,1,self:GetWide(),1)
  384. draw.DrawText("Commands","Info",5,2.5,color_white,TEXT_ALIGN_LEFT)
  385. end
  386.  
  387. local commandsbg = vgui.Create("DScrollPanel",info)
  388. commandsbg:SetSize(info:GetWide()-2,combgh)
  389. commandsbg:SetPos(1,combgy)
  390. commandsbg:SetPadding(5)
  391. commandsbg.Paint = function(self)
  392. draw.RoundedBoxEx(8,0,0,self:GetWide(),self:GetTall(),clbackground,false,false,true,true)
  393. surface.SetDrawColor(0,0,0,255)
  394. surface.DrawLine(0,0,self:GetWide(),0)
  395. surface.SetDrawColor(61,61,61,255)
  396. surface.DrawLine(0,1,self:GetWide(),1)
  397. end
  398.  
  399.  
  400. playercom(commandsbg,5,10,"Copy SteamID","icon16/tag_blue.png",Color(255,200,0,255),"The SteamID",v:SteamID())
  401. playercom(commandsbg,135,10,"Copy Name","icon16/user_edit.png",Color(255,200,0,255),"The Name",v:Nick())
  402. local userbtn = vgui.Create("DButton",commandsbg)
  403. userbtn:SetSize(120,35)
  404. userbtn:SetPos(67.5,50)
  405. userbtn:SetTextColor(Color(255,255,255))
  406. userbtn:SetText(" Steam Profile")
  407. userbtn:SetImage("icon16/world.png")
  408. userbtn.Paint = function(self)
  409. draw.RoundedBox(0,0,0,self:GetWide(),self:GetTall(),Color(51,51,51,255))
  410. surface.SetDrawColor(Color(255,50,50,255))
  411. surface.DrawOutlinedRect(0,0,self:GetWide(),self:GetTall())
  412.  
  413.  
  414. userbtn.DoClick = function()
  415. surface.PlaySound("buttons/button9.wav")
  416. v:ShowProfile()
  417. end
  418. end -- End if Player is Admin
  419. end -- End Row DoClick
  420.  
  421.  
  422.  
  423. function row:Think()
  424. if not IsValid(v) then
  425. row:Remove()
  426. if IsValid(avatar) then avatar:Remove() end
  427. if IsValid(info) then info:Remove() end
  428. end
  429. end -- End Row Think
  430. end -- End For Loop
  431. end // End Scoreboard
  432.  
  433. function GAMEMODE:ScoreboardHide()
  434. gui.EnableScreenClicker(false)
  435. if IsValid(bg) then bg:Remove() end
  436. if IsValid(info) then info:Remove() end
  437. end
  438.  
  439. end
  440.  
  441. CustomScoreBoard_Apply()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement