Author Topic: admin.dat  (Read 6738 times)

{FN}BlueCelery2

  • Posts: 10
  • Turrets: +0/-0
admin.dat
« 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

Meisseli

  • Spam Killer
  • *
  • Posts: 765
  • Turrets: +83/-25
Re: admin.dat
« Reply #1 on: August 23, 2011, 11:53:50 am »
I believe the command you are looking for is [wiki]killserver[/wiki]

{FN}BlueCelery2

  • Posts: 10
  • Turrets: +0/-0
Re: admin.dat
« Reply #2 on: August 23, 2011, 07:20:50 pm »
so it would be exec /killserver ?

Meisseli

  • Spam Killer
  • *
  • Posts: 765
  • Turrets: +83/-25
Re: admin.dat
« Reply #3 on: August 23, 2011, 07:41:22 pm »
I believe this works still, 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".

hermxiv

  • Posts: 39
  • Turrets: +1/-1
Re: admin.dat
« Reply #4 on: August 24, 2011, 10:29:59 pm »
I assume you have something like this at the moment....
Code: [Select]
[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.

Code: [Select]
[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.
« Last Edit: August 24, 2011, 10:35:55 pm by hermxiv »