[CODE]ulx.motdmenu_exists = true
-- DON'T EDIT THAT
local isUrl
local url
-- MOTD BUTTON SETUP
local MainURL = "http://organic-gaming.com/index.php" --Main Motd URL Website, I REALLY recommend to run the motd by url.
local MotdURL = "Message of the Day, made by B0ul3Tm@rc" --Motd Main Windows Tittle.
local AcceptButtonText = "I agree" --Text for Accept rules button
local AcceptButtonTime = 10 --accept rules button will appear only after "X" seconds.
local AcceptSay = "I agree to follow the rules" --Say in chat "X" message when I clic on accept rules button.
local DeclineButton = true --Spawn Decline Button ?
local DeclineButtonText = "I'm noob, kick me" --Text for Decline rules button
local DeclineSay = "I disagree to follow the rules, the server disconnect me !" --Say in chat "X" message when I clic on decline rules button.
local DeclineKickTime = 5 --time to kick the player if he decline rules, don't put so low, the script need to run "DeclineSay" before.
local WebButtonText = "Open Web Menu" --Text to open the Web Menu
local CloseWebButtonText = "Close Web Menu" --Text to close the Web Menu
local ReturnButtonText = "Main page" --Text for Return on Main URL Page button. --Text for Close Motd Page button.
--Website Setup
local Website1ButtonText = "Google" --Text for 1st Website button.
local Website2ButtonText = "Youtube" --Text for 2nd Website button.
local Website3ButtonText = "Gmod.org" --Text for 3nd Website button.
local Website4ButtonText = "FacePunch" --Text for 4nd Website button.
local Website1URL = "http://www.google.com/" --1st Webstie URL
local Website2URL = "http://www.youtube.com/" --2nd Website URL
local Website3URL = "http://www.garrysmod.org/" --3nd Website URL
local Website4URL = "http://www.facepunch.com/" --4nd Website URL
--------------------------------------------------------------------------------------
-------DON'T EDIT ANYTHING BELLOW, if you know what you do, it's your choice !--------
--------------------------------------------------------------------------------------
function Welcome ()
--creating main windows
local window = vgui.Create( "DFrame" )
if ScrW() > 640 then -- Make it larger if we can.
window:SetSize( ScrW()*0.9, ScrH()*0.9 )
else
window:SetSize( 640, 480 )
end
window:Center()
window:SetVisible( true )
window:MakePopup()
local html = vgui.Create( "HTML", window )
--creating windows for html
--AcceptButton
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 have read the rules and agree not to struggle, Honey.")
end
window:Close()
surface.PlaySound("vo/Citadel/eli_dontstruggle.wav")
gui.EnableScreenClicker(false) -- Disable the mouse
end
AcceptButton:SetSize( 90, 40 )
if AcceptButtonTime > 0 then
timer.Simple( AcceptButtonTime, function()
end )
end
if !DeclineButton then
AcceptButton:SetPos( (window:GetWide() - AcceptButton:GetWide()) / 2.5, window:GetTall() - AcceptButton:GetTall() - 10 )
else
AcceptButton:SetPos( ( window:GetWide() / 4.0 ) - ( AcceptButton:GetWide() / 2 ), window:GetTall() - 57 )
--DeclineButton
local DeclineButton = vgui.Create( "DButton", window )
DeclineButton:SetSize( 110, 40 )
DeclineButton:SetPos( ( window:GetWide() / 3.0 ) - ( DeclineButton:GetWide() / 2 ), window:GetTall() - 57 )
if DeclineButtonText == "" then
DeclineButton:SetText( "Decline" )
else
DeclineButton:SetText( DeclineButtonText )
end
DeclineButton:SetVisible( true )
DeclineButton.DoClick = function()
if DeclineSay != "" then
RunConsoleCommand("say", DeclineSay)
window:Close()
end
if DeclineKickTime > 0 then
timer.Simple( DeclineKickTime, function()
RunConsoleCommand( "disconnect" )
end )
end
end
end
--Return on main page Button
local ReturnButton = vgui.Create( "DButton", window )
ReturnButton:SetSize( 100, 40 )
ReturnButton:SetPos( ( window:GetWide() / 1.6 ) - ( ReturnButton:GetWide() / 2 ), window:GetTall() - 57 )
if ReturnButtonText == "" then
ReturnButton:SetText( "Return" )
else
ReturnButton:SetText( ReturnButtonText )
end
ReturnButton:SetVisible( false )
ReturnButton.DoClick = function()
html:OpenURL( MainURL )
end
--Website1 Button
local Website1Button = vgui.Create( "DButton", window )
Website1Button:SetSize( 100, 40 )
Website1Button:SetPos( ( window:GetWide() / 1.4 ) - ( Website1Button:GetWide() / 2 ), window:GetTall() - 45 )
if Website1ButtonText == "" then
Website1Button:SetText( "Website1" )
else
Website1Button:SetText( Website1ButtonText )
end
Website1Button:SetVisible( false )
Website1Button.DoClick = function()
html:OpenURL( Website1URL )
end
--Website2 Button
local Website2Button = vgui.Create( "DButton", window )
Website2Button:SetSize( 100, 40 )
Website2Button:SetPos( ( window:GetWide() / 1.4 ) - ( Website2Button:GetWide() / 2 ), window:GetTall() - 90 )
if Website2ButtonText == "" then
Website2Button:SetText( "Website2" )
else
Website2Button:SetText( Website2ButtonText )
end
Website2Button:SetVisible( false )
Website2Button.DoClick = function()
html:OpenURL( Website2URL )
end
--Website3 Button
local Website3Button = vgui.Create( "DButton", window )
Website3Button:SetSize( 100, 40 )
Website3Button:SetPos( ( window:GetWide() / 1.25 ) - ( Website3Button:GetWide() / 2 ), window:GetTall() - 45 )
if Website3ButtonText == "" then
Website3Button:SetText( "Website3" )
else
Website3Button:SetText( Website3ButtonText )
end
Website3Button:SetVisible( false )
Website3Button.DoClick = function()
html:OpenURL( Website3URL )
end
--Website4 Button
local Website4Button = vgui.Create( "DButton", window )
Website4Button:SetSize( 100, 40 )
Website4Button:SetPos( ( window:GetWide() / 1.25 ) - ( Website4Button:GetWide() / 2 ), window:GetTall() - 90 )
if Website4ButtonText == "" then
Website4Button:SetText( "Website4" )
else
Website4Button:SetText( Website4ButtonText )
end
Website4Button:SetVisible( false )
Website4Button.DoClick = function()
html:OpenURL( Website4URL )
end
--Open WebButton
local CloseWebButton = vgui.Create( "DButton", window )
local WebButton = vgui.Create( "DButton", window )
WebButton:SetSize( 100, 40 )
WebButton:SetPos( ( window:GetWide() / 1.25 ) - ( WebButton:GetWide() / 2 ), window:GetTall() - 57 )
if WebButtonText == "" then
WebButton:SetText( "OpenWebMenu" )
else
WebButton:SetText( WebButtonText )
end
WebButton:SetVisible( true )
WebButton.DoClick = function()
--WebButton Clic
html:SetSize( window:GetWide() - 20, window:GetTall() - AcceptButton:GetTall() - 90 )
WebButton:SetPos( ( window:GetWide() / 1.9 ) - ( WebButton:GetWide() / 2 ), window:GetTall() - 90 )
CloseWebButton:SetVisible( true )
ReturnButton:SetVisible( true )
Website1Button:SetVisible( true )
Website2Button:SetVisible( true )
Website3Button:SetVisible( true )
Website4Button:SetVisible( true )
end
--CloseWebButton
CloseWebButton:SetSize( 100, 40 )
CloseWebButton:SetPos( ( window:GetWide() / 1.9 ) - ( WebButton:GetWide() / 2 ), window:GetTall() - 45 )
if CloseWebButtonText == "" then
CloseWebButton:SetText( "CloseWebMenu" )
else
CloseWebButton:SetText( CloseWebButtonText )
end
CloseWebButton:SetVisible( false )
CloseWebButton.DoClick = function()
--CloseWebButton Clic
html:SetSize( window:GetWide() - 20, window:GetTall() -
Oh, yay! A 'do it for me', haven't seen these in... minutes ?
Thanks for the insightful wisdom! I really appreciate the help. I now realize that asking for help is a totally unreasonable thing, and I apologize for inconveniencing you and/or upsetting you in the slightest.
[QUOTE=Netheous;42745010]Oh, yay! A 'do it for me', haven't seen these in... minutes ?[/QUOTE]
Instead of being a smart ass why don't you help, if you can not solve it then move along. For All I am concerned your post was useless. It is a Developer section he is asking for help not asking for your critical opinion. If you want to go State your Opinions Then please go post here : [url]http://facepunch.com/forumdisplay.php?f=403[/url]
Also if you want the MOTD to open up onto the URL you want then go into !menu into game and go to settings and there should be a tab in there some were to put a URL for your website to open that up instead. You only need to add in other buttons if you want it to open up to other webpages.
[QUOTE=swinginman;42745479]Thanks for the insightful wisdom! I really appreciate the help. I now realize that asking for help is a totally unreasonable thing, and I apologize for inconveniencing you and/or upsetting you in the slightest.[/QUOTE]
Nobody here is paid to help anybody, you can't expect to post a piece of code and say "it doesn't work" and then assume we're just going to fix it for you. We aren't.
Help us help you or gtfo.
My advice would be to install ULX. Setting up MOTD with ULX is as easy as copy and pasting a URL.
~Justinian
[QUOTE=EvacX;42746372]Nobody here is paid to help anybody, you can't expect to post a piece of code and say "it doesn't work" and then assume we're just going to fix it for you. We aren't.
Help us help you or gtfo.[/QUOTE]
I agree with you, but if you don't want to help than don't post, and you know Netheous was always a dick.
I'm asking for help ._. Thanks to all who actually helped.
I don't believe I'm using it as an ULX MOTD, I suppose that would help, lol.
[CODE]ulx.motdmenu_exists = true[/CODE]
I do believe that is something you might want to consider before asking us to "fix" something you don't even know how to use. Plus, I don't see you posting any errors or explaining in depth what exactly the problem is.
This is just my 2 cents.
damn no wonder nobody is helping ulx code is shiieeeeeettt
[QUOTE=BoowmanTech;42746464]I agree with you, but if you don't want to help than don't post, and you know Netheous was always a dick.[/QUOTE]
Listen to this wise man, he is a mind reader, fortune teller and a mr. know-it-all, he can even predict weather.
But seriously, who are you to call me names and just FYI: Just because I am a dick towards you, doesn't mean I am dick towards everyone else
^dick
^ server owner with no motd
[QUOTE=swinginman;42769923]^dick[/QUOTE]
I might be a dick to some people but atleast I can read.
[url]http://facepunch.com/showthread.php?t=1250283&p=39737459&viewfull=1#post39737459[/url]
Read the part where it says: "Do not post huge scripts and expect people to fix them."
Probably shouldn't have posted the whole thing. lol. But why do you care so much?
Anyways I should probably clarify
[CODE]function Welcome ()
--creating main windows
local window = vgui.Create( "DFrame" )
if ScrW() > 640 then -- Make it larger if we can.
window:SetSize( ScrW()*0.9, ScrH()*0.9 )
else
window:SetSize( 640, 480 )
end
window:Center()
window:SetVisible( true )
window:MakePopup()
local html = vgui.Create( "HTML", window )[/CODE]
I am focused on this part of the script, it creates the motd window, which is also the "home" menu
I have been trying to take bits and pieces from this code...
[CODE] local ReturnButton = vgui.Create( "DButton", window )
ReturnButton:SetSize( 100, 40 )
ReturnButton:SetPos( ( window:GetWide() / 1.6 ) - ( ReturnButton:GetWide() / 2 ), window:GetTall() - 57 )
if ReturnButtonText == "" then
ReturnButton:SetText( "Return" )
else
ReturnButton:SetText( ReturnButtonText )
end
ReturnButton:SetVisible( false )
ReturnButton.DoClick = function()
html:OpenURL( MainURL )
end[/CODE]
Now this actually opens a URL. But, the opening of the URL is caused by some kind of hook or some shit which I am trying to find a way
around.ReturnButton.DoClick = function()
html:OpenURL( MainURL )
This opens a URL when you click the button. What I want to do is add something like that to the first line of code taht will open a URL when the motd is just opened.
I apologize for the messy-ness of this thread. I hope this makes some sense.
P.S I am aware that the "local html = vgui.Create( "HTML", window )" line needs to be above wherever I want a URL to be opened, I just reverted it to its original format.
[QUOTE=swinginman;42772247]Probably shouldn't have posted the whole thing. lol. But why do you care so much?
Anyways I should probably clarify
[CODE]function Welcome ()
--creating main windows
local window = vgui.Create( "DFrame" )
if ScrW() > 640 then -- Make it larger if we can.
window:SetSize( ScrW()*0.9, ScrH()*0.9 )
else
window:SetSize( 640, 480 )
end
window:Center()
window:SetVisible( true )
window:MakePopup()
local html = vgui.Create( "HTML", window )[/CODE]
I am focused on this part of the script, it creates the motd window, which is also the "home" menu
I have been trying to take bits and pieces from this code...
[CODE] local ReturnButton = vgui.Create( "DButton", window )
ReturnButton:SetSize( 100, 40 )
ReturnButton:SetPos( ( window:GetWide() / 1.6 ) - ( ReturnButton:GetWide() / 2 ), window:GetTall() - 57 )
if ReturnButtonText == "" then
ReturnButton:SetText( "Return" )
else
ReturnButton:SetText( ReturnButtonText )
end
ReturnButton:SetVisible( false )
ReturnButton.DoClick = function()
html:OpenURL( MainURL )
end[/CODE]
Now this actually opens a URL. But, the opening of the URL is caused by some kind of hook or some shit which I am trying to find a way
around.ReturnButton.DoClick = function()
html:OpenURL( MainURL )
This opens a URL when you click the button. What I want to do is add something like that to the first line of code taht will open a URL when the motd is just opened.
I apologize for the messy-ness of this thread. I hope this makes some sense.
P.S I am aware that the "local html = vgui.Create( "HTML", window )" line needs to be above wherever I want a URL to be opened, I just reverted it to its original format.[/QUOTE]
Just move:
[lua]
html:OpenURL( MainURL )
[/lua]
Outside
[lua]
ReturnButton.DoClick = function()
html:OpenURL( MainURL )
end
[/lua]
So it's like
[lua]
html:OpenURL( MainURL )
ReturnButton.DoClick = function()
end
[/lua]
And you can just get rid of that button afterwards if it has no use now.
Also I care because appearently Boowman and the other guy think that I am being mean for no reason.
[QUOTE=Netheous;42745010]Oh, yay! A 'do it for me', haven't seen these in... minutes ?[/QUOTE]
Don't be too harsh, thats generally what this section is interpreted as.
[QUOTE=Archemyde;42773419]Don't be too harsh, thats generally what this section is interpreted as.[/QUOTE]
lol your a little late to the party... and thanks netheous, it didn't work though. The local ReturnButton = vgui.Create( "DButton", window ) part is put in there like 4 times cause there are several buttons to open URLs, but nothing opens on start up. That's where i'm lost.
HA, just figured it out lol.
[CODE] if not isUrl then
html:OpenURL( MainURL )
end
end[/CODE]
the main URL said Motd URL... derp
thanks anyways
Sorry, you need to Log In to post a reply to this thread.