Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 259 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_pause.sma
+208 -0
A
csb.json
+47 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-09-03) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Pause</strong> is a clean tactical pause for scrims and matches. A player types <code>/pause</code> and the freeze takes effect at the <strong>end of the current round</strong> (never mid-round, so nobody gains an advantage). While paused, <code>mp_freezetime</code> is raised, players are clamped to <code>maxspeed 1</code>, firing is blocked with a <code>Ham_Weapon_PrimaryAttack</code> supercede, and a red <em>MATCH PAUSED</em> HUD is shown.</p><h2>Features</h2><ul><li><code>/pause</code> queues the freeze for the end of the round; <code>/unpause</code> resumes.</li><li>A three-second resume countdown shown in the centre of the screen.</li><li>Firing is genuinely blocked (Ham supercede on every weapon), not just movement.</li><li>Per-team pause limit via <code>csb_pause_maxperteam</code> so it cannot be abused.</li><li>Round restart on resume so both teams start the round clean.</li></ul><h2>Installation</h2><ol><li>Make sure the <code>hamsandwich</code> and <code>fun</code> modules are enabled in <code>modules.ini</code> (both are by default).</li><li>Compile, copy <code>csb_pause.amxx</code> into <code>addons/amxmodx/plugins/</code> and add it to <code>plugins.ini</code>.</li><li>Change the map.</li></ol><h2>Notes</h2><p>Because the freeze is applied at round end and released with a restart, it plays nicely with round-based match plugins. The <code>maxspeed 1</code> clamp is refreshed twice a second so a respawn cannot undo it.</p> |
addons/amxmodx/scripting/csb_pause.sma
A
| @@ -0,0 +1,208 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Pause | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * Match pause tool. /pause freezes the game at the end of the current round: | |
| 6 | + * players are clamped to maxspeed 1, firing is blocked with a Ham | |
| 7 | + * Weapon_PrimaryAttack supercede, and a "MATCH PAUSED" HUD is shown. /unpause | |
| 8 | + * runs a short countdown and resumes. Pauses are limited per team. | |
| 9 | + * | |
| 10 | + * This program is free software: you can redistribute it and/or modify it under | |
| 11 | + * the terms of the GNU General Public License as published by the Free Software | |
| 12 | + * Foundation, either version 3 of the License, or (at your option) any later | |
| 13 | + * version. It is distributed in the hope that it will be useful, but WITHOUT ANY | |
| 14 | + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |
| 15 | + * A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details. | |
| 16 | + */ | |
| 17 | + | |
| 18 | +#include <amxmodx> | |
| 19 | +#include <hamsandwich> | |
| 20 | +#include <fun> | |
| 21 | + | |
| 22 | +new const PLUGIN[] = "CSB Pause" | |
| 23 | +new const VERSION[] = "1.0.0" | |
| 24 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 25 | + | |
| 26 | +#define TASK_FREEZE 5300 | |
| 27 | +#define TASK_RESUME 5400 | |
| 28 | + | |
| 29 | +new bool:g_bPaused | |
| 30 | +new bool:g_bPendingPause | |
| 31 | +new bool:g_bResuming | |
| 32 | +new g_iPauseUsed[3] /* index by team: 1 = T, 2 = CT */ | |
| 33 | +new g_iResumeLeft | |
| 34 | + | |
| 35 | +new g_pEnabled, g_pMaxPerTeam | |
| 36 | + | |
| 37 | +new const g_szWeapons[][] = | |
| 38 | +{ | |
| 39 | + "weapon_p228", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", | |
| 40 | + "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", | |
| 41 | + "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", | |
| 42 | + "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", | |
| 43 | + "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", | |
| 44 | + "weapon_tmp", "weapon_g3sg1", "weapon_deagle", "weapon_sg552", | |
| 45 | + "weapon_ak47", "weapon_knife", "weapon_p90", "weapon_flashbang" | |
| 46 | +} | |
| 47 | + | |
| 48 | +public plugin_init() | |
| 49 | +{ | |
| 50 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 51 | + | |
| 52 | + g_pEnabled = register_cvar("csb_pause_enabled", "1") | |
| 53 | + g_pMaxPerTeam = register_cvar("csb_pause_maxperteam", "2") | |
| 54 | + | |
| 55 | + register_clcmd("say /pause", "cmdPause") | |
| 56 | + register_clcmd("say_team /pause", "cmdPause") | |
| 57 | + register_clcmd("say /unpause", "cmdUnpause") | |
| 58 | + register_clcmd("say_team /unpause", "cmdUnpause") | |
| 59 | + | |
| 60 | + for (new i = 0; i < sizeof(g_szWeapons); i++) | |
| 61 | + RegisterHam(Ham_Weapon_PrimaryAttack, g_szWeapons[i], "fwPrimaryAttack") | |
| 62 | + | |
| 63 | + register_event("HLTV", "eNewRound", "a", "1=0", "2=0") | |
| 64 | + set_task(0.5, "taskFreeze", TASK_FREEZE, _, _, "b") | |
| 65 | +} | |
| 66 | + | |
| 67 | +public cmdPause(id) | |
| 68 | +{ | |
| 69 | + if (!get_pcvar_num(g_pEnabled)) | |
| 70 | + return PLUGIN_HANDLED | |
| 71 | + | |
| 72 | + new team = get_user_team(id) | |
| 73 | + | |
| 74 | + if (team != 1 && team != 2) | |
| 75 | + { | |
| 76 | + client_print(id, print_chat, "[CSB] Only players in a team can pause.") | |
| 77 | + return PLUGIN_HANDLED | |
| 78 | + } | |
| 79 | + | |
| 80 | + if (g_bPaused || g_bPendingPause) | |
| 81 | + { | |
| 82 | + client_print(id, print_chat, "[CSB] A pause is already active or pending.") | |
| 83 | + return PLUGIN_HANDLED | |
| 84 | + } | |
| 85 | + | |
| 86 | + new maxPer = get_pcvar_num(g_pMaxPerTeam) | |
| 87 | + | |
| 88 | + if (maxPer > 0 && g_iPauseUsed[team] >= maxPer) | |
| 89 | + { | |
| 90 | + client_print(id, print_chat, "[CSB] Your team has used all %d pause(s).", maxPer) | |
| 91 | + return PLUGIN_HANDLED | |
| 92 | + } | |
| 93 | + | |
| 94 | + g_iPauseUsed[team]++ | |
| 95 | + g_bPendingPause = true | |
| 96 | + | |
| 97 | + new name[32] | |
| 98 | + get_user_name(id, name, charsmax(name)) | |
| 99 | + chatAll("^x04[CSB]^x03 %s^x01 requested a pause - it will start at the end of this round.", name) | |
| 100 | + | |
| 101 | + return PLUGIN_HANDLED | |
| 102 | +} | |
| 103 | + | |
| 104 | +public cmdUnpause(id) | |
| 105 | +{ | |
| 106 | + if (!g_bPaused || g_bResuming) | |
| 107 | + return PLUGIN_HANDLED | |
| 108 | + | |
| 109 | + new team = get_user_team(id) | |
| 110 | + | |
| 111 | + if (team != 1 && team != 2) | |
| 112 | + return PLUGIN_HANDLED | |
| 113 | + | |
| 114 | + g_bResuming = true | |
| 115 | + g_iResumeLeft = 3 | |
| 116 | + | |
| 117 | + new name[32] | |
| 118 | + get_user_name(id, name, charsmax(name)) | |
| 119 | + chatAll("^x04[CSB]^x03 %s^x01 un-paused - resuming in 3...", name) | |
| 120 | + | |
| 121 | + set_task(1.0, "taskResume", TASK_RESUME, _, _, "a", 3) | |
| 122 | + return PLUGIN_HANDLED | |
| 123 | +} | |
| 124 | + | |
| 125 | +public taskResume() | |
| 126 | +{ | |
| 127 | + g_iResumeLeft-- | |
| 128 | + | |
| 129 | + if (g_iResumeLeft > 0) | |
| 130 | + { | |
| 131 | + client_print(0, print_center, "Resuming in %d...", g_iResumeLeft) | |
| 132 | + return | |
| 133 | + } | |
| 134 | + | |
| 135 | + g_bPaused = false | |
| 136 | + g_bResuming = false | |
| 137 | + unfreezeAll() | |
| 138 | + chatAll("^x04[CSB]^x01 *** MATCH RESUMED *** GO!") | |
| 139 | + server_cmd("sv_restartround 1") | |
| 140 | +} | |
| 141 | + | |
| 142 | +public eNewRound() | |
| 143 | +{ | |
| 144 | + if (g_bPendingPause && !g_bPaused) | |
| 145 | + { | |
| 146 | + g_bPendingPause = false | |
| 147 | + g_bPaused = true | |
| 148 | + set_cvar_num("mp_freezetime", 9999) | |
| 149 | + chatAll("^x04[CSB]^x01 *** MATCH PAUSED *** type /unpause when both teams are ready.") | |
| 150 | + } | |
| 151 | +} | |
| 152 | + | |
| 153 | +public taskFreeze() | |
| 154 | +{ | |
| 155 | + if (!g_bPaused) | |
| 156 | + return | |
| 157 | + | |
| 158 | + set_hudmessage(255, 40, 40, -1.0, 0.30, 0, 0.0, 0.6, 0.0, 0.0, -1) | |
| 159 | + show_hudmessage(0, "MATCH PAUSED^ntype /unpause to resume") | |
| 160 | + | |
| 161 | + new players[32], num, pid | |
| 162 | + get_players(players, num, "ae") | |
| 163 | + | |
| 164 | + for (new i = 0; i < num; i++) | |
| 165 | + { | |
| 166 | + pid = players[i] | |
| 167 | + set_user_maxspeed(pid, 1.0) | |
| 168 | + } | |
| 169 | +} | |
| 170 | + | |
| 171 | +unfreezeAll() | |
| 172 | +{ | |
| 173 | + set_cvar_num("mp_freezetime", 0) | |
| 174 | + | |
| 175 | + new players[32], num, pid | |
| 176 | + get_players(players, num, "ae") | |
| 177 | + | |
| 178 | + for (new i = 0; i < num; i++) | |
| 179 | + { | |
| 180 | + pid = players[i] | |
| 181 | + set_user_maxspeed(pid, -1.0) /* -1 restores the default weapon speed */ | |
| 182 | + } | |
| 183 | +} | |
| 184 | + | |
| 185 | +public fwPrimaryAttack(weapon) | |
| 186 | +{ | |
| 187 | + if (g_bPaused) | |
| 188 | + return HAM_SUPERCEDE | |
| 189 | + | |
| 190 | + return HAM_IGNORED | |
| 191 | +} | |
| 192 | + | |
| 193 | +chatAll(const fmt[], any:...) | |
| 194 | +{ | |
| 195 | + new msg[192] | |
| 196 | + vformat(msg, charsmax(msg), fmt, 2) | |
| 197 | + | |
| 198 | + new players[32], num, msgid = get_user_msgid("SayText") | |
| 199 | + get_players(players, num, "ch") | |
| 200 | + | |
| 201 | + for (new i = 0; i < num; i++) | |
| 202 | + { | |
| 203 | + message_begin(MSG_ONE, msgid, _, players[i]) | |
| 204 | + write_byte(players[i]) | |
| 205 | + write_string(msg) | |
| 206 | + message_end() | |
| 207 | + } | |
| 208 | +} |
csb.json
A
| @@ -0,0 +1,47 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Pause", | |
| 3 | + "category": "match", | |
| 4 | + "tags": "pause, unpause, match", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Pause", | |
| 10 | + "short_desc": "/pause freezes the match at the end of the round - maxspeed 1, blocked fire and a MATCH PAUSED HUD - with a countdown /unpause and a per-team limit.", | |
| 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": "hamsandwich,fun", | |
| 20 | + "install_notes": "1. Ensure the hamsandwich and fun modules are enabled in modules.ini\n2. Put csb_pause.amxx in addons/amxmodx/plugins/\n3. Add it to plugins.ini\n4. Change map", | |
| 21 | + "known_conflicts": "Other pause plugins will fight over mp_freezetime - run only one.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_pause_enabled", | |
| 25 | + "default": "1", | |
| 26 | + "description": "Enable or disable the pause system." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_pause_maxperteam", | |
| 30 | + "default": "2", | |
| 31 | + "description": "How many pauses each team may call (0 = unlimited)." | |
| 32 | + } | |
| 33 | + ], | |
| 34 | + "commands": [ | |
| 35 | + { | |
| 36 | + "name": "say /pause", | |
| 37 | + "access": "", | |
| 38 | + "description": "Queue a pause for the end of the current round." | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + "name": "say /unpause", | |
| 42 | + "access": "", | |
| 43 | + "description": "Resume the match after a three-second countdown." | |
| 44 | + } | |
| 45 | + ], | |
| 46 | + "main": "addons/amxmodx/scripting/csb_pause.sma" | |
| 47 | +} | |
| 0 | 48 |









