Automatic Campaign Switcher
This version of Automatic Campaign Switcher is based on ChrisP`s original version (v1.2.2), which is available here: https://forums.alliedmods.net/showthread.php?t=156392
Automatic Campaign Switcher, or ACS, was written as an easy way to keep the Left4Dead 2 default map rotation going on a server without people being booted because the vote to restart a campaign was not passed. I also tried to write ACS in such a way that it would be easy to change for those who wish to edit the source to have custom campaigns and maps in l4d2 as well. If you decide not to edit the files, then ACS will cycle through maps in chronological order corresponding to the L4D story timeline. ACS also includes a voting system in which people can vote for their favorite campaign/map on a finale or scavenge map. The winning campaign/map will become the next map the server loads.
This plugin requires "L4D2 Mission Manager" to work, which can be found here: http://forums.alliedmods.net/showthread.php?t=308725
There's a simple way to install, just unzip "acs_ready_to_go.zip" to your "left4dead2/addons/sourcemod" folder.
"L4D2 Mission Manager" is included.
The improved version inherits all features of the original version, with several advanced feature added:
1. Adding new maps no longer requires modification and recompiling of the sp file, the plugin automatically finds them. No more hard coding
2. A new map voting system is introduced, players can use "!chmap" to initiate a vote if they want to change the map immediately.
3. A new command "!chmap2" allows players to vote when they want to switch to any map available on the server, even the target map is not the first map of a campaign.
4. Better localization support, messages, menus and map names can now be displayed in client`s language
5. Bug fixes, e.g. the original version uses a wrong way to load CVars.
6. Prevent an empty server running 3-rd maps
7. [New Feature]
A new admin menu for changing maps, located in Admin menu -> Server Commands (Added upon the request of Mi.Cura, file: l4d2_mm_adminmenu.smx)
Note: For security reasons, "!chmap" and "!chmap2" are disabled by default to prevent griefers' misuse, see CVar "acs_chmap_policy".
Console Variables (CVars)
Most of them have exactly the same definition as the original version, (please refer to ChrisP`s original post), except three new CVars:
1. acs_chmap_broadcast_interval, controls the frequency of the "!chmap" advertisement
2. acs_prevent_empty_server, if enabled, the server automatically switch to the first available official map when no one is playing a 3-rd map
3. acs_chmap_policy, set to 0 disables "!chmap" (by default), set to 1 enables "!chmap" and treats abstention as NO, set to 2 enables "!chmap" and treats abstention as YES. In most case, DONT set it to 2!
Map/campaign List Configuration
"l4d2_mission_manager" provides information about maps and campaigns, this is fully automatic. After parsing all mission text files cached by "l4d2_mission_manager", the plugin will load "left4dead2/addons/sourcemod/configs/missioncycle.*.txt", if not exist, the plugin will create one. (* can be coop/versus/scavenge/survival) Any new installed maps will be appended to the end of "missioncycle.*.txt". The order of entries in "missioncycle.*.txt" controls the order of map cycle.
Invalid entries (e.g. removed campaign) in "missioncycle.*.txt" will be ignored and printed on the server console.
Some maps can be excluded from the map cycle, see "missioncycle.*.txt" for more information, those maps can only be loaded via "!chmap" and after the finale map the server loads the first map in the map cycle.
Map/campaign Name Localization
The localized campaign names are in "left4dead2/addons/sourcemod/translations/missions.phrases.txt" or "left4dead2/addons/sourcemod/translations/chi/missions.phrases.txt", depends on the language. If a campaign is not in "left4dead2/addons/sourcemod/translations/missions.phrases.txt", the name in "missioncycle.*.txt" will be used for display. If a campaign is listed in "left4dead2/addons/sourcemod/translations/missions.phrases.txt", the plugin will attempt to display the campaign name in the client`s language, (for Simplified Chinese, is "left4dead2/addons/sourcemod/translations/chi/missions.phrases.txt"), if fails then display the English name.
TODO & Known problems
1. Map/Campaign cycle randomizer
2. (Reported by Mr. Man) Some finale maps aren't triggering the mapvote function. (Although it does not affect default map cycle) The cause is under investigation
Latest source code is available on Github: https://github.com/rikka0w0/l4d2_mission_manager
Compiling the source requires plugin "l4d2_mission_manager" which is available on the above link.
This plugin has been proved stable in coop mode on my server.
nandofs's problem has been fixed, Silvers' suggestion is still under consideration.