• Print

Author Topic: Auto show ulx motd to everyone every x seconds  (Read 6554 times)

0 Members and 1 Guest are viewing this topic.

Offline mindzombies

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Auto show ulx motd to everyone every x seconds
« on: November 03, 2014, 10:11:27 am »
Hey peeps, i was hoping one of you smart alecks could help me out with my teeny problem.

Im not that great in lua :$ okay not good at all, but here is a crude setup i tried to make, which is supposed to show the ulx motd every 10 minutes. As in, its supposed to run this command on console: ulx cexec * ulx motd

Here is my code:
Code: [Select]
timer.Create("motd", 600,0, function() RunConsoleCommand("ulx", "cexec", "*", "ulx", "motd") end)
I also tried this:
Code: [Select]
timer.Create("motd", 600,0, function() RunConsoleCommand("ulx cexec * ulx motd", "") end)
However it does not seem to work :$


Quote
Even the smartest of the smartest arent the smartest xD

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Auto show ulx motd to everyone every x seconds
« Reply #1 on: November 03, 2014, 01:29:57 pm »
Where did you place it in your server files?
Once you get to know me, you'll find you'll have never met me at all.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Auto show ulx motd to everyone every x seconds
« Reply #2 on: November 03, 2014, 03:26:07 pm »
Hey peeps, i was hoping one of you smart alecks could help me out with my teeny problem.

Im not that great in lua :$ okay not good at all, but here is a crude setup i tried to make, which is supposed to show the ulx motd every 10 minutes. As in, its supposed to run this command on console: ulx cexec * ulx motd

Here is my code:
Code: [Select]
timer.Create("motd", 600,0, function() RunConsoleCommand("ulx", "cexec", "*", "ulx", "motd") end)
I also tried this:
Code: [Select]
timer.Create("motd", 600,0, function() RunConsoleCommand("ulx cexec * ulx motd", "") end)
However it does not seem to work :$




If I'm correct, the first one is actually "right", rather than the second one you made. Though, as the man above said, where was this file placed?
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline mindzombies

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: Auto show ulx motd to everyone every x seconds
« Reply #3 on: November 04, 2014, 03:10:45 am »
I placed this in lua/autorun/server if I am correct. I'm pretty sure I've placed it in correct location, and I've added both code. None works. I will get back after checking the location

Offline mindzombies

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: Auto show ulx motd to everyone every x seconds
« Reply #4 on: November 04, 2014, 03:39:27 am »
Yep that's the directory,  lua/autorun/server/motd.lua

In fact, I also have a 'say' command, which basically makes console say something:
Code: [Select]
timer.Create("motd", 300,0, function() RunConsoleCommand("say", "If you love this server, please add bloodrp.us.to:27018 to favorites") end)

I'm not sure, but I remember reading somewhere that the RunConsolecommand  is in the following way: ("command" "parameter") something like that

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Auto show ulx motd to everyone every x seconds
« Reply #5 on: November 04, 2014, 07:11:13 pm »
Are you getting any errors, or is your IG console giving you errors?
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline mindzombies

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: Auto show ulx motd to everyone every x seconds
« Reply #6 on: November 05, 2014, 03:51:07 am »
No, I don't think my console outputs any errors, at least not related to this... But if it does, then they must have escaped my notice :/

Offline Zmaster

  • Full Member
  • ***
  • Posts: 235
  • Karma: 25
Re: Auto show ulx motd to everyone every x seconds
« Reply #7 on: November 05, 2014, 05:27:34 am »
I'm typing this on an iPhone, so there'll probably be a typo somewhere

Code: Lua
  1. function OpenTheMotd()
  2. for k, v in pairs( player.GetAll() )
  3. v:ConCommand( "ulx", "motd" )
  4. end
  5. timer.Create( "OpenTheMotdTimer", 120, 0,  OpenTheMotd )
  6.  

If that works like I think it will, every two minutes the motd will open for everyone

Offline mindzombies

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: Auto show ulx motd to everyone every x seconds
« Reply #8 on: November 05, 2014, 08:28:50 am »
Oh im so so sorry, i didnt test yours, but turns out the code i had written
Code: [Select]
timer.Create("motd", 600,0, function() RunConsoleCommand("ulx", "cexec", "*", "ulx", "motd") end)
worked
thing is that since i edited via phone and stuhf, it wasnt saved properly on the server.
 
Thanks anyways for your help

P.S: I have something similar also, i want the same command, but implemented for gmod_admin_cleanup. i tried the above. doesnt work
« Last Edit: November 05, 2014, 09:37:26 am by mindzombies »

  • Print