So I did some research and the 'quit' command is blacklisted. I seen that someone recommended using Cvar3, is this okay to use on the server? Someone said to also crash the server but that seems unreliable.
p.s im trying to shut down srcds from the server.
[lua]game.ConsoleCommand("_restart\n")[/lua]
This works for me - I know it says restart but in my experience it just closes.
[QUOTE=0V3RR1D3;50325719]So I did some research and the 'quit' command is blacklisted. I seen that someone recommended using Cvar3, is this okay to use on the server? Someone said to also crash the server but that seems unreliable.
p.s im trying to shut down srcds from the server.[/QUOTE]
Check out [URL="http://wiki.garrysmod.com/page/game/ConsoleCommand"]this[/URL] function, I think that quit isn't blacklisted on that one. If it is try aliasing it to other command (add an alias in your config) and try running that command, it should work.
[QUOTE=MattJeanes;50325769][lua]game.ConsoleCommand("_restart\n")[/lua]
This works for me - I know it says restart but in my experience it just closes.[/QUOTE]
Thanks to both of you, Never use this existed.
-EDIT-
Does not work, Quit is still blocked and restart does nothing.
[QUOTE=0V3RR1D3;50325775]Thanks to both of you, Never use this existed.
-EDIT-
Does not work, Quit is still blocked and restart does nothing.[/QUOTE]
It's strange that garry blocks that on servers. Well, you can always use the [URL="https://bitbucket.org/breakpointservers/bkacjios-glua-modules/src/c2d54eb24ba9/gm_cvar3/?at=default"]gm_cvar3[/URL] i guess
Entity(0):Remove()
-snip-
_restart should work. Always has and still does for me....
RunConsoleCommand("_restart") works for me
I think there's also _quit or quti
[QUOTE=Robotboy655;50326591]I think there's also _quit or quti[/QUOTE]
_quit is invalid, and quti is blocked by both game.ConsoleCommand and RunConsoleCommand
game.ConsoleCommand("_restart\n") and RunConsoleCommand("_restart") were the only ones that worked in my experiment
If you're using ulx, this is a really simple command to restart your server:
[CODE]
local CATEGORY_NAME = "Rcon"
function ulx.restart(calling_ply)
for k,v in pairs(player.GetAll()) do
ulx.fancyLogAdmin( calling_ply, false, "#A restarted the server" )
timer.Create( "RestartMessage", 5, 1, function() ULib.tsay( v, "Restarting in 10 seconds") end)
timer.Create( "Restart", 20, 1, function() RunConsoleCommand("_restart") end )
end
end
local restart = ulx.command( CATEGORY_NAME, "ulx restart", ulx.restart, "!restart", true )
restart:defaultAccess( ULib.ACCESS_SUPERADMIN )
restart:help( "Restarts the server after 10 seconds" )
[/CODE]
[QUOTE=danker pepers;50327512]If you're using ulx, this is a really simple command to restart your server:
[CODE]
local CATEGORY_NAME = "Rcon"
function ulx.restart(calling_ply)
for k,v in pairs(player.GetAll()) do
ulx.fancyLogAdmin( calling_ply, false, "#A restarted the server" )
timer.Create( "RestartMessage", 5, 1, function() ULib.tsay( v, "Restarting in 10 seconds") end)
timer.Create( "Restart", 20, 1, function() RunConsoleCommand("_restart") end )
end
end
local restart = ulx.command( CATEGORY_NAME, "ulx restart", ulx.restart, "!restart", true )
restart:defaultAccess( ULib.ACCESS_SUPERADMIN )
restart:help( "Restarts the server after 10 seconds" )
[/CODE][/QUOTE]
That's just a wrapper for using _restart.
[QUOTE=code_gs;50327759]That's just a wrapper for using _restart.[/QUOTE]
I know it is. Depending on what he needs it for, this works. If he is trying to restart it from ingame with a command, this solves that.
[editline]15th May 2016[/editline]
It allows for permissions and let's you call it when ever you want. You can't just run lua from ingame.
[QUOTE=Robotboy655;50326591]I think there's also _quit or quti[/QUOTE]
quti was removed but is still blacklisted anyway
Why is there a command blacklist on [U]serverside[/U] anyways???
I mean if someone does find an exploit that would allow them to access serverside LUA, there is not much damage he could do with commands than using the LUA itself.
[QUOTE=edgarasf123;50328127]Why is there a command blacklist on [U]serverside[/U] anyways???
I mean if someone does find an exploit that would allow them to access serverside LUA, there is not much damage he could do than using the LUA itself.[/QUOTE]
workshop addons
LocalPlayer():ConCommand("disconnect")
Run script clientsided.
I believe you can also add aliases in your server.cfg and then call the alias.
For example:
[lua]
alias exitgame quit -- adds alias to quit command as 'exitgame' - put in server.cfg then use either of below in Lua
game.ConsoleCommand("exitgame\n")
RunConsoleCommand("exitgame")
[/lua]
Sorry, you need to Log In to post a reply to this thread.