-- Let's get fancy. If they use ULX, let's add Umotd to the ULX help menu. -- This file isn't loaded unless ULX loads it... nice, eh? -- ULX has a tendency to load first. Let's hack a bit. include("Umotd/Umotd_config.lua") local ULX_kill_starttime = 0 local function kill_ulx_motd() if util.tobool( GetConVarString( "ulx_showMotd" ) ) then game.ConsoleCommand( "ulx_showMotd 0\n" ) hook.Remove( "Think", "UMotdKillMotd" ) end end local function doKillULXMotd() if ULX_kill_starttime > 0 and RealTime() - ULX_kill_starttime < 4 then return end -- ULX init loads at 5. Don't waste time 'thinking' if not util.tobool( GetConVarString( "ulx_showMotd" ) ) then return else kill_ulx_motd() end end local function Umotd_ULX_init() if util.tobool( GetConVarString( "ulx_showMotd" ) ) then -- If ULX is loaded, attempt to disable its motd. game.ConsoleCommand("ulx_showMotd 0\n" ) end ULX_kill_starttime = RealTime() hook.Add( "Think", "UMotdKillMotd", doKillULXMotd ) -- run a think statement anyway to try to kill ulx motd -- I hate to do this, but I know of no other way if user didn't move ulx/modules/cl/motdmenu.lua (which I'm not giving instructions for) -- This also allows Umotd to be part of ULX GUI menu without any hacks to the ULX code otherwise. function ulx.cc_motd( ply, command, argv, args ) if not ply:IsValid() then Msg( "[Umotd] - You can't see the motd from the console.\n" ) return end ply:ConCommand("Umotd "..Umotd_SpawnCommand .."\n") end for Ucmd, Umotd_info in pairs ( Umotd_content ) do ulx.setCategory( "Informational [Umotd]" ) ulx.concommand( Ucmd, Umotd_info.func, " - Displays the " .. Ucmd .." screen using Umotd", ULib.ACCESS_ALL, Uchat_prefix .. Ucmd, false, ulx.ID_PLAYER_HELP ) end end hook.Add( "Initialize", "Umotd_ULX_Initialize", Umotd_ULX_init ) hook.Add( "PlayerInitialSpawn", "KillULXUmotd", function() hook.Remove( "Think", "UMotdKillMotd" ) end )