Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 227 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_extend_map.sma
+171 -0
A
csb.json
+52 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-07-12) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Extend Map</strong> covers both ways a map gets stretched: an admin command and a player vote. <code>amx_extendmap [minutes]</code> adds time to <code>mp_timelimit</code> and re-announces the new time left; <code>say /extend</code> opens a yes/no vote to everyone on the server, and if it passes the map is extended by a configurable amount. A <code>csb_extend_max</code> cap counts every extension so a busy map can never be kept alive indefinitely.</p><p>Inspired by the map-extension commands in the AMX Mod X map management plugin. Independent GPL re-implementation.</p><h2>Features</h2><ul><li><code>amx_extendmap [minutes]</code> — defaults to <code>csb_extend_minutes</code> when no argument is given.</li><li><code>say /extend</code> starts a 15-second vote menu shown to every player.</li><li>Extension counter enforced against <code>csb_extend_max</code> for both the command path and the vote path.</li><li>Reads <code>mp_timelimit</code> through a cached cvar pointer and re-broadcasts <code>get_timeleft()</code>.</li></ul><h2>Installation</h2><ol><li>Compile <code>csb_extend_map.sma</code> and copy it to <code>addons/amxmodx/plugins/</code>.</li><li>Add it to <code>plugins.ini</code> and change the map.</li></ol><p>No extra modules are required. <code>amx_extendmap</code> needs the <code>ADMIN_MAP</code> flag (<code>e</code>).</p> |
addons/amxmodx/scripting/csb_extend_map.sma
A
| @@ -0,0 +1,171 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Extend Map | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * amx_extendmap adds N minutes to mp_timelimit and re-broadcasts the new time | |
| 6 | + * left. Players can also start a vote (say /extend) to extend the current map | |
| 7 | + * once, capped by a max-extensions cvar so a map can never run forever. | |
| 8 | + * | |
| 9 | + * Inspired by the map-extension commands from the AMX Mod X map management | |
| 10 | + * plugin (AMX Mod X Development Team). Independent GPL re-implementation. | |
| 11 | + * | |
| 12 | + * This program is free software: you can redistribute it and/or modify it under | |
| 13 | + * the terms of the GNU General Public License as published by the Free Software | |
| 14 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 15 | + * version. It is distributed in the hope that it will be useful, but WITHOUT | |
| 16 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 17 | + * FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +#include <amxmodx> | |
| 21 | +#include <amxmisc> | |
| 22 | + | |
| 23 | +new const PLUGIN[] = "CSB Extend Map" | |
| 24 | +new const VERSION[] = "1.0.0" | |
| 25 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 26 | + | |
| 27 | +new g_pTimeLimit | |
| 28 | +new g_pDefaultMin, g_pMaxExtends, g_pVoteMin | |
| 29 | + | |
| 30 | +new g_iExtends = 0 | |
| 31 | +new bool:g_bVoteRunning = false | |
| 32 | +new g_iYes, g_iNo | |
| 33 | + | |
| 34 | +public plugin_init() | |
| 35 | +{ | |
| 36 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 37 | + | |
| 38 | + g_pTimeLimit = get_cvar_pointer("mp_timelimit") | |
| 39 | + | |
| 40 | + g_pDefaultMin = register_cvar("csb_extend_minutes", "15") | |
| 41 | + g_pMaxExtends = register_cvar("csb_extend_max", "3") | |
| 42 | + g_pVoteMin = register_cvar("csb_extend_votemin", "15") | |
| 43 | + | |
| 44 | + register_concmd("amx_extendmap", "cmdExtend", ADMIN_MAP, "[minutes] - add time to mp_timelimit") | |
| 45 | + register_clcmd("say /extend", "cmdVote") | |
| 46 | + register_clcmd("say_team /extend", "cmdVote") | |
| 47 | +} | |
| 48 | + | |
| 49 | +public plugin_cfg() | |
| 50 | +{ | |
| 51 | + g_iExtends = 0 | |
| 52 | +} | |
| 53 | + | |
| 54 | +extendBy(minutes) | |
| 55 | +{ | |
| 56 | + new cur = g_pTimeLimit ? get_pcvar_num(g_pTimeLimit) : get_cvar_num("mp_timelimit") | |
| 57 | + new next = cur + minutes | |
| 58 | + | |
| 59 | + if (g_pTimeLimit) | |
| 60 | + set_pcvar_num(g_pTimeLimit, next) | |
| 61 | + else | |
| 62 | + set_cvar_num("mp_timelimit", next) | |
| 63 | + | |
| 64 | + g_iExtends++ | |
| 65 | + | |
| 66 | + new left = get_timeleft() / 60 | |
| 67 | + client_print(0, print_chat, "[CSB] Map extended by %d minute(s). New limit: %d min, about %d min left.", | |
| 68 | + minutes, next, left) | |
| 69 | +} | |
| 70 | + | |
| 71 | +public cmdExtend(id, level, cid) | |
| 72 | +{ | |
| 73 | + if (!cmd_access(id, level, cid, 1)) | |
| 74 | + return PLUGIN_HANDLED | |
| 75 | + | |
| 76 | + new minutes = get_pcvar_num(g_pDefaultMin) | |
| 77 | + | |
| 78 | + if (read_argc() > 1) | |
| 79 | + { | |
| 80 | + new arg[8] | |
| 81 | + read_argv(1, arg, charsmax(arg)) | |
| 82 | + new n = str_to_num(arg) | |
| 83 | + | |
| 84 | + if (n > 0) | |
| 85 | + minutes = n | |
| 86 | + } | |
| 87 | + | |
| 88 | + extendBy(minutes) | |
| 89 | + | |
| 90 | + new aname[32] | |
| 91 | + if (id) | |
| 92 | + get_user_name(id, aname, charsmax(aname)) | |
| 93 | + else | |
| 94 | + copy(aname, charsmax(aname), "CONSOLE") | |
| 95 | + | |
| 96 | + log_amx("[CSB Extend] %s extended the map by %d min", aname, minutes) | |
| 97 | + return PLUGIN_HANDLED | |
| 98 | +} | |
| 99 | + | |
| 100 | +public cmdVote(id) | |
| 101 | +{ | |
| 102 | + if (g_bVoteRunning) | |
| 103 | + { | |
| 104 | + client_print(id, print_chat, "[CSB] A vote is already running.") | |
| 105 | + return PLUGIN_HANDLED | |
| 106 | + } | |
| 107 | + | |
| 108 | + if (g_iExtends >= get_pcvar_num(g_pMaxExtends)) | |
| 109 | + { | |
| 110 | + client_print(id, print_chat, "[CSB] This map has already been extended the maximum number of times.") | |
| 111 | + return PLUGIN_HANDLED | |
| 112 | + } | |
| 113 | + | |
| 114 | + g_bVoteRunning = true | |
| 115 | + g_iYes = 0 | |
| 116 | + g_iNo = 0 | |
| 117 | + | |
| 118 | + new menu = menu_create("\yExtend the map?^n\wIt will add time to the current map.", "voteHandler") | |
| 119 | + menu_additem(menu, "\wYes, extend", "1", 0) | |
| 120 | + menu_additem(menu, "\wNo", "2", 0) | |
| 121 | + menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER) | |
| 122 | + | |
| 123 | + new players[32], num, pid | |
| 124 | + get_players(players, num, "ch") | |
| 125 | + | |
| 126 | + for (new i = 0; i < num; i++) | |
| 127 | + { | |
| 128 | + pid = players[i] | |
| 129 | + menu_display(pid, menu, 0) | |
| 130 | + } | |
| 131 | + | |
| 132 | + client_print(0, print_chat, "[CSB] Vote started: extend the current map?") | |
| 133 | + set_task(15.0, "voteEnd") | |
| 134 | + return PLUGIN_HANDLED | |
| 135 | +} | |
| 136 | + | |
| 137 | +public voteHandler(id, menu, item) | |
| 138 | +{ | |
| 139 | + if (item == MENU_EXIT || item < 0) | |
| 140 | + { | |
| 141 | + menu_destroy(menu) | |
| 142 | + return PLUGIN_HANDLED | |
| 143 | + } | |
| 144 | + | |
| 145 | + new info[4], name[32], access, callback | |
| 146 | + menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback) | |
| 147 | + menu_destroy(menu) | |
| 148 | + | |
| 149 | + if (str_to_num(info) == 1) | |
| 150 | + g_iYes++ | |
| 151 | + else | |
| 152 | + g_iNo++ | |
| 153 | + | |
| 154 | + return PLUGIN_HANDLED | |
| 155 | +} | |
| 156 | + | |
| 157 | +public voteEnd() | |
| 158 | +{ | |
| 159 | + g_bVoteRunning = false | |
| 160 | + | |
| 161 | + if (g_iYes > g_iNo) | |
| 162 | + { | |
| 163 | + client_print(0, print_chat, "[CSB] Vote passed (%d yes / %d no). Extending the map.", g_iYes, g_iNo) | |
| 164 | + extendBy(get_pcvar_num(g_pVoteMin)) | |
| 165 | + log_amx("[CSB Extend] player vote passed (%d/%d), map extended", g_iYes, g_iNo) | |
| 166 | + } | |
| 167 | + else | |
| 168 | + { | |
| 169 | + client_print(0, print_chat, "[CSB] Vote failed (%d yes / %d no). The map will not be extended.", g_iYes, g_iNo) | |
| 170 | + } | |
| 171 | +} |
csb.json
A
| @@ -0,0 +1,52 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Extend Map", | |
| 3 | + "category": "admin", | |
| 4 | + "tags": "extend, timelimit, map", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "AMX Mod X Development Team (Map Management)", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Extend Map", | |
| 10 | + "short_desc": "amx_extendmap adds minutes to mp_timelimit; players can vote once per map to extend, capped so a map cannot run forever.", | |
| 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_extend_map.amxx in addons/amxmodx/plugins/\n2. Add it to addons/amxmodx/configs/plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Other map-vote / extend plugins that also edit mp_timelimit will double-count extensions.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_extend_minutes", | |
| 25 | + "default": "15", | |
| 26 | + "description": "Minutes added by amx_extendmap when no argument is given." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_extend_max", | |
| 30 | + "default": "3", | |
| 31 | + "description": "Maximum number of extensions allowed on one map (command + vote combined)." | |
| 32 | + }, | |
| 33 | + { | |
| 34 | + "name": "csb_extend_votemin", | |
| 35 | + "default": "15", | |
| 36 | + "description": "Minutes added when a player vote passes." | |
| 37 | + } | |
| 38 | + ], | |
| 39 | + "commands": [ | |
| 40 | + { | |
| 41 | + "name": "amx_extendmap", | |
| 42 | + "access": "e (ADMIN_MAP)", | |
| 43 | + "description": "amx_extendmap [minutes] - add time to mp_timelimit." | |
| 44 | + }, | |
| 45 | + { | |
| 46 | + "name": "say /extend", | |
| 47 | + "access": "", | |
| 48 | + "description": "Start a public vote to extend the current map." | |
| 49 | + } | |
| 50 | + ], | |
| 51 | + "main": "addons/amxmodx/scripting/csb_extend_map.sma" | |
| 52 | +} | |
| 0 | 53 |









