View Single Post
Plugin Info:     Modification:          Category:          Approver:   EKS (166)
Maddo
Member
Join Date: Dec 2004
Old 02-06-2006 , 00:00   Map Cycle Restoration on Crash (Linux Only)
Reply With Quote #1

This combination of modified hlds_run shell script and AMXX plugin allows a crashing server to resume at the point in the mapcycle at which it left. The plugin "writenextmap.amxx" writes the contents of "amx_nextmap" to file at the start of each map. Upon a server crash the modified hlds_run script will read the mapname from this file, and restart the server using this map. A second shell script will also be called, which will reorder mapcycle.txt so that the map it is starting with, will now be at the end, and the mapcycle resumes as if the server never crashed. Upon exiting hlds, the original maycycle.txt and nextmap.txt will be restored.

There a number of things you must do to have this work properly
-You must use mapcycle.txt, and not maps.ini.
-You must have the core plugin, nextmap.amxx running.
-mapcycle.txt must only have one instance of each map. (it will still work, but reordering will not be correct if amx_nextmap is a duplicated map)
-make sure mapcycle.txt ends in a new line, otherwise a map will be dropped from the cycle on a server crash.
-To start the server, do not use a +map parameter. Put the map you want to start with in nextmap.txt, in the addons/amxmodx/configs folder.

Installation:
-Place "hlds_run_mapcycle" and "mapcycle" inside the root hlds folder
-Place "writenextmap.amxx" in your plugins folder and add it to plugins.ini
-Make sure the core plugin "nextmap.amxx" is also in plugins.ini
-Create a file "/addons/amxmodx/configs/nextmap.txt"
-inside "nextmap.txt", write the name of the map you want to start your server with

To start the server with map cycle recovery, use hlds_run_mapcycle rather than hlds_run, and make sure writenextmap.amxx and nexmap.amxx are loaded in plugins.ini. Do no use a +map paramater to start the server, this will cause problems. Stick the map you want to run first inside addons/amxmodx/configs/nextmap.txt.

For example, to start a TS server, you may type:
Code:
./hlds_run_mapcycle -game ts +maxplayers 12
Thanks to darkpast for writing the mapcycle shell script, and modifying the hlds_run shell script. Without his shell scripting skill, this modification would not have been possible.
Attached Files
File Type: zip mapcycle.zip (4.9 KB, 823 views)
File Type: sma Get Plugin or Get Source (writenextmap.sma - 2161 views - 1.1 KB)
Maddo is offline