Author Topic: Stop MOTD from Opening for x Seconds?  (Read 2491 times)

0 Members and 1 Guest are viewing this topic.

Offline Zarken

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Stop MOTD from Opening for x Seconds?
« on: August 18, 2018, 10:02:21 AM »
Is there a way to stop the MOTD from opening on "PlayerInitialSpawn" for x amount of seconds?

I'm looking to code my own spawn menu, and dont want the motd to open till after my menu has closed.

Thanks!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Stop MOTD from Opening for x Seconds?
« Reply #1 on: August 18, 2018, 12:50:12 PM »
You could use timer.simple, but that probably isn't best method for waiting. It would be better if you use a method to detect when the close button is pressed. Sorry I can't do the research to link how right now, I'm not at my normal computer setup this week.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Zarken

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Stop MOTD from Opening for x Seconds?
« Reply #2 on: August 18, 2018, 02:13:38 PM »
Hey, I only have a timer on the custom spawn menu anyhow, so a timer would be perfect. I just cannot find where to put it :S

Offline Zarken

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Stop MOTD from Opening for x Seconds?
« Reply #3 on: August 21, 2018, 01:04:52 PM »
Has anyone got any idea?

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Stop MOTD from Opening for x Seconds?
« Reply #4 on: August 22, 2018, 02:08:25 AM »
  • Wait until ULX loads completely. Add a hook to the "ULXLoaded" event.
  • Store the original PlayerInitialSpawn.showMotd hook function. Use hook.GetTable.
  • Remove the PlayerInitialSpawn.showMotd hook.
  • Call the original function when you want the user to see the MOTD. JamminR mentioned how you could approach this.

I just cannot find where to put it :S
You want to modify a server-side hook so this would go in a Lua file that runs on the server.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Stop MOTD from Opening for x Seconds?
« Reply #5 on: August 22, 2018, 11:08:13 PM »
What Timmy says.  ;)
Sorry, Lane is causing delay to returning to my computer for easy research for you. You're going to have to check his post, gmod wiki, and ulib docs and github code for functions.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming