Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 214 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_cvar_menu.sma
+174 -0
A
csb.json
+36 -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 CVar Menu</strong> collects the settings server admins reach for constantly — friendly fire, gravity, freeze time, round time, buy time, auto team balance, start money and the C4 timer — into one menu. Each row shows the current value; selecting it cycles to the next preset and applies it immediately with <code>set_cvar_string</code>, then reopens so you can keep tuning.</p><p>Inspired by the AMX Mod X CVar menu. Independent GPL re-implementation.</p><h2>Features</h2><ul><li>Eight common cvars, each with a curated list of sensible preset values.</li><li>Live current value shown inline next to every entry.</li><li>Selecting a row advances to the next preset and wraps around at the end.</li><li>Opens with <code>amx_cvarmenu</code> or <code>say /cvars</code> (admins only).</li><li>Each change is announced to the admin and written to the AMXX log.</li></ul><h2>Installation</h2><ol><li>Compile <code>csb_cvar_menu.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><code>amx_cvarmenu</code> needs the <code>ADMIN_CVAR</code> flag (<code>l</code>). The preset lists live at the top of the source — edit them to taste and recompile.</p> |
addons/amxmodx/scripting/csb_cvar_menu.sma
A
| @@ -0,0 +1,174 @@ | ||
| 1 | +/* | |
| 2 | + * CSB CVar Menu | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * A menu of the cvars server admins change most often (friendly fire, gravity, | |
| 6 | + * freeze time, round time, buy time, auto team balance, start money, C4 timer). | |
| 7 | + * Each entry shows its current value and cycles through a preset list when | |
| 8 | + * selected, applying it immediately with set_cvar_string. | |
| 9 | + * | |
| 10 | + * Inspired by the AMX Mod X CVar menu (AMX Mod X Development Team). Independent | |
| 11 | + * 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 | +#include <amxmisc> | |
| 23 | + | |
| 24 | +new const PLUGIN[] = "CSB CVar Menu" | |
| 25 | +new const VERSION[] = "1.0.0" | |
| 26 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 27 | + | |
| 28 | +/* cvar name, friendly label and a pipe-separated list of preset values */ | |
| 29 | +new const g_cvarName[][] = { | |
| 30 | + "mp_friendlyfire", | |
| 31 | + "sv_gravity", | |
| 32 | + "mp_freezetime", | |
| 33 | + "mp_roundtime", | |
| 34 | + "mp_buytime", | |
| 35 | + "mp_autoteambalance", | |
| 36 | + "mp_startmoney", | |
| 37 | + "mp_c4timer" | |
| 38 | +} | |
| 39 | +new const g_cvarLabel[][] = { | |
| 40 | + "Friendly Fire", | |
| 41 | + "Gravity", | |
| 42 | + "Freeze Time", | |
| 43 | + "Round Time", | |
| 44 | + "Buy Time", | |
| 45 | + "Auto Team Balance", | |
| 46 | + "Start Money", | |
| 47 | + "C4 Timer" | |
| 48 | +} | |
| 49 | +new const g_cvarPreset[][] = { | |
| 50 | + "0|1", | |
| 51 | + "400|600|800|1000", | |
| 52 | + "0|3|6", | |
| 53 | + "1.75|3|5|9", | |
| 54 | + "0.25|0.5|1", | |
| 55 | + "0|1", | |
| 56 | + "800|1600|8000|16000", | |
| 57 | + "30|35|45|60" | |
| 58 | +} | |
| 59 | + | |
| 60 | +#define ENTRIES sizeof(g_cvarName) | |
| 61 | + | |
| 62 | +public plugin_init() | |
| 63 | +{ | |
| 64 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 65 | + register_concmd("amx_cvarmenu", "cmdCvarMenu", ADMIN_CVAR, "- open the quick cvar menu") | |
| 66 | + register_clcmd("say /cvars", "sayCvarMenu") | |
| 67 | +} | |
| 68 | + | |
| 69 | +public sayCvarMenu(id) | |
| 70 | +{ | |
| 71 | + if (get_user_flags(id) & ADMIN_CVAR) | |
| 72 | + showMenu(id) | |
| 73 | + | |
| 74 | + return PLUGIN_HANDLED | |
| 75 | +} | |
| 76 | + | |
| 77 | +public cmdCvarMenu(id, level, cid) | |
| 78 | +{ | |
| 79 | + if (!cmd_access(id, level, cid, 1)) | |
| 80 | + return PLUGIN_HANDLED | |
| 81 | + | |
| 82 | + showMenu(id) | |
| 83 | + return PLUGIN_HANDLED | |
| 84 | +} | |
| 85 | + | |
| 86 | +showMenu(id) | |
| 87 | +{ | |
| 88 | + new title[64] | |
| 89 | + formatex(title, charsmax(title), "\yCSB CVar Menu^n\wPick a cvar to cycle its value") | |
| 90 | + | |
| 91 | + new menu = menu_create(title, "menuHandler") | |
| 92 | + | |
| 93 | + new line[96], cur[24], info[4] | |
| 94 | + | |
| 95 | + for (new i = 0; i < ENTRIES; i++) | |
| 96 | + { | |
| 97 | + get_cvar_string(g_cvarName[i], cur, charsmax(cur)) | |
| 98 | + formatex(line, charsmax(line), "%s: \y%s", g_cvarLabel[i], cur) | |
| 99 | + num_to_str(i, info, charsmax(info)) | |
| 100 | + menu_additem(menu, line, info, 0) | |
| 101 | + } | |
| 102 | + | |
| 103 | + menu_display(id, menu, 0) | |
| 104 | +} | |
| 105 | + | |
| 106 | +public menuHandler(id, menu, item) | |
| 107 | +{ | |
| 108 | + if (item == MENU_EXIT || item < 0) | |
| 109 | + { | |
| 110 | + menu_destroy(menu) | |
| 111 | + return PLUGIN_HANDLED | |
| 112 | + } | |
| 113 | + | |
| 114 | + new info[4], name[2], access, callback | |
| 115 | + menu_item_getinfo(menu, item, access, info, charsmax(info), name, charsmax(name), callback) | |
| 116 | + menu_destroy(menu) | |
| 117 | + | |
| 118 | + new idx = str_to_num(info) | |
| 119 | + | |
| 120 | + if (idx < 0 || idx >= ENTRIES) | |
| 121 | + return PLUGIN_HANDLED | |
| 122 | + | |
| 123 | + cycleCvar(id, idx) | |
| 124 | + showMenu(id) | |
| 125 | + return PLUGIN_HANDLED | |
| 126 | +} | |
| 127 | + | |
| 128 | +cycleCvar(id, idx) | |
| 129 | +{ | |
| 130 | + new presets[64] | |
| 131 | + copy(presets, charsmax(presets), g_cvarPreset[idx]) | |
| 132 | + | |
| 133 | + new cur[24] | |
| 134 | + get_cvar_string(g_cvarName[idx], cur, charsmax(cur)) | |
| 135 | + | |
| 136 | + /* split the preset list on '|' and find the current value, then take next */ | |
| 137 | + new values[6][24], count = 0 | |
| 138 | + new start = 0, len = strlen(presets) | |
| 139 | + for (new i = 0; i <= len && count < sizeof(values); i++) | |
| 140 | + { | |
| 141 | + if (presets[i] == '|' || presets[i] == 0) | |
| 142 | + { | |
| 143 | + new sub = i - start | |
| 144 | + if (sub > 0) | |
| 145 | + { | |
| 146 | + if (sub > charsmax(values[])) | |
| 147 | + sub = charsmax(values[]) | |
| 148 | + copy(values[count], sub, presets[start]) | |
| 149 | + count++ | |
| 150 | + } | |
| 151 | + start = i + 1 | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 155 | + if (!count) | |
| 156 | + return | |
| 157 | + | |
| 158 | + new nextIdx = 0 | |
| 159 | + for (new i = 0; i < count; i++) | |
| 160 | + { | |
| 161 | + if (equal(values[i], cur)) | |
| 162 | + { | |
| 163 | + nextIdx = (i + 1) % count | |
| 164 | + break | |
| 165 | + } | |
| 166 | + } | |
| 167 | + | |
| 168 | + set_cvar_string(g_cvarName[idx], values[nextIdx]) | |
| 169 | + | |
| 170 | + new aname[32] | |
| 171 | + get_user_name(id, aname, charsmax(aname)) | |
| 172 | + log_amx("[CSB CVar] %s set %s to %s", aname, g_cvarName[idx], values[nextIdx]) | |
| 173 | + client_print(id, print_chat, "[CSB] %s = %s", g_cvarLabel[idx], values[nextIdx]) | |
| 174 | +} |
csb.json
A
| @@ -0,0 +1,36 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB CVar Menu", | |
| 3 | + "category": "admin", | |
| 4 | + "tags": "cvars, menu, config", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "AMX Mod X Development Team (CVar Menu)", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB CVar Menu", | |
| 10 | + "short_desc": "A menu of the cvars admins change most (friendly fire, gravity, freeze/round/buy time, team balance, start money, C4 timer) that cycles preset values inline.", | |
| 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_cvar_menu.amxx in addons/amxmodx/plugins/\n2. Add it to addons/amxmodx/configs/plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Other plugins that also drive these cvars (e.g. gamemode managers) can overwrite values the moment you set them.", | |
| 22 | + "cvars": [], | |
| 23 | + "commands": [ | |
| 24 | + { | |
| 25 | + "name": "amx_cvarmenu", | |
| 26 | + "access": "l (ADMIN_CVAR)", | |
| 27 | + "description": "Open the quick cvar menu." | |
| 28 | + }, | |
| 29 | + { | |
| 30 | + "name": "say /cvars", | |
| 31 | + "access": "l (ADMIN_CVAR)", | |
| 32 | + "description": "Open the quick cvar menu (admins only)." | |
| 33 | + } | |
| 34 | + ], | |
| 35 | + "main": "addons/amxmodx/scripting/csb_cvar_menu.sma" | |
| 36 | +} | |
| 0 | 37 |









