Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. surface.CreateFont( "ServerIntroButtonFont", {
  2. font = "Bebas Neue",
  3. size = 40,
  4. weight = 500,
  5. blursize = 0,
  6. scanlines = 0,
  7. antialias = true
  8. } )
  9.  
  10. surface.CreateFont( "ServerIntroTitleFont", {
  11. font = "Bebas Neue",
  12. size = 80,
  13. weight = 500,
  14. blursize = 0,
  15. scanlines = 0,
  16. antialias = true
  17. } )
  18.  
  19. net.Receive("ServerIntroMenuStart", function()
  20.  
  21. local blur = Material("pp/blurscreen")
  22. local function DrawBlur(panel, amount)
  23. local x, y = panel:LocalToScreen(0, 0)
  24. local scrW, scrH = ScrW(), ScrH()
  25. surface.SetDrawColor(255, 255, 255)
  26. surface.SetMaterial(blur)
  27. for i = 1, 3 do
  28. blur:SetFloat("$blur", (i / 3) * (amount or 6))
  29. blur:Recompute()
  30. render.UpdateScreenEffectTexture()
  31. surface.DrawTexturedRect(x * -1, y * -1, scrW, scrH)
  32. end
  33. end
  34.  
  35.  
  36. local ServerIntroMenu = vgui.Create("DFrame")
  37. ServerIntroMenu:SetSize(900, 450)
  38. ServerIntroMenu:Center()
  39. ServerIntroMenu:SetTitle("")
  40. ServerIntroMenu:MakePopup()
  41. ServerIntroMenu:ShowCloseButton(false)
  42.  
  43. ServerIntroMenu.Paint = function(self, w, h)
  44.  
  45. if SERVER_INTRO_CONFIG.BlurredBackground then
  46.  
  47. DrawBlur(ServerIntroMenu, 3)
  48.  
  49. end
  50.  
  51. end
  52.  
  53. local ServerIntroTitle = vgui.Create("DLabel", ServerIntroMenu)
  54. ServerIntroTitle:SetSize(ServerIntroMenu:GetWide(), 80)
  55. ServerIntroTitle:SetContentAlignment(5)
  56. ServerIntroTitle:SetTextColor(SERVER_INTRO_CONFIG.TitleColor)
  57. ServerIntroTitle:SetText(SERVER_INTRO_CONFIG.Title)
  58. ServerIntroTitle:SetFont("ServerIntroTitleFont")
  59.  
  60. local ServerIntroPanel = vgui.Create("DPanel", ServerIntroMenu)
  61. ServerIntroPanel:SetSize(400, 350)
  62. ServerIntroPanel:SetPos(ServerIntroMenu:GetWide() / 2 - ServerIntroPanel:GetWide() / 2, ServerIntroMenu:GetTall() - ServerIntroPanel:GetTall() + 8)
  63.  
  64. ServerIntroPanel.Paint = function(self, w, h)
  65.  
  66. DrawBlur(ServerIntroPanel, 5)
  67.  
  68. end
  69.  
  70. local SpawnButton = vgui.Create("DButton", ServerIntroPanel)
  71. SpawnButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
  72. SpawnButton:SetPos(0, 0)
  73. SpawnButton:SetFont("ServerIntroButtonFont")
  74. SpawnButton:SetText(SERVER_INTRO_CONFIG.SpawnButtonText)
  75. SpawnButton:SetTextColor(Color(255, 255, 255))
  76.  
  77. SpawnButton.Paint = function(self, w, h)
  78.  
  79. if self:IsHovered() then
  80.  
  81. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
  82. --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 200) )
  83.  
  84. else
  85.  
  86. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
  87. --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 180) )
  88.  
  89. end
  90.  
  91. end
  92.  
  93. SpawnButton.DoClick = function()
  94.  
  95. ServerIntroMenu:Remove()
  96.  
  97. net.Start("ServerIntroMenuSpawn")
  98. net.SendToServer()
  99.  
  100. end
  101.  
  102. SpawnButton.OnCursorEntered = function()
  103.  
  104. surface.PlaySound("buttons/lightswitch2.wav")
  105.  
  106. end
  107.  
  108. local DonateButton = vgui.Create("DButton", ServerIntroPanel)
  109. DonateButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
  110. DonateButton:SetPos(0, ServerIntroPanel:GetTall() / 4)
  111. DonateButton:SetFont("ServerIntroButtonFont")
  112. DonateButton:SetText(SERVER_INTRO_CONFIG.DonateButtonText)
  113. DonateButton:SetTextColor(Color(255, 255, 255))
  114.  
  115. DonateButton.Paint = function(self, w, h)
  116.  
  117. if self:IsHovered() then
  118.  
  119. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
  120. --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 200) )
  121.  
  122. else
  123.  
  124. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
  125. --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 180) )
  126.  
  127. end
  128.  
  129. end
  130.  
  131. DonateButton.DoClick = function()
  132.  
  133. gui.OpenURL(SERVER_INTRO_CONFIG.DonateLink)
  134.  
  135. end
  136.  
  137. DonateButton.OnCursorEntered = function()
  138.  
  139. surface.PlaySound("buttons/lightswitch2.wav")
  140.  
  141. end
  142.  
  143. local HomepageButton = vgui.Create("DButton", ServerIntroPanel)
  144. HomepageButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
  145. HomepageButton:SetPos(0, ServerIntroPanel:GetTall() / 4 * 2 - 1)
  146. HomepageButton:SetFont("ServerIntroButtonFont")
  147. HomepageButton:SetText(SERVER_INTRO_CONFIG.HomepageButtonText)
  148. HomepageButton:SetTextColor(Color(255, 255, 255))
  149.  
  150. HomepageButton.Paint = function(self, w, h)
  151.  
  152. if self:IsHovered() then
  153.  
  154. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
  155. --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 200) )
  156.  
  157. else
  158.  
  159. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
  160. --draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 255, 255, 180) )
  161.  
  162. end
  163.  
  164. end
  165.  
  166. HomepageButton.DoClick = function()
  167.  
  168. gui.OpenURL(SERVER_INTRO_CONFIG.HomepageLink)
  169.  
  170. end
  171.  
  172. HomepageButton.OnCursorEntered = function()
  173.  
  174. surface.PlaySound("buttons/lightswitch2.wav")
  175.  
  176. end
  177.  
  178. local DisconnectButton = vgui.Create("DButton", ServerIntroPanel)
  179. DisconnectButton:SetSize(ServerIntroPanel:GetWide(), ServerIntroPanel:GetTall() / 4 - 5)
  180. DisconnectButton:SetPos(0, ServerIntroPanel:GetTall() / 4 * 3 - 1)
  181. DisconnectButton:SetFont("ServerIntroButtonFont")
  182. DisconnectButton:SetText(SERVER_INTRO_CONFIG.DisconnectButtonText)
  183. DisconnectButton:SetTextColor(Color(255, 255, 255))
  184.  
  185. DisconnectButton.Paint = function(self, w, h)
  186.  
  187. if self:IsHovered() then
  188.  
  189. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 200) )
  190. draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 0, 0, 200) )
  191.  
  192. else
  193.  
  194. draw.RoundedBox( 0, 0, 0, w, h, Color(30, 30, 30, 180) )
  195. draw.RoundedBox( 0, 10, 10, w-20, h-20, Color(255, 0, 0, 180) )
  196.  
  197. end
  198.  
  199. end
  200.  
  201. DisconnectButton.DoClick = function()
  202.  
  203. LocalPlayer():ConCommand("disconnect")
  204.  
  205. end
  206.  
  207. DisconnectButton.OnCursorEntered = function()
  208.  
  209. surface.PlaySound("buttons/lightswitch2.wav")
  210.  
  211. end
  212.  
  213. end)
  214.  
  215. net.Receive("ServerIntroCamUpdate", function()
  216.  
  217. local DataRead = net.ReadTable()
  218.  
  219. local ply = LocalPlayer()
  220. ply.Cam = DataRead.Cam
  221. ply.Spawned = DataRead.Spawned
  222.  
  223. end)
  224.  
  225. hook.Add( "CalcView", "MyCalcView", function()
  226.  
  227. local ply = LocalPlayer()
  228.  
  229. if !ply.Spawned then
  230.  
  231. local view = {}
  232. view.origin = SERVER_INTRO_CONFIG.Cam[game.GetMap()][ply.Cam or 1].pos
  233. view.angles = SERVER_INTRO_CONFIG.Cam[game.GetMap()][ply.Cam or 1].angle
  234. view.fov = SERVER_INTRO_CONFIG.Cam[game.GetMap()][ply.Cam or 1].fov
  235. view.drawviewer = true
  236. return view
  237.  
  238. end
  239.  
  240. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement