Firstly, I apologise if this is in the wrong section. I kinda figured 'help and support' for gmod seemed appropriate, although this is my first post here so.. yeah.
I have been searching around on the answer to this for ages. On facepunch, the gmod wiki for lua etc etc but eventually I've just given in and now I'm gona ask directly. Basically I have an motd for my server working fine. But I want to add the ability to open it when you say !motd or motd or something in chat. At the moment, it only opens the once when you join the server. Here is what I have so far:
[QUOTE=Mr.Spartan]if ( SERVER ) then
AddCSLuaFile("autorun/motd.lua")
return
end
hook.Add("InitPostEntity", "MOTD", function()
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:SetTitle( "MOTD" )
window:SetVisible( true )
window:MakePopup()
local html = vgui.Create( "HTML", window )
local button = vgui.Create( "DButton", window )
button:SetText( "Accept" )
button.DoClick = function() window:Close() end
button:SetSize( 100, 40 )
button:SetPos( (window:GetWide() - button:GetWide()) / 2.3, window:GetTall() - button:GetTall() - 10 )
local button = vgui.Create( "DButton", window )
button:SetText( "Decline" )
button.DoClick = function() RunConsoleCommand( "disconnect" ) end
button:SetSize( 100, 40 )
button:SetPos( (window:GetWide() - button:GetWide()) / 1.7, window:GetTall() - button:GetTall() - 10 )
html:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
html:SetPos( 10, 30 )
html:OpenURL( "<url link>" )
end )
concommand.Add("SendMotdMenu", showMotdMenu)[/QUOTE]
Like I say, it works fine, but I want it to reopen without having to reconnect. Any assistance pointing me in the right direction is also appreciated.
Thank you to anyone who helps.
in the server key config file, put in "bind f1 showMotdMenu"
Sorry, you need to Log In to post a reply to this thread.