Initial release 1.0.0
Browse SourceInitial release.
4 changed files
with 250 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_classic_round_control.sma
+199 -0
A
csb.json
+47 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-12-20) | |
| 2 | + | |
| 3 | +Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Classic Round Control</strong> gives match admins the essentials for a clean 5v5: restart the round, pause and unpause the match (players are held at spawn with a freeze-time restart), and back up / restore the team score so a mis-click never costs the map. Every command is flag-gated and announced in chat.</p><h2>Features</h2><ul><li><code>amx_restart</code> / <code>/restart</code> - instant round restart.</li><li><code>amx_pause</code> / <code>amx_unpause</code> - freeze-time pause and resume with a HUD notice.</li><li><code>amx_backupscore</code> / <code>amx_restorescore</code> - saves and re-broadcasts the TeamScore.</li></ul><h2>Installation</h2><ol><li>Enable the <code>cstrike</code> module.</li><li>Compile, install, add to <code>plugins.ini</code>, change map.</li></ol> |
addons/amxmodx/scripting/csb_classic_round_control.sma
A
| @@ -0,0 +1,199 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Classic Round Control | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Match-admin round control for classic 5v5 servers: restart the round, pause | |
| 6 | + * and unpause the match (players are frozen at spawn with a freeze-time | |
| 7 | + * restart), and back up / restore the team score so a mis-restart never loses | |
| 8 | + * the map. Every command is flag-gated and announced in chat. | |
| 9 | + * | |
| 10 | + * This program is free software: you can redistribute it and/or modify it | |
| 11 | + * under the terms of the GNU General Public License as published by the Free | |
| 12 | + * Software Foundation, either version 3 of the License, or (at your option) | |
| 13 | + * any later version. It is distributed in the hope that it will be useful, | |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | |
| 16 | + * Public License for more details: <https://www.gnu.org/licenses/>. | |
| 17 | + */ | |
| 18 | + | |
| 19 | +#include <amxmodx> | |
| 20 | +#include <amxmisc> | |
| 21 | +#include <cstrike> | |
| 22 | + | |
| 23 | +new const PLUGIN[] = "CSB Classic Round Control" | |
| 24 | +new const VERSION[] = "1.0.0" | |
| 25 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 26 | + | |
| 27 | +new g_pEnabled, g_pFreezeTime | |
| 28 | + | |
| 29 | +new bool:g_bPaused = false | |
| 30 | +new g_iSavedFreeze = 6 | |
| 31 | + | |
| 32 | +new g_iScoreCT = 0 | |
| 33 | +new g_iScoreT = 0 | |
| 34 | +new bool:g_bHasBackup = false | |
| 35 | +new g_iBackupCT = 0 | |
| 36 | +new g_iBackupT = 0 | |
| 37 | + | |
| 38 | +public plugin_init() | |
| 39 | +{ | |
| 40 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 41 | + | |
| 42 | + g_pEnabled = register_cvar("csb_roundctl_enabled", "1") | |
| 43 | + g_pFreezeTime = get_cvar_pointer("mp_freezetime") | |
| 44 | + | |
| 45 | + register_clcmd("amx_restart", "cmdRestart", ADMIN_LEVEL_A, "- restart the current round") | |
| 46 | + register_clcmd("say /restart", "cmdRestart", ADMIN_LEVEL_A, "- restart the current round") | |
| 47 | + register_clcmd("amx_pause", "cmdPause", ADMIN_LEVEL_A, "- pause the match at the next round") | |
| 48 | + register_clcmd("amx_unpause", "cmdUnpause", ADMIN_LEVEL_A, "- resume a paused match") | |
| 49 | + register_clcmd("say /pause", "cmdPause", ADMIN_LEVEL_A, "- pause the match at the next round") | |
| 50 | + register_clcmd("say /unpause", "cmdUnpause", ADMIN_LEVEL_A, "- resume a paused match") | |
| 51 | + register_clcmd("amx_backupscore", "cmdBackup", ADMIN_LEVEL_A, "- save the current team score") | |
| 52 | + register_clcmd("amx_restorescore", "cmdRestore", ADMIN_LEVEL_A, "- restore the saved team score") | |
| 53 | + | |
| 54 | + register_event("TeamScore", "evTeamScore", "a") | |
| 55 | +} | |
| 56 | + | |
| 57 | +/* Track the live team score so a backup has something to save. */ | |
| 58 | +public evTeamScore() | |
| 59 | +{ | |
| 60 | + new team[4] | |
| 61 | + read_data(1, team, charsmax(team)) | |
| 62 | + new score = read_data(2) | |
| 63 | + | |
| 64 | + if (team[0] == 'C' && team[1] == 'T') | |
| 65 | + g_iScoreCT = score | |
| 66 | + else if (team[0] == 'T') | |
| 67 | + g_iScoreT = score | |
| 68 | +} | |
| 69 | + | |
| 70 | +public cmdRestart(id, level, cid) | |
| 71 | +{ | |
| 72 | + if (!cmd_access(id, level, cid, 1)) | |
| 73 | + return PLUGIN_HANDLED | |
| 74 | + | |
| 75 | + if (!get_pcvar_num(g_pEnabled)) | |
| 76 | + { | |
| 77 | + client_print(id, print_chat, "[CSB] Round control is disabled (csb_roundctl_enabled 0).") | |
| 78 | + return PLUGIN_HANDLED | |
| 79 | + } | |
| 80 | + | |
| 81 | + server_cmd("sv_restartround 1") | |
| 82 | + announce(id, "restarted the round") | |
| 83 | + return PLUGIN_HANDLED | |
| 84 | +} | |
| 85 | + | |
| 86 | +public cmdPause(id, level, cid) | |
| 87 | +{ | |
| 88 | + if (!cmd_access(id, level, cid, 1)) | |
| 89 | + return PLUGIN_HANDLED | |
| 90 | + | |
| 91 | + if (g_bPaused) | |
| 92 | + { | |
| 93 | + client_print(id, print_chat, "[CSB] The match is already paused.") | |
| 94 | + return PLUGIN_HANDLED | |
| 95 | + } | |
| 96 | + | |
| 97 | + if (g_pFreezeTime) | |
| 98 | + g_iSavedFreeze = get_pcvar_num(g_pFreezeTime) | |
| 99 | + | |
| 100 | + g_bPaused = true | |
| 101 | + | |
| 102 | + /* A long freeze time + restart holds everyone at spawn until unpause. */ | |
| 103 | + if (g_pFreezeTime) | |
| 104 | + set_pcvar_num(g_pFreezeTime, 9999) | |
| 105 | + server_cmd("sv_restartround 1") | |
| 106 | + | |
| 107 | + announce(id, "paused the match") | |
| 108 | + set_hudmessage(255, 160, 0, -1.0, 0.30, 0, 0.0, 3.0, 0.0, 0.0, -1) | |
| 109 | + show_hudmessage(0, "MATCH PAUSED^nWaiting for an admin to resume...") | |
| 110 | + return PLUGIN_HANDLED | |
| 111 | +} | |
| 112 | + | |
| 113 | +public cmdUnpause(id, level, cid) | |
| 114 | +{ | |
| 115 | + if (!cmd_access(id, level, cid, 1)) | |
| 116 | + return PLUGIN_HANDLED | |
| 117 | + | |
| 118 | + if (!g_bPaused) | |
| 119 | + { | |
| 120 | + client_print(id, print_chat, "[CSB] The match is not paused.") | |
| 121 | + return PLUGIN_HANDLED | |
| 122 | + } | |
| 123 | + | |
| 124 | + g_bPaused = false | |
| 125 | + | |
| 126 | + if (g_pFreezeTime) | |
| 127 | + set_pcvar_num(g_pFreezeTime, g_iSavedFreeze) | |
| 128 | + server_cmd("sv_restartround 1") | |
| 129 | + | |
| 130 | + announce(id, "resumed the match") | |
| 131 | + set_hudmessage(0, 255, 120, -1.0, 0.30, 0, 0.0, 3.0, 0.0, 0.0, -1) | |
| 132 | + show_hudmessage(0, "LIVE!^nMatch resumed.") | |
| 133 | + return PLUGIN_HANDLED | |
| 134 | +} | |
| 135 | + | |
| 136 | +public cmdBackup(id, level, cid) | |
| 137 | +{ | |
| 138 | + if (!cmd_access(id, level, cid, 1)) | |
| 139 | + return PLUGIN_HANDLED | |
| 140 | + | |
| 141 | + g_iBackupCT = g_iScoreCT | |
| 142 | + g_iBackupT = g_iScoreT | |
| 143 | + g_bHasBackup = true | |
| 144 | + | |
| 145 | + new what[64] | |
| 146 | + formatex(what, charsmax(what), "backed up the score (CT %d - %d T)", g_iBackupCT, g_iBackupT) | |
| 147 | + announce(id, what) | |
| 148 | + return PLUGIN_HANDLED | |
| 149 | +} | |
| 150 | + | |
| 151 | +public cmdRestore(id, level, cid) | |
| 152 | +{ | |
| 153 | + if (!cmd_access(id, level, cid, 1)) | |
| 154 | + return PLUGIN_HANDLED | |
| 155 | + | |
| 156 | + if (!g_bHasBackup) | |
| 157 | + { | |
| 158 | + client_print(id, print_chat, "[CSB] There is no saved score to restore. Use amx_backupscore first.") | |
| 159 | + return PLUGIN_HANDLED | |
| 160 | + } | |
| 161 | + | |
| 162 | + sendTeamScore("CT", g_iBackupCT) | |
| 163 | + sendTeamScore("TERRORIST", g_iBackupT) | |
| 164 | + | |
| 165 | + g_iScoreCT = g_iBackupCT | |
| 166 | + g_iScoreT = g_iBackupT | |
| 167 | + | |
| 168 | + new what[64] | |
| 169 | + formatex(what, charsmax(what), "restored the score (CT %d - %d T)", g_iBackupCT, g_iBackupT) | |
| 170 | + announce(id, what) | |
| 171 | + return PLUGIN_HANDLED | |
| 172 | +} | |
| 173 | + | |
| 174 | +/* Re-broadcast a team's scoreboard number. */ | |
| 175 | +sendTeamScore(const team[], score) | |
| 176 | +{ | |
| 177 | + message_begin(MSG_ALL, get_user_msgid("TeamScore")) | |
| 178 | + write_string(team) | |
| 179 | + write_short(score) | |
| 180 | + message_end() | |
| 181 | +} | |
| 182 | + | |
| 183 | +announce(id, const what[]) | |
| 184 | +{ | |
| 185 | + new aname[32], buf[192] | |
| 186 | + get_user_name(id, aname, charsmax(aname)) | |
| 187 | + formatex(buf, charsmax(buf), "^x04[CSB]^x03 %s^x01 %s.", aname, what) | |
| 188 | + | |
| 189 | + new players[32], num, msgid = get_user_msgid("SayText") | |
| 190 | + get_players(players, num, "ch") | |
| 191 | + | |
| 192 | + for (new i = 0; i < num; i++) | |
| 193 | + { | |
| 194 | + message_begin(MSG_ONE, msgid, _, players[i]) | |
| 195 | + write_byte(players[i]) | |
| 196 | + write_string(buf) | |
| 197 | + message_end() | |
| 198 | + } | |
| 199 | +} |
csb.json
A
| @@ -0,0 +1,47 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Classic Round Control", | |
| 3 | + "category": "classic", | |
| 4 | + "tags": "restart, pause, unpause, score backup, match admin", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Classic Round Control", | |
| 10 | + "short_desc": "Match-admin round tools: restart, pause/unpause (freeze at spawn), and back up / restore the team score.", | |
| 11 | + "version": "1.0.0", | |
| 12 | + "amxx_min": "1.8.2", | |
| 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": "cstrike", | |
| 20 | + "install_notes": "1. Enable the cstrike module in addons/amxmodx/configs/modules.ini\n2. Compile the .sma (or use the site compiler) and put the .amxx in addons/amxmodx/plugins/\n3. Add csb_classic_round_control.amxx to addons/amxmodx/configs/plugins.ini\n4. Change the map. Pause uses mp_freezetime, which is restored on unpause.", | |
| 21 | + "known_conflicts": "", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_roundctl_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Master enable toggle for the round commands." | |
| 27 | + } | |
| 28 | + ], | |
| 29 | + "commands": [ | |
| 30 | + { | |
| 31 | + "name": "amx_restart / say /restart", | |
| 32 | + "access": "ADMIN_LEVEL_A", | |
| 33 | + "description": "Restart the current round." | |
| 34 | + }, | |
| 35 | + { | |
| 36 | + "name": "amx_pause / amx_unpause", | |
| 37 | + "access": "ADMIN_LEVEL_A", | |
| 38 | + "description": "Pause and resume the match." | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + "name": "amx_backupscore / amx_restorescore", | |
| 42 | + "access": "ADMIN_LEVEL_A", | |
| 43 | + "description": "Save and restore the team score." | |
| 44 | + } | |
| 45 | + ], | |
| 46 | + "main": "addons/amxmodx/scripting/csb_classic_round_control.sma" | |
| 47 | +} | |
| 0 | 48 |









