Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.99 KB | None | 0 0
  1. /*
  2. █░░░█ █▀▀ █░░ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █▀▀ █░░█ █▀▀ ▀▀█▀▀ █▀▀ █▀▄▀█
  3. █▄█▄█ █▀▀ █░░ █░░ █░░█ █░▀░█ █▀▀ ▀▀█ █▄▄█ ▀▀█ ░░█░░ █▀▀ █░▀░█
  4. ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▀▀▀ ▄▄▄█ ▀▀▀ ░░▀░░ ▀▀▀ ▀░░░▀
  5.  
  6.  
  7.  
  8. @Author: FVJohnny http://steamcommunity.com/id/FVJohnny/
  9. @Client: [SBS] The Guy http://steamcommunity.com/id/imtheguyonsteam/
  10. @Gamemode: doesnt matter
  11. @File Description: Autorun file that loads all the other files and initializes data.
  12. */
  13.  
  14. if not SBS_WELCOME then return end
  15. if not CLIENT then return end
  16.  
  17. for i=10, 100 do
  18. surface.CreateFont( "SBS_WELCOME.Outlined.Size"..i, {
  19. font = "BFHUD", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  20. extended = false,
  21. size = i,
  22. weight = 500,
  23. blursize = 0,
  24. scanlines = 0,
  25. antialias = true,
  26. underline = false,
  27. italic = false,
  28. strikeout = false,
  29. symbol = false,
  30. rotary = false,
  31. shadow = false,
  32. additive = false,
  33. outline = true,
  34. } )
  35. surface.CreateFont( "SBS_WELCOME.Size"..i, {
  36. font = "BFHUD", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  37. extended = false,
  38. size = i,
  39. weight = 500,
  40. blursize = 0,
  41. scanlines = 0,
  42. antialias = true,
  43. underline = false,
  44. italic = false,
  45. strikeout = false,
  46. symbol = false,
  47. rotary = false,
  48. shadow = false,
  49. additive = false,
  50. outline = false,
  51. } )
  52. end
  53.  
  54. function draw.OutlinedBox( x, y, w, h, thickness, clr )
  55. surface.SetDrawColor( clr )
  56. for i=0, thickness - 1 do
  57. surface.DrawOutlinedRect( x + i, y + i, w - i * 2, h - i * 2 )
  58. end
  59. end
  60. function draw.OutlinedRect(x, y, w, h, InnerColor, OutlineThickness, OutlineColor)
  61. draw.RoundedBox( 0, x, y, w, h, InnerColor)
  62. draw.OutlinedBox( x, y, w, h, OutlineThickness, OutlineColor )
  63. end
  64. function draw.Line(startX, startY, endX, endY, color, thickness, horizontal)
  65. surface.SetDrawColor( color )
  66. for i=1,thickness do
  67. if horizontal then
  68. surface.DrawLine(startX, startY + i, endX, endY + i)
  69. else
  70. surface.DrawLine(startX + i, startY, endX + i, endY)
  71. end
  72. end
  73. end
  74. local blur = Material("pp/blurscreen")
  75.  
  76. function JohnnyBlur( p, a, d )
  77. local x, y = p:LocalToScreen(0, 0)
  78. surface.SetDrawColor( 255, 255, 255 )
  79. surface.SetMaterial( blur )
  80. for i = 1, d do
  81. blur:SetFloat( "$blur", (i / d ) * ( a ) )
  82. blur:Recompute()
  83. render.UpdateScreenEffectTexture()
  84. surface.DrawTexturedRect( x * -1, y * -1, ScrW(), ScrH() )
  85. end
  86. end
  87.  
  88. local function regenerateText()
  89. if IsValid(SBS_WELCOME.CurrentText) then SBS_WELCOME.CurrentText:Remove() end
  90.  
  91. local sbar = SBS_WELCOME.Scroll:GetVBar()
  92.  
  93. SBS_WELCOME.Scroll:Clear()
  94.  
  95. SBS_WELCOME.CurrentText = SBS_WELCOME.Scroll:Add("DFrame")
  96. SBS_WELCOME.CurrentText:SetTitle("")
  97. SBS_WELCOME.CurrentText:ShowCloseButton(false)
  98.  
  99.  
  100. if IsValid(sbar) and sbar:IsVisible() then
  101. x,y = SBS_WELCOME.CurrentText:GetPos()
  102. SBS_WELCOME.CurrentText:SetPos(x- 10 ,y)
  103. end
  104. function SBS_WELCOME.CurrentText:Think()
  105.  
  106. surface.SetFont("SBS_WELCOME.Size40")
  107.  
  108. local TitleW, TitleH = surface.GetTextSize(SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].title)
  109. surface.SetFont("SBS_WELCOME.Size25")
  110. local BodyW, BodyH = surface.GetTextSize(SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].body)
  111.  
  112. self:SetSize(SBS_WELCOME.Scroll:GetWide()*0.9, math.max(self:GetTall(), BodyH + TitleH + 10))
  113.  
  114.  
  115. self.seen = true
  116. local x,y = self:GetPos()
  117.  
  118. if ((self:GetTall() - sbar:GetScroll()) < (SBS_WELCOME.Scroll:GetTall() + 50)) then
  119. self.completed = true
  120. end
  121.  
  122. SBS_WELCOME.CurrentText:SetPos(SBS_WELCOME.Scroll:GetWide()/2 - self:GetWide() /2 ,y)
  123.  
  124. if IsValid(sbar) and sbar:IsVisible() then
  125. x,y = SBS_WELCOME.CurrentText:GetPos()
  126. self:SetPos(x- 10 ,y)
  127. end
  128. end
  129. function SBS_WELCOME.CurrentText:Paint(w, h)
  130. draw.OutlinedRect(0, 0, w, h, Color( 0,0,0,140 ), 1, Color(160,160,160,186))
  131.  
  132. draw.DrawText(SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].title, "SBS_WELCOME.Size40", w/2, 0, SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].titlecolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  133. draw.DrawText(SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].body, "SBS_WELCOME.Size25", w/2, 50, SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].bodycolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
  134. end
  135. end
  136.  
  137. SBS_WELCOME.OpenVGUI = function(open)
  138. if not open then return end
  139.  
  140. if IsValid(SBS_WELCOME.BG) then SBS_WELCOME.BG:Remove() end
  141. SBS_WELCOME.CurrentPage = 1
  142.  
  143. SBS_WELCOME.BG = vgui.Create("DFrame")
  144. SBS_WELCOME.BG:SetSize(650,700)
  145. SBS_WELCOME.BG:Center()
  146. SBS_WELCOME.BG:ShowCloseButton(false)
  147. SBS_WELCOME.BG:SetTitle("")
  148. SBS_WELCOME.BG:MakePopup()
  149. SBS_WELCOME.BG.startTime = SysTime()
  150. function SBS_WELCOME.BG:Paint(w, h)
  151. Derma_DrawBackgroundBlur( self, self.startTime )
  152. Derma_DrawBackgroundBlur( self, self.startTime )
  153.  
  154. draw.OutlinedRect(0, 40, w, h, Color( 0,0,0,256 ), 2, Color(0,0,0,256))
  155. draw.OutlinedRect(0, 0, w, 40, Color( 0,0,0,230 ), 2, Color(0,0,0,256))
  156.  
  157. draw.DrawText("Welcome to [SBS] Battlefront RP! ("..SBS_WELCOME.CurrentPage.."/"..#SBS_WELCOME.Pages..")", "SBS_WELCOME.Size40", w/2, -2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  158.  
  159. if IsValid(SBS_WELCOME.BackgroundImage) then
  160. local ix,iy = SBS_WELCOME.BackgroundImage:GetPos()
  161. local iw,ih = SBS_WELCOME.BackgroundImage:GetSize()
  162.  
  163.  
  164.  
  165. draw.OutlinedRect(ix, iy, iw-8, ih-8, Color( 0,0,0,180 ), 1, Color(160,160,160,186))
  166. end
  167. end
  168.  
  169.  
  170.  
  171. SBS_WELCOME.BackgroundImage = vgui.Create("DHTML", SBS_WELCOME.BG)
  172. SBS_WELCOME.BackgroundImage:SetPos(0, 40)
  173. SBS_WELCOME.BackgroundImage:SetSize(SBS_WELCOME.BG:GetWide()+1, SBS_WELCOME.BG:GetTall() - 35)
  174. SBS_WELCOME.BackgroundImage:CenterHorizontal(0.506)
  175. local timeThink = 0
  176. local image = ""
  177. function SBS_WELCOME.BackgroundImage:Think()
  178. local pageImage = SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].image
  179.  
  180. if pageImage and (self.image~= pageImage) then
  181. self.image = pageImage
  182. self:SetHTML( [[<img style="opacity: 0.3;" src="]]..self.image..[[" width="]]..(self:GetWide()-30)..[[" height="]]..(self:GetTall()-30)..[[">]] )
  183. end
  184. end
  185.  
  186. SBS_WELCOME.BackgroundImage2 = vgui.Create("DFrame", SBS_WELCOME.BG)
  187. SBS_WELCOME.BackgroundImage2:SetPos(SBS_WELCOME.BackgroundImage:GetPos())
  188. SBS_WELCOME.BackgroundImage2:SetSize(SBS_WELCOME.BackgroundImage:GetWide()*0.99, SBS_WELCOME.BackgroundImage:GetTall()*0.99)
  189. SBS_WELCOME.BackgroundImage2:SetTitle("")
  190. SBS_WELCOME.BackgroundImage2:ShowCloseButton(false)
  191. function SBS_WELCOME.BackgroundImage2:Paint(w, h)
  192. JohnnyBlur(self,3,5)
  193. end
  194. SBS_WELCOME.Scroll = vgui.Create("DScrollPanel", SBS_WELCOME.BG)
  195. SBS_WELCOME.Scroll:SetSize(SBS_WELCOME.BackgroundImage2:GetWide(), SBS_WELCOME.BackgroundImage2:GetTall()-75)
  196. SBS_WELCOME.Scroll:SetPos(SBS_WELCOME.BackgroundImage2:GetPos())
  197. SBS_WELCOME.Scroll:CenterHorizontal(0.5)
  198.  
  199.  
  200. SBS_WELCOME.BackButton = vgui.Create("DButton",SBS_WELCOME.BG)
  201. SBS_WELCOME.BackButton:SetText("")
  202. SBS_WELCOME.BackButton:SetSize(100, 50)
  203. SBS_WELCOME.BackButton:SetPos(0, SBS_WELCOME.BG:GetTall() - SBS_WELCOME.BackButton:GetTall() - 15)
  204. SBS_WELCOME.BackButton:CenterHorizontal(0.2)
  205. function SBS_WELCOME.BackButton:Paint(w, h)
  206. if SBS_WELCOME.CurrentPage <=1 then
  207. draw.OutlinedRect(0, 0, w, h, Color( 150,150,150,125 ), 1, Color(160,160,160,186))
  208. else
  209. draw.OutlinedRect(0, 0, w, h, self:IsHovered() and Color( 0,0,0,250 ) or Color( 0,0,0,240 ), 1, Color(160,160,160,186))
  210. end
  211.  
  212. draw.DrawText("Back", "SBS_WELCOME.Size40", w/2, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  213. end
  214. function SBS_WELCOME.BackButton:DoClick()
  215. if SBS_WELCOME.CurrentPage <=1 then
  216. surface.PlaySound("common/wpn_denyselect.wav")
  217. return
  218. end
  219.  
  220. SBS_WELCOME.CurrentPage = SBS_WELCOME.CurrentPage - 1
  221. regenerateText()
  222. surface.PlaySound("buttons/blip1.wav")
  223. end
  224.  
  225.  
  226. SBS_WELCOME.ForwardButton = vgui.Create("DButton",SBS_WELCOME.BG)
  227. SBS_WELCOME.ForwardButton:SetText("")
  228. SBS_WELCOME.ForwardButton:SetSize(100, 50)
  229. SBS_WELCOME.ForwardButton:SetPos(0, SBS_WELCOME.BG:GetTall() - SBS_WELCOME.BackButton:GetTall() - 15)
  230. SBS_WELCOME.ForwardButton:CenterHorizontal(0.8)
  231. function SBS_WELCOME.ForwardButton:Paint(w, h)
  232. if (SBS_WELCOME.CurrentPage >= #SBS_WELCOME.Pages) or (not SBS_WELCOME.CurrentText.completed) then
  233. draw.OutlinedRect(0, 0, w, h, Color( 150,150,150,125 ), 1, Color(160,160,160,186))
  234. else
  235. draw.OutlinedRect(0, 0, w, h, self:IsHovered() and Color( 0,0,0,250 ) or Color( 0,0,0,240 ), 1, Color(160,160,160,186))
  236. end
  237.  
  238. draw.DrawText("Next", "SBS_WELCOME.Size40", w/2, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  239. end
  240. function SBS_WELCOME.ForwardButton:DoClick()
  241. if SBS_WELCOME.CurrentPage >= #SBS_WELCOME.Pages then
  242. surface.PlaySound("common/wpn_denyselect.wav")
  243. return
  244. end
  245.  
  246. if not SBS_WELCOME.CurrentText.completed then
  247. surface.PlaySound("common/wpn_denyselect.wav")
  248. return
  249. end
  250. SBS_WELCOME.CurrentPage = SBS_WELCOME.CurrentPage + 1
  251. regenerateText()
  252. surface.PlaySound("buttons/blip1.wav")
  253. end
  254.  
  255. SBS_WELCOME.CloseButton = vgui.Create("DButton",SBS_WELCOME.BG)
  256. SBS_WELCOME.CloseButton:SetText("")
  257. SBS_WELCOME.CloseButton:SetSize(100, 50)
  258. SBS_WELCOME.CloseButton:SetPos(0, SBS_WELCOME.BG:GetTall() - SBS_WELCOME.BackButton:GetTall() - 15)
  259. SBS_WELCOME.CloseButton:CenterHorizontal(0.5)
  260. function SBS_WELCOME.CloseButton:Paint(w, h)
  261.  
  262. draw.OutlinedRect(0, 0, w, h, ((SBS_WELCOME.CurrentPage == #SBS_WELCOME.Pages) and SBS_WELCOME.CurrentText.completed) and Color( 0,0,0,240 ) or Color( 150,150,150,125 ), 1, Color(160,160,160,186))
  263.  
  264. draw.DrawText("Close", "SBS_WELCOME.Size40", w/2, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  265. end
  266. function SBS_WELCOME.CloseButton:DoClick()
  267. if SBS_WELCOME.CurrentPage ~= #SBS_WELCOME.Pages then
  268. surface.PlaySound("common/wpn_denyselect.wav")
  269. return
  270. end
  271.  
  272. if not SBS_WELCOME.CurrentText.completed then
  273. surface.PlaySound("common/wpn_denyselect.wav")
  274. return
  275. end
  276.  
  277.  
  278.  
  279. if RP_MAPS[game.GetMap()] and (not file.Exists("welcome"..SBS_WELCOME.VERSION..".txt", "DATA")) then
  280. DarkRP.openF4Menu()
  281. end
  282.  
  283. file.Write("welcome"..SBS_WELCOME.VERSION..".txt", "")
  284. SBS_WELCOME.BG:Remove()
  285. surface.PlaySound("buttons/blip1.wav")
  286. end
  287.  
  288.  
  289.  
  290. regenerateText()
  291.  
  292. end
  293.  
  294. net.Receive("WELCOME:Vgui", function()
  295. SBS_WELCOME.OpenVGUI(net.ReadBool() or (not file.Exists("welcome"..SBS_WELCOME.VERSION..".txt", "DATA")))
  296. end)
  297. if IsValid(SBS_WELCOME.BG) then SBS_WELCOME.BG:Remove() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement