ULX MOTD Button Help

Reposted from http://facepunch.com/threads/1172645?p=35283096

Anyways I am trying to make a ULX MOTD that has a button, for instance when a player joins the player will not be able to exit out of the MOTD until 10 seconds have passed.(to give him enough time to atleast see there are rules) How would I add buttons? How would I add timers to them? Heres what I have so far.

<meta HTTP-EQUIV="REFRESH" content="0; url=motdurl">
		local html = vgui.Create( "HTML", window )

		local AcceptButton = vgui.Create( "DButton", window )
		if AcceptButtonText == "" then
			AcceptButton:SetText( "Close" )
			AcceptButton:SetText( AcceptButtonText )
		AcceptButton.DoClick = function()
			if AcceptSay != "" then
				RunConsoleCommand("say", I accept the server rules)
			gui.EnableScreenClicker(false) -- Disable the mouse
		AcceptButton:SetSize( 100, 40 )
		if AcceptButtonTime > 0 then
		AcceptButton:SetDisabled( true )
			timer.Simple( AcceptButtonTime, function()
					AcceptButton:SetDisabled( false )
			end )
		if !DeclineButton then
			AcceptButton:SetPos( (window:GetWide() - AcceptButton:GetWide()) / 2, window:GetTall() - AcceptButton:GetTall() - 10 )
			AcceptButton:SetPos( ( window:GetWide() / 2.3 ) - ( AcceptButton:GetWide() / 2 ), window:GetTall() - 57 )
			local DeclineButton = vgui.Create( "DButton", window )
			DeclineButton:SetSize( 100, 40 )
			DeclineButton:SetPos( ( window:GetWide() / 1.7 ) - ( DeclineButton:GetWide() / 2 ), window:GetTall() - 57 )
			if DeclineButtonText == "" then
				DeclineButton:SetText( "Decline" )
				DeclineButton:SetText( DeclineButtonText )
			DeclineButton:SetVisible( true )
			DeclineButton.DoClick = function()
				RunConsoleCommand("say", I am an idiot who can not comprehend rules. I wunder what disconnect does?)
				RunConsoleCommand( "disconnect" )

  1. The second arguments for RCC is a string, so surround them with "
  2. You could just move the DoClick function into a timer.Simple function
    [lua]timer.Simple(10, function()
    AcceptButton.DoClick() = function()
    Main:Close() --Replace Main with your DFrame var
    RunConsoleCommand(“say”, “I accept the server rules.”)

Unrelated to your question, but a 10 second wait would piss me off more than it would make me read the motd. If I were you, I’d just use one of those things that displays while you’re connecting to the server as an motd. Players are going to spend at least 10 seconds connecting and loading everything, so it would be perfect.

But yeah I don’t give a shit if it’s the best server out there, if there was some dumb 10 second wait to close the motd I probably would not go there.

Thanks, when I get home I’ll try it…