Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- █░░░█ █▀▀ █░░ █▀▀ █▀▀█ █▀▄▀█ █▀▀ █▀▀ █░░█ █▀▀ ▀▀█▀▀ █▀▀ █▀▄▀█
- █▄█▄█ █▀▀ █░░ █░░ █░░█ █░▀░█ █▀▀ ▀▀█ █▄▄█ ▀▀█ ░░█░░ █▀▀ █░▀░█
- ░▀░▀░ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀░░░▀ ▀▀▀ ▀▀▀ ▄▄▄█ ▀▀▀ ░░▀░░ ▀▀▀ ▀░░░▀
- @Author: FVJohnny http://steamcommunity.com/id/FVJohnny/
- @Client: [SBS] The Guy http://steamcommunity.com/id/imtheguyonsteam/
- @Gamemode: doesnt matter
- @File Description: Autorun file that loads all the other files and initializes data.
- */
- if not SBS_WELCOME then return end
- if not CLIENT then return end
- for i=10, 100 do
- surface.CreateFont( "SBS_WELCOME.Outlined.Size"..i, {
- font = "BFHUD", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = i,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = true,
- } )
- surface.CreateFont( "SBS_WELCOME.Size"..i, {
- font = "BFHUD", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = i,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- end
- function draw.OutlinedBox( x, y, w, h, thickness, clr )
- surface.SetDrawColor( clr )
- for i=0, thickness - 1 do
- surface.DrawOutlinedRect( x + i, y + i, w - i * 2, h - i * 2 )
- end
- end
- function draw.OutlinedRect(x, y, w, h, InnerColor, OutlineThickness, OutlineColor)
- draw.RoundedBox( 0, x, y, w, h, InnerColor)
- draw.OutlinedBox( x, y, w, h, OutlineThickness, OutlineColor )
- end
- function draw.Line(startX, startY, endX, endY, color, thickness, horizontal)
- surface.SetDrawColor( color )
- for i=1,thickness do
- if horizontal then
- surface.DrawLine(startX, startY + i, endX, endY + i)
- else
- surface.DrawLine(startX + i, startY, endX + i, endY)
- end
- end
- end
- local blur = Material("pp/blurscreen")
- function JohnnyBlur( p, a, d )
- local x, y = p:LocalToScreen(0, 0)
- surface.SetDrawColor( 255, 255, 255 )
- surface.SetMaterial( blur )
- for i = 1, d do
- blur:SetFloat( "$blur", (i / d ) * ( a ) )
- blur:Recompute()
- render.UpdateScreenEffectTexture()
- surface.DrawTexturedRect( x * -1, y * -1, ScrW(), ScrH() )
- end
- end
- local function regenerateText()
- if IsValid(SBS_WELCOME.CurrentText) then SBS_WELCOME.CurrentText:Remove() end
- local sbar = SBS_WELCOME.Scroll:GetVBar()
- SBS_WELCOME.Scroll:Clear()
- SBS_WELCOME.CurrentText = SBS_WELCOME.Scroll:Add("DFrame")
- SBS_WELCOME.CurrentText:SetTitle("")
- SBS_WELCOME.CurrentText:ShowCloseButton(false)
- if IsValid(sbar) and sbar:IsVisible() then
- x,y = SBS_WELCOME.CurrentText:GetPos()
- SBS_WELCOME.CurrentText:SetPos(x- 10 ,y)
- end
- function SBS_WELCOME.CurrentText:Think()
- surface.SetFont("SBS_WELCOME.Size40")
- local TitleW, TitleH = surface.GetTextSize(SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].title)
- surface.SetFont("SBS_WELCOME.Size25")
- local BodyW, BodyH = surface.GetTextSize(SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].body)
- self:SetSize(SBS_WELCOME.Scroll:GetWide()*0.9, math.max(self:GetTall(), BodyH + TitleH + 10))
- self.seen = true
- local x,y = self:GetPos()
- if ((self:GetTall() - sbar:GetScroll()) < (SBS_WELCOME.Scroll:GetTall() + 50)) then
- self.completed = true
- end
- SBS_WELCOME.CurrentText:SetPos(SBS_WELCOME.Scroll:GetWide()/2 - self:GetWide() /2 ,y)
- if IsValid(sbar) and sbar:IsVisible() then
- x,y = SBS_WELCOME.CurrentText:GetPos()
- self:SetPos(x- 10 ,y)
- end
- end
- function SBS_WELCOME.CurrentText:Paint(w, h)
- draw.OutlinedRect(0, 0, w, h, Color( 0,0,0,140 ), 1, Color(160,160,160,186))
- 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)
- 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)
- end
- end
- SBS_WELCOME.OpenVGUI = function(open)
- if not open then return end
- if IsValid(SBS_WELCOME.BG) then SBS_WELCOME.BG:Remove() end
- SBS_WELCOME.CurrentPage = 1
- SBS_WELCOME.BG = vgui.Create("DFrame")
- SBS_WELCOME.BG:SetSize(650,700)
- SBS_WELCOME.BG:Center()
- SBS_WELCOME.BG:ShowCloseButton(false)
- SBS_WELCOME.BG:SetTitle("")
- SBS_WELCOME.BG:MakePopup()
- SBS_WELCOME.BG.startTime = SysTime()
- function SBS_WELCOME.BG:Paint(w, h)
- Derma_DrawBackgroundBlur( self, self.startTime )
- Derma_DrawBackgroundBlur( self, self.startTime )
- draw.OutlinedRect(0, 40, w, h, Color( 0,0,0,256 ), 2, Color(0,0,0,256))
- draw.OutlinedRect(0, 0, w, 40, Color( 0,0,0,230 ), 2, Color(0,0,0,256))
- 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)
- if IsValid(SBS_WELCOME.BackgroundImage) then
- local ix,iy = SBS_WELCOME.BackgroundImage:GetPos()
- local iw,ih = SBS_WELCOME.BackgroundImage:GetSize()
- draw.OutlinedRect(ix, iy, iw-8, ih-8, Color( 0,0,0,180 ), 1, Color(160,160,160,186))
- end
- end
- SBS_WELCOME.BackgroundImage = vgui.Create("DHTML", SBS_WELCOME.BG)
- SBS_WELCOME.BackgroundImage:SetPos(0, 40)
- SBS_WELCOME.BackgroundImage:SetSize(SBS_WELCOME.BG:GetWide()+1, SBS_WELCOME.BG:GetTall() - 35)
- SBS_WELCOME.BackgroundImage:CenterHorizontal(0.506)
- local timeThink = 0
- local image = ""
- function SBS_WELCOME.BackgroundImage:Think()
- local pageImage = SBS_WELCOME.Pages[SBS_WELCOME.CurrentPage].image
- if pageImage and (self.image~= pageImage) then
- self.image = pageImage
- self:SetHTML( [[<img style="opacity: 0.3;" src="]]..self.image..[[" width="]]..(self:GetWide()-30)..[[" height="]]..(self:GetTall()-30)..[[">]] )
- end
- end
- SBS_WELCOME.BackgroundImage2 = vgui.Create("DFrame", SBS_WELCOME.BG)
- SBS_WELCOME.BackgroundImage2:SetPos(SBS_WELCOME.BackgroundImage:GetPos())
- SBS_WELCOME.BackgroundImage2:SetSize(SBS_WELCOME.BackgroundImage:GetWide()*0.99, SBS_WELCOME.BackgroundImage:GetTall()*0.99)
- SBS_WELCOME.BackgroundImage2:SetTitle("")
- SBS_WELCOME.BackgroundImage2:ShowCloseButton(false)
- function SBS_WELCOME.BackgroundImage2:Paint(w, h)
- JohnnyBlur(self,3,5)
- end
- SBS_WELCOME.Scroll = vgui.Create("DScrollPanel", SBS_WELCOME.BG)
- SBS_WELCOME.Scroll:SetSize(SBS_WELCOME.BackgroundImage2:GetWide(), SBS_WELCOME.BackgroundImage2:GetTall()-75)
- SBS_WELCOME.Scroll:SetPos(SBS_WELCOME.BackgroundImage2:GetPos())
- SBS_WELCOME.Scroll:CenterHorizontal(0.5)
- SBS_WELCOME.BackButton = vgui.Create("DButton",SBS_WELCOME.BG)
- SBS_WELCOME.BackButton:SetText("")
- SBS_WELCOME.BackButton:SetSize(100, 50)
- SBS_WELCOME.BackButton:SetPos(0, SBS_WELCOME.BG:GetTall() - SBS_WELCOME.BackButton:GetTall() - 15)
- SBS_WELCOME.BackButton:CenterHorizontal(0.2)
- function SBS_WELCOME.BackButton:Paint(w, h)
- if SBS_WELCOME.CurrentPage <=1 then
- draw.OutlinedRect(0, 0, w, h, Color( 150,150,150,125 ), 1, Color(160,160,160,186))
- else
- 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))
- end
- draw.DrawText("Back", "SBS_WELCOME.Size40", w/2, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- function SBS_WELCOME.BackButton:DoClick()
- if SBS_WELCOME.CurrentPage <=1 then
- surface.PlaySound("common/wpn_denyselect.wav")
- return
- end
- SBS_WELCOME.CurrentPage = SBS_WELCOME.CurrentPage - 1
- regenerateText()
- surface.PlaySound("buttons/blip1.wav")
- end
- SBS_WELCOME.ForwardButton = vgui.Create("DButton",SBS_WELCOME.BG)
- SBS_WELCOME.ForwardButton:SetText("")
- SBS_WELCOME.ForwardButton:SetSize(100, 50)
- SBS_WELCOME.ForwardButton:SetPos(0, SBS_WELCOME.BG:GetTall() - SBS_WELCOME.BackButton:GetTall() - 15)
- SBS_WELCOME.ForwardButton:CenterHorizontal(0.8)
- function SBS_WELCOME.ForwardButton:Paint(w, h)
- if (SBS_WELCOME.CurrentPage >= #SBS_WELCOME.Pages) or (not SBS_WELCOME.CurrentText.completed) then
- draw.OutlinedRect(0, 0, w, h, Color( 150,150,150,125 ), 1, Color(160,160,160,186))
- else
- 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))
- end
- draw.DrawText("Next", "SBS_WELCOME.Size40", w/2, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- function SBS_WELCOME.ForwardButton:DoClick()
- if SBS_WELCOME.CurrentPage >= #SBS_WELCOME.Pages then
- surface.PlaySound("common/wpn_denyselect.wav")
- return
- end
- if not SBS_WELCOME.CurrentText.completed then
- surface.PlaySound("common/wpn_denyselect.wav")
- return
- end
- SBS_WELCOME.CurrentPage = SBS_WELCOME.CurrentPage + 1
- regenerateText()
- surface.PlaySound("buttons/blip1.wav")
- end
- SBS_WELCOME.CloseButton = vgui.Create("DButton",SBS_WELCOME.BG)
- SBS_WELCOME.CloseButton:SetText("")
- SBS_WELCOME.CloseButton:SetSize(100, 50)
- SBS_WELCOME.CloseButton:SetPos(0, SBS_WELCOME.BG:GetTall() - SBS_WELCOME.BackButton:GetTall() - 15)
- SBS_WELCOME.CloseButton:CenterHorizontal(0.5)
- function SBS_WELCOME.CloseButton:Paint(w, h)
- 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))
- draw.DrawText("Close", "SBS_WELCOME.Size40", w/2, 0, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- function SBS_WELCOME.CloseButton:DoClick()
- if SBS_WELCOME.CurrentPage ~= #SBS_WELCOME.Pages then
- surface.PlaySound("common/wpn_denyselect.wav")
- return
- end
- if not SBS_WELCOME.CurrentText.completed then
- surface.PlaySound("common/wpn_denyselect.wav")
- return
- end
- if not PVP_MAPS[game.GetMap()] and not file.Exists("welcome"..SBS_WELCOME.VERSION..".txt", "DATA") then
- DarkRP.openF4Menu()
- end
- file.Write("welcome"..SBS_WELCOME.VERSION..".txt", "")
- SBS_WELCOME.BG:Remove()
- surface.PlaySound("buttons/blip1.wav")
- end
- regenerateText()
- end
- net.Receive("WELCOME:Vgui", function()
- SBS_WELCOME.OpenVGUI(net.ReadBool() or (not file.Exists("welcome"..SBS_WELCOME.VERSION..".txt", "DATA")))
- end)
- if IsValid(SBS_WELCOME.BG) then SBS_WELCOME.BG:Remove() end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement