ULX

Author Topic: Server shutdown via client console  (Read 2941 times)

0 Members and 1 Guest are viewing this topic.

Offline Skrillex

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Server shutdown via client console
« on: May 17, 2011, 05:38:15 PM »
I am running a dedicated server on my desktop and I want my admins to be able to shut the server down. I have the server running on a auto-restart program so when it closes then it auto restarts. How can I allow my admins to shut the server down? This closest I have come to solving this problem is "ulx rcon quit" but the console blocks the command. Help would be nice, thanks.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Server shutdown via client console
« Reply #1 on: May 17, 2011, 06:12:22 PM »
I coded this awhile ago.  This crashes your server and it should start back up.
Code: [Select]
function ulx.crasher( ply )
timer.Create("Crasher", 1, 1, function()
for _,plys in pairs( player.GetAll() ) do
plys:SendLua()
end
end )
ulx.fancyLogAdmin( ply, "#A restarted the server" )
end
local crasher = ulx.command( "Utility", "ulx restartserver", ulx.crasher, "!restartserver" )
crasher:defaultAccess( ULib.ACCESS_SUPERADMIN )
crasher:help( "Crashes the server." )

There may be another way, but this is all I got.

Offline Skrillex

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Server shutdown via client console
« Reply #2 on: May 17, 2011, 06:59:37 PM »
need help with that code

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Server shutdown via client console
« Reply #3 on: May 17, 2011, 07:15:59 PM »
It can go in your ulx/lua/ulx/modules/sh/ folder.  Name it whatever you'd like.  If you want I could whip it up in a zip file for you.

If you need help with something else, let me know what.

Offline Skrillex

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Server shutdown via client console
« Reply #4 on: May 18, 2011, 03:53:26 PM »
I can't get that working x.x Maybe more descriptive? Sorry

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: Server shutdown via client console
« Reply #5 on: May 18, 2011, 06:05:29 PM »
Do you not understand where to put it, or how to use it?
By the looks of the code your admins would type !restartserver in chat, and it will restart, if that's where your issue is.
My TTT server. Join the fun!

Offline DiscoBiscuit

  • Full Member
  • ***
  • Posts: 112
  • Karma: 1
    • DiscoBuild
Re: Server shutdown via client console
« Reply #6 on: May 19, 2011, 03:51:02 PM »
I always tell my admins to use _restart or killserver with rcon.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: Server shutdown via client console
« Reply #7 on: May 20, 2011, 12:19:40 AM »
This is sorta off topic, but what's the point of restarting the server when you can just change the map?
Is this to free memory or something? I always do a full system restart when it starts to get bogged down (typically each morning or afternoon when no ones on, making sure it's ready for the peak hours.)
My TTT server. Join the fun!