• Repeating RCON Command
    14 replies, posted
I need help configuring a script that on server boot would submit the RCON command, "say @Confused? Review the Administrator Guidelines on the Steam Group!" every 120 seconds. Essentially like a ULX advert but to Admin chat. Any help appreciated! I apologize that I lack the knowledge to do this on my own and I am sure that "brandonj4" will give me another dumb ranking on my post. Thanks for your time though!
Look into timer.Create, it can be done clientside using chat.AddText [lua]timer.Create( "MyChatAdvertisement", 120, 0, function( ) chat.AddText( Color( 255, 255, 255, 255 ), "Are you experiencing something new every few minutes? Have you ever fallen and had trouble getting back up? Have you ever experienced something new every few minutes? Do you have trouble keeping your balance? Do you experience shocking news every few minutes? We can help..." ); end );[/lua]
That didn't seem to work, I created a file called "adminadvert.lua" in /lua/autorun/client and copied and pasted your code, along with the changes needed for my text. It does not function!
Can you post your exact code?
timer.Create( "AdminAdvert", 120, 0, function( ) chat.AddText( Color( 255, 255, 255, 255 ), "@Confused? Review the Administrator Guidelines on the Steam Group!" ); end );
Did you wait the 120 seconds?
The code is fine. Currently, it will display every two minutes or 120 seconds.
Yes, and I even tested by lowering the value to 10 seconds. It did not function. [editline]30th March 2014[/editline] Please don't dumb this post, but does it require a restart?
[QUOTE=Frubbs;44406462]Yes, and I even tested by lowering the value to 10 seconds. It did not function. [editline]30th March 2014[/editline] Please don't dumb this post, but does it require a restart?[/QUOTE] Yes.
If you're adding a new file, and autorefresh is enabled, and you're running Windows then you'll need to edit the file which includes in ( add a space, remove the space, ctrl + s ), then edit the new file once more. Adding new files with the auto-refresh system is kind of strange if you don't want to restart the map.
Okay so it does print the chat, but it doesn't send it to admins. The reason I wanted it to be sent as an RCON command is so that it would be registered as a command not as a ChatPrint. Help? [editline]30th March 2014[/editline] Does anyone have a solution? [editline]31st March 2014[/editline] I guess this thread died? I really do need a solution
Ok, instead of running it client-side, run it server side. Replace chat.AddText line with: [lua]RunConsoleCommand( "say", "Testing 1 2 3" );[/lua] Then it will output to chat as Console: "Testing 1 2 3" [editline]31st March 2014[/editline] [QUOTE=Frubbs;44406604]Okay so it does print the chat, but it doesn't send it to admins. The reason I wanted it to be sent as an RCON command is so that it would be registered as a command not as a ChatPrint. Help? [editline]30th March 2014[/editline] Does anyone have a solution? [editline]31st March 2014[/editline] I guess this thread died? I really do need a solution[/QUOTE] Calm down, we respond when we respond. Are you getting paid for this little tidbit, is it your homework or something; is that why this is so urgent.. I'm confused? There's wiki.garrysmod.com there's this thread: [url]http://facepunch.com/showthread.php?t=1337945[/url]
It outputs "Testing 1 2 3" but when I change the code to say: RunConsoleCommand( "say", "@blahblahblah" ); It does not work, I also tried removing the quotes
[CODE] timer.Create( "MyChatAdvertisement", 20, 0, function( ) for k,v in pairs(player.GetAll()) do if(v:IsUserGroup("admin")) then v:PrintMessage( HUD_PRINTTALK, "Admin shit" ) end end end ); [/CODE] put it server side, add whatever groups you have like super admin etc like this [CODE] if(v:IsUserGroup("admin") || v:IsUserGroup("superadmin") ) then [/CODE]
[code]RunConsoleCommand( "ulx", "asay", "Message" );[/code] if you're using ULX. The console ULX uses is opped. So it should send the message into asay. If you run "say '@message'" on RunConsoleCommand, the console interprets the @ as a bad character and cancels the command. edit: forgot a timer [code]timer.Create( "MyChatAdvertisement", 120, 0, function( ) RunConsoleCommand( "ulx, "asay", "Message" ); end );[/code]
Sorry, you need to Log In to post a reply to this thread.