how do a tab to my motd?

Post Reply
Jairmyster
New to forums
New to forums
Posts: 1
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Fri Apr 03, 2015 9:13 pm

how do a tab to my motd?

Post by Jairmyster »

Hello, I want to add a new tab to my motd so i can add a donation link, but i cant figure out how. Im using ulx.
Thanks!
lmorgan710
New to forums
New to forums
Posts: 4
Joined: Thu Mar 19, 2015 6:42 pm

Re: how do a tab to my motd?

Post by lmorgan710 »

Hi!

Are you using a regular ULX MOTD?
GlenAnderson
A semi-regular
A semi-regular
Posts: 17
Joined: Thu Nov 13, 2014 5:13 pm

Re: how do a tab to my motd?

Post by GlenAnderson »

Try the code here in garrysmod\addons\ulx\lua\ulx\modules\cl\motdmenu.lua. https://pastebin.com/NvZVA2mt

Code: Select all


ulx.motdmenu_exists = true
 
local isUrl
local url
 
function ulx.showMotdMenu()
        local url1 = "http://thepubliccommunity.com/rules"
        local url2 = "http://thepubliccommunity.com/forum"
        local url3 = "http://www.glenwebgames.com/extra/donate"
       
        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( "The Public DarkRP" )
        window:SetVisible( true )
        window:MakePopup()
       
        local tabmenu = vgui.Create( "DPropertySheet", window )
 
 
        local html1 = vgui.Create( "HTML" )
        local html2 = vgui.Create( "HTML" )
        local html3 = vgui.Create( "HTML" )
 
        local button = vgui.Create( "DButton", window )
        button:SetText( "OK" )
        button.DoClick = function() window:Close() end
        button:SetSize( 100, 40 )
        button:SetPos( (window:GetWide() - button:GetWide()) / 2, window:GetTall() - button:GetTall() - 10 )
       
        tabmenu:SetSize( window:GetWide() - 20, window:GetTall() - button:GetTall() - 50 )
        tabmenu:SetPos( 10, 30 )
 
        html1:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
        html1:SetPos( 15, 50 )
        html1:OpenURL( url1 )
       
        html2:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
        html2:SetPos( 15, 50 )
        html2:OpenURL( url2 )
       
        html3:SetSize( window:GetWide() - 30, window:GetTall() - button:GetTall() - 70 )
        html3:SetPos( 15, 50 )
        html3:OpenURL( url3 )
       
        tabmenu:AddSheet( "Rules", html1, _, false, false, _)
        tabmenu:AddSheet( "Forum", html2, _, false, false, _)
        tabmenu:AddSheet( "Donate", html3, _, false, false, _)
end
 
function ulx.rcvMotd( isUrl_, text )
        isUrl = isUrl_
        if not isUrl then
                ULib.fileWrite( "data/ulx_motd.txt", text )
        else
                if text:find( "://", 1, true ) then
                        url = text
                else
                        url = "http://" .. text
                end
        end
end
Post Reply