Reputation: 47
I am having problems with my Lua
. I an making a MOTD
for my server using HTML
that I am going to host with my website.
I have my frames set up and the according tabs, as seen
But this is my problem
As you exit the MOTD
by pressing 'accept', the page set in the code stays up as seen and invades your screen like hell. My code is as follows:
function Welcome ()
MainMenu = vgui.Create( "DFrame" )
MainMenu:SetPos( 350, 100 )
MainMenu:SetSize( 1200, 900 )
MainMenu:SetTitle( "Welcome Menu" )
MainMenu:SetBackgroundBlur( true )
MainMenu:SetVisible( true )
MainMenu:SetDraggable( true )
MainMenu:ShowCloseButton( false )
MainMenu:MakePopup()
PropertySheet = vgui.Create( "DPropertySheet")
PropertySheet:SetParent( MainMenu )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( 1190, 820 )
local DermaButton = vgui.Create( "DButton", DermaPanel )
DermaButton:SetText( "Agree" )
DermaButton:SetSize( 165, 30 )
DermaButton:SetPos( 590, 860 )
DermaButton:SetParent( MainMenu )
DermaButton.DoClick = function()
MainMenu:Close()
RunConsoleCommand( "say", "I have read and agree with the rules")
end
local DermaButton = vgui.Create( "DButton", DermaPanel )
DermaButton:SetText( "Disagree" )
DermaButton:SetSize( 165, 30 )
DermaButton:SetPos( 420, 860 )
DermaButton:SetParent( MainMenu )
DermaButton.DoClick = function()
MainMenu:Close()
surface.PlaySound( "buttons/button8.wav" )
RunConsoleCommand( "say", "I disagree with the rules, I will now be disconnected.")
RunConsoleCommand( "disconnect" )
end
local TabOne = vgui.Create( "DPanel" )
TabOne:SetVisible( true )
local HTML = vgui.Create("HTML")
HTML:SetPos(50,50)
HTML:SetSize(ScrW() - 100, ScrH() - 100)
HTML:OpenURL("http://www.garrysmod.com")
local TabThree = vgui.Create( "DPanel" )
TabThree:SetVisible( true )
local HTML = vgui.Create("HTML")
HTML:SetPos(50,50)
HTML:SetSize(ScrW() - 100, ScrH() - 100)
HTML:OpenURL("http://www.garrysmod.com")
local TabTwo = vgui.Create( "DPanel" )
TabTwo:SetVisible( true )
local HTML = vgui.Create("HTML")
HTML:SetPos(50,50)
HTML:SetSize(ScrW() - 100, ScrH() - 100)
HTML:OpenURL("http://www.garrysmod.com")
local TabFour = vgui.Create( "DPanel" )
TabThree:SetVisible( true )
local HTML = vgui.Create("HTML")
HTML:SetPos(50,50)
HTML:SetSize(ScrW() - 100, ScrH() - 100)
HTML:OpenURL("http://www.garrysmod.com")
local TabFive = vgui.Create( "DPanel" )
TabThree:SetVisible( true )
local HTML = vgui.Create("HTML")
HTML:SetPos(50,50)
HTML:SetSize(ScrW() - 100, ScrH() - 100)
HTML:OpenURL("http://www.garrysmod.com")
PropertySheet:AddSheet( "Home", TabOne, "gui/silkicons/heart",
false, false, "Welcome to the server!" )
PropertySheet:AddSheet( "Rules", TabTwo, "gui/silkicons/script",
false, false, "Server rules!" )
PropertySheet:AddSheet( "Group", TabThree, "gui/silkicons/group",
false, false, "Group page!" )
PropertySheet:AddSheet( "Ranks", TabFour, "gui/silkicons/flag_blue",
false, false, "Ranks and donations!" )
PropertySheet:AddSheet( "Admins", TabFive, "gui/silkicons/shield",
false, false, "Your admin squad!" )
end
concommand.Add("OpenMotd", Welcome )
If you need to contact me fast, I can be found on Steam, under steamcommunity.com/id/PonyTerrance
Upvotes: 1
Views: 2041
Reputation: 951
This is happening, because you are not closing the HTML object anywhere in the code.
Also remember, that you are creating multiple HTML objects with the same variable name - Either choose an unique variable name for each one or simply create one HTML object and remove the other code passages which are creating HTML objects.
Upvotes: 1