Tremulous Forum
Mods => Modding Center => Topic started by: {FN}BlueCelery2 on August 23, 2011, 05:24:42 am
-
i want to make a command for my admin.dat that does the following
cp server shutting down in 10 minutes
wait 300000
cp server shutting down in 5 minutes
wait 240000
cp server shutting down in 1 minute
wait 60000
then exec the /quit meaning this would only be done from the server window to kill the server
how would i add the /quit in plz help
-
I believe the command you are looking for is [wiki]killserver[/wiki]
-
so it would be exec /killserver ?
-
I believe this works still (http://tremulous.net/forum/index.php?topic=8859.msg140451#msg140451), make a cfg with everything you want to be done inside of it, then add a new command in your admin.dat with a "exec XXX.cfg".
-
I assume you have something like this at the moment....
[command]
command = command_name
exec = cp server shutting down in 10 minutes; wait 300000; cp server shutting down in 5 minutes; wait 240000; cp server shutting down in 1 minute; wait 60000
desc = Shuts down server in 10minutes, with messages.
levels = 6
And you want it to actually shut down the server at the end? If so, just add the command "killserver" to the end. E.g.
[command]
command = command_name
exec = cp server shutting down in 10 minutes; wait 300000; cp server shutting down in 5 minutes; wait 240000; cp server shutting down in 1 minute; wait 60000; killserver
desc = Shuts down server in 10minutes, with messages.
levels = 6
Though, I am not a fan of admin.dat commands. If I were you, I would just write it into your game.qvm. The wait command can sometimes have unwanted side effects, such as it will delay execution of further commands until it has finished, which in this case would be 10min.
You could do something like this.
Register a new cvar, ex: g_shutDownTime
In g_cmds.c add a "shutdown" cmd. When this command is issued, it will add the 10min to the current real time and broadcast the first warning.
Regularly for the difference between shutDownTime and send messages at time differences you want, eg: 5min, 1min.
Shut down the game when the difference is <= 0.
If you need help with that, I'll be glad to help you.