Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 199 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_multimod_manager.sma
+158 -0
A
csb.json
+37 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2026-04-02) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Multimod Manager</strong> lets one server rotate through several mods by map prefix. At map start it reads a mapping file and, for every block whose prefix matches the current map, execs that block's server .cfg and <code>amx_unpause</code>s its plugins; non-matching blocks are <code>amx_pause</code>d. So kz_, deathrun_, surf_, zm_ and jail_ maps each get their own plugin set without hand-swapping configs.</p><h2>Features</h2><ul><li>Reads <code>addons/amxmodx/configs/csb_multimod.ini</code> (prefix, cfg, plugin list per line).</li><li>Matches the current map name by prefix and applies the matching block.</li><li>amx_unpause matching plugins and amx_pause the rest.</li><li>Execs the block's server .cfg; re-run any time with <code>csb_mm_reload</code>.</li></ul><h2>Installation</h2><ol><li>Create <code>addons/amxmodx/configs/csb_multimod.ini</code> with lines like <code>kz_ kz.cfg kztimer.amxx;kz_hud.amxx</code>.</li><li>Compile <code>csb_multimod_manager.sma</code>, copy it to <code>addons/amxmodx/plugins/</code> and add it to <code>plugins.ini</code>.</li><li>Change the map.</li></ol> |
addons/amxmodx/scripting/csb_multimod_manager.sma
A
| @@ -0,0 +1,158 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Multimod Manager | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Rotates one server through several mods by map prefix. At map start it reads a | |
| 6 | + * mapping file, and for every block whose prefix matches the current map name it | |
| 7 | + * execs that block's server .cfg and amx_unpauses its plugins; non-matching | |
| 8 | + * blocks are amx_paused. This keeps kz_, deathrun_, surf_, zm_, jail_ maps on | |
| 9 | + * the right plugin set without swapping configs by hand. | |
| 10 | + * | |
| 11 | + * Inspired by Multi-Mod Manager by Emp`. Independent GPL re-implementation. | |
| 12 | + * | |
| 13 | + * This program is free software: you can redistribute it and/or modify it under | |
| 14 | + * the terms of the GNU General Public License as published by the Free Software | |
| 15 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 16 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 17 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 18 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 19 | + */ | |
| 20 | + | |
| 21 | +#include <amxmodx> | |
| 22 | + | |
| 23 | +new const PLUGIN[] = "CSB Multimod Manager" | |
| 24 | +new const VERSION[] = "1.0.0" | |
| 25 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 26 | + | |
| 27 | +new g_pEnabled | |
| 28 | +new g_szMap[40] | |
| 29 | + | |
| 30 | +public plugin_init() | |
| 31 | +{ | |
| 32 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 33 | + | |
| 34 | + g_pEnabled = register_cvar("csb_mm_enabled", "1") | |
| 35 | + register_concmd("csb_mm_reload", "cmdReload", ADMIN_CFG, "- re-apply the multimod config for the current map") | |
| 36 | +} | |
| 37 | + | |
| 38 | +public plugin_cfg() | |
| 39 | +{ | |
| 40 | + if (get_pcvar_num(g_pEnabled)) | |
| 41 | + { | |
| 42 | + get_mapname(g_szMap, charsmax(g_szMap)) | |
| 43 | + applyConfig() | |
| 44 | + } | |
| 45 | +} | |
| 46 | + | |
| 47 | +public cmdReload(id, level, cid) | |
| 48 | +{ | |
| 49 | + get_mapname(g_szMap, charsmax(g_szMap)) | |
| 50 | + applyConfig() | |
| 51 | + console_print(id, "[CSB MM] Multimod config re-applied for %s.", g_szMap) | |
| 52 | + return PLUGIN_HANDLED | |
| 53 | +} | |
| 54 | + | |
| 55 | +applyConfig() | |
| 56 | +{ | |
| 57 | + new path[128] | |
| 58 | + copy(path, charsmax(path), "addons/amxmodx/configs/csb_multimod.ini") | |
| 59 | + | |
| 60 | + if (!file_exists(path)) | |
| 61 | + { | |
| 62 | + log_amx("[CSB MM] Config %s not found; nothing to do.", path) | |
| 63 | + return | |
| 64 | + } | |
| 65 | + | |
| 66 | + new fp = fopen(path, "rt") | |
| 67 | + | |
| 68 | + if (!fp) | |
| 69 | + return | |
| 70 | + | |
| 71 | + new line[256], matched = 0 | |
| 72 | + | |
| 73 | + while (!feof(fp)) | |
| 74 | + { | |
| 75 | + fgets(fp, line, charsmax(line)) | |
| 76 | + trim(line) | |
| 77 | + | |
| 78 | + if (!line[0] || line[0] == ';' || line[0] == '#') | |
| 79 | + continue | |
| 80 | + | |
| 81 | + new prefix[32], cfgfile[64], plugins[160], pos = 0 | |
| 82 | + | |
| 83 | + pos = argParse(line, pos, prefix, charsmax(prefix)) | |
| 84 | + pos = argParse(line, pos, cfgfile, charsmax(cfgfile)) | |
| 85 | + argParse(line, pos, plugins, charsmax(plugins)) | |
| 86 | + | |
| 87 | + if (!prefix[0]) | |
| 88 | + continue | |
| 89 | + | |
| 90 | + if (containi(g_szMap, prefix) == 0) | |
| 91 | + { | |
| 92 | + matched++ | |
| 93 | + | |
| 94 | + if (cfgfile[0] && !equal(cfgfile, "-")) | |
| 95 | + server_cmd("exec addons/amxmodx/configs/%s", cfgfile) | |
| 96 | + | |
| 97 | + togglePlugins(plugins, true) | |
| 98 | + } | |
| 99 | + else | |
| 100 | + { | |
| 101 | + togglePlugins(plugins, false) | |
| 102 | + } | |
| 103 | + } | |
| 104 | + | |
| 105 | + fclose(fp) | |
| 106 | + server_exec() | |
| 107 | + | |
| 108 | + if (matched) | |
| 109 | + log_amx("[CSB MM] Applied %d matching mod block(s) for map %s.", matched, g_szMap) | |
| 110 | +} | |
| 111 | + | |
| 112 | +togglePlugins(const list[], bool:enable) | |
| 113 | +{ | |
| 114 | + new item[32], len = strlen(list), k = 0 | |
| 115 | + | |
| 116 | + for (new i = 0; i <= len; i++) | |
| 117 | + { | |
| 118 | + if (i == len || list[i] == ';') | |
| 119 | + { | |
| 120 | + item[k] = 0 | |
| 121 | + trim(item) | |
| 122 | + | |
| 123 | + if (item[0]) | |
| 124 | + { | |
| 125 | + if (enable) | |
| 126 | + server_cmd("amx_unpause ^"%s^"", item) | |
| 127 | + else | |
| 128 | + server_cmd("amx_pause ^"%s^"", item) | |
| 129 | + } | |
| 130 | + | |
| 131 | + k = 0 | |
| 132 | + } | |
| 133 | + else if (k < charsmax(item)) | |
| 134 | + { | |
| 135 | + item[k++] = list[i] | |
| 136 | + } | |
| 137 | + } | |
| 138 | +} | |
| 139 | + | |
| 140 | +argParse(const src[], start, dest[], maxlen) | |
| 141 | +{ | |
| 142 | + new len = strlen(src), i = start | |
| 143 | + | |
| 144 | + while (i < len && (src[i] == ' ' || src[i] == '^t')) | |
| 145 | + i++ | |
| 146 | + | |
| 147 | + new k = 0 | |
| 148 | + | |
| 149 | + while (i < len && src[i] != ' ' && src[i] != '^t') | |
| 150 | + { | |
| 151 | + if (k < maxlen) | |
| 152 | + dest[k++] = src[i] | |
| 153 | + i++ | |
| 154 | + } | |
| 155 | + | |
| 156 | + dest[k] = 0 | |
| 157 | + return i | |
| 158 | +} |
csb.json
A
| @@ -0,0 +1,37 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Multimod Manager", | |
| 3 | + "category": "gameplay", | |
| 4 | + "tags": "multimod, maps, mods", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "Emp` (Multi-Mod Manager, concept)", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Multimod Manager", | |
| 10 | + "short_desc": "Enables/disables mod plugins and execs the right .cfg per map prefix from a mapping file.", | |
| 11 | + "version": "1.0.0", | |
| 12 | + "amxx_min": "1.9", | |
| 13 | + "amxx_compile_default": "1.9", | |
| 14 | + "rehlds_ok": true, | |
| 15 | + "hlds_ok": true, | |
| 16 | + "regamedll_required": false, | |
| 17 | + "metamod_flavor": "any", | |
| 18 | + "reapi_required": false, | |
| 19 | + "modules": "", | |
| 20 | + "install_notes": "1. Put csb_multimod_manager.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n2. Create addons/amxmodx/configs/csb_multimod.ini (prefix cfg plugin1;plugin2 per line)\n3. Change map", | |
| 21 | + "known_conflicts": "Pausing a plugin that other running plugins depend on can break those; order your mapping carefully.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_mm_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable the multimod manager." | |
| 27 | + } | |
| 28 | + ], | |
| 29 | + "commands": [ | |
| 30 | + { | |
| 31 | + "name": "csb_mm_reload", | |
| 32 | + "access": "e (ADMIN_CFG)", | |
| 33 | + "description": "Re-apply the multimod config for the current map." | |
| 34 | + } | |
| 35 | + ], | |
| 36 | + "main": "addons/amxmodx/scripting/csb_multimod_manager.sma" | |
| 37 | +} | |
| 0 | 38 |









