Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.65 KB | None | 0 0
  1. ulx.motdmenu_exists = true
  2.  
  3. local isUrl
  4. local url
  5.  
  6. function ulx.showMotdMenu( steamid )
  7.     local url1 = "http://theloungeserver.fluctis.com/rules.html"
  8.     local url2 = "http://theloungeserver.fluctis.com/donate.html"
  9.  
  10.     local window = vgui.Create( "DFrame" )
  11.     if ScrW() > 640 then -- Make it larger if we can.
  12.         window:SetSize( ScrW()*0.9, ScrH()*0.9 )
  13.     else
  14.         window:SetSize( 640, 480 )
  15.     end
  16.     window:Center()
  17.     window:SetTitle( "MOTD" )
  18.     window:SetVisible( true )
  19.     window:SetDraggable( false )
  20.     window:ShowCloseButton( false )
  21.     window:MakePopup()
  22.  
  23.     local tabmenu = vgui.Create( "DPropertySheet", window )
  24.    
  25.    
  26.     local html1 = vgui.Create( "HTML" )
  27.     local html2 = vgui.Create( "HTML" )
  28.    
  29.     button = vgui.Create( "DButton", window )
  30.     button:SetSize( 100, 40 )
  31.     button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
  32.     button:SetText( "Wait - " )
  33.     button:SetDisabled( true )
  34.  
  35.     timersec = 10                                           --this is how long your motd will stay open, I reccomend
  36.                                                             --adding about 5 to your desired value to compensate for lag
  37.     timer.Create( "countDown", 1, 10, function()            --change 14 to the same value as timersec
  38.         timersec = timersec - 1
  39.         button:SetText( "Wait - " .. timersec )
  40.         if timersec == 0 then
  41.             button:SetText( "Close" )
  42.             button:SetDisabled( false )
  43.             button.DoClick = function() window:Close() end
  44.         end
  45.     end)
  46.  
  47.     if timersec == 0 then                                   --all this crap may be useless, I left it in because everything was working
  48.         button:SetText( "Close" )
  49.         button:SetDisabled( false )
  50.         button.DoClick = function() window:Close() end
  51.     end
  52.  
  53. --[[
  54.     local button = vgui.Create( "DButton", window )         --original button close, above adds timer.
  55.     button:SetText( "Close" )
  56.     button.DoClick = function() window:Close() end
  57.     button:SetSize( 100, 40 )
  58.     button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
  59. --]]
  60.    
  61.     tabmenu:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
  62.     tabmenu:SetPos( 10, 30 )
  63.  
  64.     html1:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
  65.     html1:SetPos( 15, 50 )
  66.     html1:OpenURL( url1 )
  67.    
  68.     html2:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
  69.     html2:SetPos( 15, 50 )
  70.     html2:OpenURL( url2 )
  71.    
  72.     tabmenu:AddSheet( "Rules", html1, _, false, false, _)
  73.     tabmenu:AddSheet( "Donate", html2, _, false, false, _)
  74. end
  75.  
  76. function ulx.rcvMotd( isUrl_, text )
  77.     isUrl = isUrl_
  78.     if not isUrl then
  79.         ULib.fileWrite( "data/ulx_motd.txt", text )
  80.     else
  81.         if text:find( "://", 1, true ) then
  82.             url = text
  83.         else
  84.             url = "http://" .. text
  85.         end
  86.     end
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement