I use a bash srcds control script that does the following before a quit;

STOPCOUNTDOWN=10
until [ $STOPCOUNTDOWN -eq 0 ] ; do
 echo -n "."
 # Send both a say and cm_csay, since sm_csay requires sourcemod.
 tmux send-keys -t $GAMEDIR \
 "sm_csay Server is shutting down in $STOPCOUNTDOWN seconds!" C-m
 tmux send-keys -t $GAMEDIR \
 "say Server is shutting down in $STOPCOUNTDOWN seconds!" C-m
 STOPCOUNTDOWN=$(( $STOPCOUNTDOWN - 1))
 sleep 1
done
tmux send-keys -t $GAMEDIR "quit" C-m



I use tmux instead of screen, but you can probably do the same with screen. This does not require rcon, though that would be an alternative method of sending the commands.

Also, if you use the "quit" command (exit also works/does the same thing?) then the clients don't time-out. They get a packet which triggers a nice dialog box, which tells them that the server is shutting down, similar to if they had been kicked.

Depending upon the reason for the shutdown, you could control the message sent in the say/sm_say commands via another $variable.



Comments welcome.



E3pO wrote:
is there a good way to warn the server that there is an update and needs to
restart instead of just restarting the server and saying "WE ARE GOING TO
RESTART FOR UPDATES" like a million times?

When you kill the server players clients time out and then get a lost
connection to server. It would be cool to have something like "closeupdate"
as a command that pops up a dialog after they get timed out that the server
is currently updating and that they can reconnect when it is done.

--
# Jesse Molina
# Mail = [email protected]
# Page = [email protected]
# Cell = 1.602.323.7608
# Web  = http://www.opendreams.net/jesse/



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux

Reply via email to