Here's how I do it. I don't use the built in ULX MOTD though. This would take some modification to the base ULX code to make this work with their MOTD.
/*--------------------------------
---------------TOS----------------
--------------------------------*/
local PANEL = {}
function PANEL:Init()
self:SetPos((ScrW() / 2) - 400, 30)
self:SetSize(800, 650)
self:SetVisible(false)
self.time = SGS.tostime
self.nextthink = CurTime() + 1
self.bdisabled = true
self:DrawFrame()
end
function PANEL:Paint( w, h )
draw.RoundedBoxEx( 16, 0, 0, self:GetWide(), self:GetTall(), Color(80, 80, 80, 150), true, true, true, true )
end
function PANEL:DrawFrame()
HTMLPanel = vgui.Create("DPanel", self)
HTMLPanel:SetPos(8,64)
HTMLPanel:SetSize(782, 500)
HTMLTest = vgui.Create("HTML", HTMLPanel)
HTMLTest:SetPos(0,0)
HTMLTest:Dock( FILL )
HTMLTest:OpenURL("http://www.g4p.org/Stranded/TOS/")
TOSbutton = vgui.Create( "DButton", self )
TOSbutton:SetSize( 120, 40 )
TOSbutton:SetPos( 8, 572 )
TOSbutton:SetText( "Wait: " .. self.time )
TOSbutton:SetDisabled( true )
TOSbutton.DoClick = function( TOSbutton )
if TOSbutton:GetDisabled() then return end
SGS.accepttos = true
RunConsoleCommand("sgs_refreshmodelpanel")
RunConsoleCommand("sgs_tosaccept")
self:Remove()
end
TOSbutton2 = vgui.Create( "DButton", self )
TOSbutton2:SetSize( 120, 40 )
TOSbutton2:SetPos( 136, 572 )
TOSbutton2:SetText( "I DON'T ACCEPT" )
TOSbutton2.DoClick = function( TOSbutton2 )
RunConsoleCommand("disconnect")
end
end
function PANEL:Think()
if CurTime() < self.nextthink then return end
if self.bdisabled then
if self.time > 0 then
self.time = self.time - 1
TOSbutton:SetText( "Wait: " .. self.time )
TOSbutton:SetDisabled( true )
else
TOSbutton:SetText( "I ACCEPT" )
TOSbutton:SetDisabled( false )
self.bdisabled = false
end
end
self.nextthink = CurTime() + 1
end
vgui.Register("sgs_tospanel", PANEL, "Panel")