• Print

Author Topic: Help with MOTD  (Read 4335 times)

0 Members and 1 Guest are viewing this topic.

Offline VonTreece

  • Newbie
  • *
  • Posts: 25
  • Karma: 1
Help with MOTD
« on: January 31, 2015, 02:38:34 am »
So my goal is super simple..
I have a webpage URL I want to use as my MOTD.. But I want it to take up the entire screen.
I don't want there to be any border or UI around it.
Just the webpage and a countdown at the bottom to exit. Is this possible?

Thanks! (:

Or at the very least, making it so that the image fits with the UI.

motdmenu.lua pastebin: http://pastebin.com/iZ45qwwh
« Last Edit: January 31, 2015, 03:12:07 am by VonTreece »

Offline Unknown Gamer

  • Jr. Member
  • **
  • Posts: 79
  • Karma: -2
    • TrueKnife TTT
Re: Help with MOTD
« Reply #1 on: January 31, 2015, 11:19:36 pm »
Ill see what I can do. Also I added some icon16 to the tabs. Makes it look better
Newb Coder. Soon to get better

Offline Unknown Gamer

  • Jr. Member
  • **
  • Posts: 79
  • Karma: -2
    • TrueKnife TTT
Re: Help with MOTD
« Reply #2 on: January 31, 2015, 11:23:43 pm »
This is the best I got. Ill try to see if I can remove the border
Code: Lua
  1. ulx.motdmenu_exists = true
  2.  
  3. local isUrl
  4. local url
  5.  
  6. function ulx.showMotdMenu( steamid )
  7.         local url1 = "http://trueknife.site.nfoservers.com/"
  8.         local url2 = "http://trueknife.site.nfoservers.com/donate"
  9.  
  10.         local window = vgui.Create( "DFrame" )
  11. [img]http://i.imgur.com/kTSyZE0.jpg[/img]
  12.         if ScrW() > 640 then -- Make it larger if we can.
  13.                 window:SetSize( ScrW()*1, ScrH()*1)
  14.         else
  15.                 window:SetSize( 640, 480 )
  16.         end
  17.         window:Center()
  18.         window:SetTitle( "Server MOTD Info" )
  19.         window:SetVisible( true )
  20.         window:SetDraggable( false )
  21.         window:ShowCloseButton( false )
  22.         window:MakePopup()
  23.  
  24.         local tabmenu = vgui.Create( "DPropertySheet", window )
  25.        
  26.        
  27.         local html1 = vgui.Create( "HTML" )
  28.         local html2 = vgui.Create( "HTML" )
  29.        
  30.         button = vgui.Create( "DButton", window )
  31.         button:SetSize( 100, 40 )
  32.         button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
  33.         button:SetText( "Wait - " )
  34.         button:SetDisabled( true )
  35.  
  36.         timersec = 5                                                                                   --this is how long your motd will stay open, I reccomend
  37.                                                                                                                         --adding about 5 to your desired value to compensate for lag
  38.         timer.Create( "countDown", 1, 5, function()                    --change 14 to the same value as timersec
  39.                 timersec = timersec - 1
  40.                 button:SetText( "Wait - " .. timersec )
  41.                 if timersec == 0 then
  42.                         button:SetText( "Close" )
  43.                         button:SetDisabled( false )
  44.                         button.DoClick = function() window:Close() end
  45.                 end
  46.         end)
  47.  
  48.         if timersec == 0 then                                                                   --all this crap may be useless, I left it in because everything was working
  49.                 button:SetText( "Close" )
  50.                 button:SetDisabled( false )
  51.                 button.DoClick = function() window:Close() end
  52.         end
  53.  
  54. --[[
  55.         local button = vgui.Create( "DButton", window )                 --original button close, above adds timer.
  56.         button:SetText( "Close" )
  57.         button.DoClick = function() window:Close() end
  58.         button:SetSize( 100, 40 )
  59.         button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
  60. --]]
  61.        
  62.         tabmenu:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
  63.         tabmenu:SetPos( 10, 30 )
  64.  
  65.         html1:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
  66.         html1:SetPos( 15, 50 )
  67.         html1:OpenURL( url1 )
  68.        
  69.         html2:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
  70.         html2:SetPos( 15, 50 )
  71.         html2:OpenURL( url2 )
  72.        
  73.         tabmenu:AddSheet( "Rules", html1, "icon16/application_view_detail.png",  false, false, "Rules of the server")
  74.         tabmenu:AddSheet( "Donate", html2, "icon16/money.png", false, false, "Donate and support the server")
  75. end
  76.  
  77. function ulx.rcvMotd( isUrl_, text )
  78.         isUrl = isUrl_
  79.         if not isUrl then
  80.                 ULib.fileWrite( "data/ulx_motd.txt", text )
  81.         else
  82.                 if text:find( "://", 1, true ) then
  83.                         url = text
  84.                 else
  85.                         url = "http://" .. text
  86.                 end
  87.         end
  88. end
Newb Coder. Soon to get better

  • Print