Hello all, hoping I am posting in the right forums.
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.
[CODE] <html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=motdurl">
</head>
</html>
]]
local html = vgui.Create( "HTML", window )
local AcceptButton = vgui.Create( "DButton", window )
if AcceptButtonText == "" then
AcceptButton:SetText( "Close" )
else
AcceptButton:SetText( AcceptButtonText )
end
AcceptButton.DoClick = function()
if AcceptSay != "" then
RunConsoleCommand("say", I accept the server rules)
end
window:Close()
gui.EnableScreenClicker(false) -- Disable the mouse
end
AcceptButton:SetSize( 100, 40 )
if AcceptButtonTime > 0 then
AcceptButton:SetDisabled( true )
timer.Simple( AcceptButtonTime, function()
AcceptButton:SetDisabled( false )
end )
end
if !DeclineButton then
AcceptButton:SetPos( (window:GetWide() - AcceptButton:GetWide()) / 2, window:GetTall() - AcceptButton:GetTall() - 10 )
else
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" )
else
DeclineButton:SetText( DeclineButtonText )
end
DeclineButton:SetVisible( true )
DeclineButton.DoClick = function()
RunConsoleCommand("say", I am an idiot who can not comprehend rules. I wunder what disconnect does?)
RunConsoleCommand( "disconnect" )
end
end[/CODE]
As your question/request is related to LUA you should consider taking a look at the Facepunch [URL="http://facepunch.com/forums/65"]LUA Section[/URL]. LUA Developers ain't very active in the Help & Support section so you should try to post a thread in the Question or Request sub-forums of the Facepunch [URL="http://facepunch.com/forums/65"]LUA Section[/URL]!
[QUOTE=Ideal-Hosting;35288193]As your question/request is related to LUA you should consider taking a look at the Facepunch [URL="http://facepunch.com/forums/65"]LUA Section[/URL]. LUA Developers ain't very active in the Help & Support section so you should try to post a thread in the Question or Request sub-forums of the Facepunch [URL="http://facepunch.com/forums/65"]LUA Section[/URL]![/QUOTE]
Thank you, was wondering if it should be considered lua or html.
The MOTD functions are in LUA. Only the page displaying is HTML.
Reposted at [URL="http://facepunch.com/threads/1172792"]http://facepunch.com/threads/1172792[/URL]
Sorry, you need to Log In to post a reply to this thread.