Initial release 1.0.0
Browse Source1.0.0 - Initial release.
4 changed files
with 245 additions and 0 deletions
A
CHANGELOG.md
+3 -0
A
README.md
+1 -0
A
addons/amxmodx/scripting/csb_admin_freeze.sma
+194 -0
A
csb.json
+47 -0
CHANGELOG.md
A
| @@ -0,0 +1,3 @@ | ||
| 1 | +## 1.0.0 (2025-10-26) | |
| 2 | + | |
| 3 | +1.0.0 - Initial release. |
README.md
A
| @@ -0,0 +1 @@ | ||
| 1 | +<p><strong>CSB Admin Freeze</strong> pins a player where they stand. <code>amx_freeze <target> [seconds]</code> raises the engine <code>FL_FROZEN</code> flag and forces <code>pev_maxspeed</code> to 1.0, tints the target's screen blue with a short fade and starts a timer that unfreezes them automatically. <code>amx_unfreeze <target></code> restores the stored maxspeed immediately.</p><p>Inspired by the freeze command from the AMX Mod X Admin Commands plugin. Independent GPL re-implementation.</p><h2>Features</h2><ul><li><code>amx_freeze <target> [seconds]</code> with a default and a hard cap from cvars.</li><li>Real engine freeze via <code>FL_FROZEN</code> plus <code>pev_maxspeed</code> = 1.0 (belt and braces).</li><li>Original maxspeed stored per player and restored on unfreeze.</li><li>Blue <code>ScreenFade</code> so the target knows they were frozen.</li><li>Auto-unfreeze task, and safe cleanup on disconnect.</li></ul><h2>Installation</h2><ol><li>Enable the <code>fakemeta</code> module in <code>addons/amxmodx/configs/modules.ini</code>.</li><li>Compile <code>csb_admin_freeze.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><p>Both commands need the <code>ADMIN_SLAY</code> flag (<code>m</code>) by default.</p> |
addons/amxmodx/scripting/csb_admin_freeze.sma
A
| @@ -0,0 +1,194 @@ | ||
| 1 | +/* | |
| 2 | + * CSB Admin Freeze | |
| 3 | + * Copyright (C) 2026 counter-strike-boost.com | |
| 4 | + * | |
| 5 | + * amx_freeze <target> [seconds] locks a player in place by raising the engine | |
| 6 | + * FL_FROZEN flag and pinning pev_maxspeed to 1.0, with a blue screen fade and a | |
| 7 | + * timed automatic unfreeze. amx_unfreeze restores the stored maxspeed at once. | |
| 8 | + * | |
| 9 | + * Inspired by the freeze command from the AMX Mod X Admin Commands plugin | |
| 10 | + * (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 | +#include <fakemeta> | |
| 23 | + | |
| 24 | +new const PLUGIN[] = "CSB Admin Freeze" | |
| 25 | +new const VERSION[] = "1.0.0" | |
| 26 | +new const AUTHOR[] = "counter-strike-boost.com" | |
| 27 | + | |
| 28 | +#define FL_FROZEN (1<<16) | |
| 29 | +#define TASK_UNFREEZE 7100 | |
| 30 | + | |
| 31 | +new bool:g_bFrozen[33] | |
| 32 | +new Float:g_fOldSpeed[33] | |
| 33 | +new g_pDefault, g_pMax | |
| 34 | +new g_msgScreenFade | |
| 35 | + | |
| 36 | +public plugin_init() | |
| 37 | +{ | |
| 38 | + register_plugin(PLUGIN, VERSION, AUTHOR) | |
| 39 | + | |
| 40 | + g_pDefault = register_cvar("csb_freeze_default", "5") | |
| 41 | + g_pMax = register_cvar("csb_freeze_max", "60") | |
| 42 | + | |
| 43 | + register_concmd("amx_freeze", "cmdFreeze", ADMIN_SLAY, "<target> [seconds] - freeze a player in place") | |
| 44 | + register_concmd("amx_unfreeze", "cmdUnfreeze", ADMIN_SLAY, "<target> - unfreeze a player") | |
| 45 | + | |
| 46 | + g_msgScreenFade = get_user_msgid("ScreenFade") | |
| 47 | +} | |
| 48 | + | |
| 49 | +public client_disconnected(id) | |
| 50 | +{ | |
| 51 | + if (g_bFrozen[id]) | |
| 52 | + { | |
| 53 | + g_bFrozen[id] = false | |
| 54 | + remove_task(id + TASK_UNFREEZE) | |
| 55 | + } | |
| 56 | +} | |
| 57 | + | |
| 58 | +doFreeze(target) | |
| 59 | +{ | |
| 60 | + if (g_bFrozen[target]) | |
| 61 | + return | |
| 62 | + | |
| 63 | + g_fOldSpeed[target] = pev(target, pev_maxspeed) | |
| 64 | + g_bFrozen[target] = true | |
| 65 | + | |
| 66 | + set_pev(target, pev_maxspeed, 1.0) | |
| 67 | + set_pev(target, pev_flags, pev(target, pev_flags) | FL_FROZEN) | |
| 68 | + | |
| 69 | + message_begin(MSG_ONE, g_msgScreenFade, _, target) | |
| 70 | + write_short(1 << 12) | |
| 71 | + write_short(1 << 12) | |
| 72 | + write_short(0x0004) | |
| 73 | + write_byte(20) | |
| 74 | + write_byte(20) | |
| 75 | + write_byte(180) | |
| 76 | + write_byte(160) | |
| 77 | + message_end() | |
| 78 | +} | |
| 79 | + | |
| 80 | +doUnfreeze(target) | |
| 81 | +{ | |
| 82 | + if (!g_bFrozen[target]) | |
| 83 | + return | |
| 84 | + | |
| 85 | + g_bFrozen[target] = false | |
| 86 | + remove_task(target + TASK_UNFREEZE) | |
| 87 | + | |
| 88 | + if (!is_user_connected(target)) | |
| 89 | + return | |
| 90 | + | |
| 91 | + set_pev(target, pev_flags, pev(target, pev_flags) & ~FL_FROZEN) | |
| 92 | + | |
| 93 | + new Float:restore = g_fOldSpeed[target] | |
| 94 | + if (restore < 1.0) | |
| 95 | + restore = 250.0 | |
| 96 | + | |
| 97 | + set_pev(target, pev_maxspeed, restore) | |
| 98 | +} | |
| 99 | + | |
| 100 | +public taskUnfreeze(taskid) | |
| 101 | +{ | |
| 102 | + new target = taskid - TASK_UNFREEZE | |
| 103 | + | |
| 104 | + if (target >= 1 && target <= 32) | |
| 105 | + { | |
| 106 | + doUnfreeze(target) | |
| 107 | + | |
| 108 | + if (is_user_connected(target)) | |
| 109 | + client_print(target, print_chat, "[CSB] You have been unfrozen.") | |
| 110 | + } | |
| 111 | +} | |
| 112 | + | |
| 113 | +public cmdFreeze(id, level, cid) | |
| 114 | +{ | |
| 115 | + if (!cmd_access(id, level, cid, 2)) | |
| 116 | + return PLUGIN_HANDLED | |
| 117 | + | |
| 118 | + new arg[32] | |
| 119 | + read_argv(1, arg, charsmax(arg)) | |
| 120 | + | |
| 121 | + new target = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY) | |
| 122 | + if (!target) | |
| 123 | + return PLUGIN_HANDLED | |
| 124 | + | |
| 125 | + if (!is_user_alive(target)) | |
| 126 | + { | |
| 127 | + client_print(id, print_chat, "[CSB] That player is not alive.") | |
| 128 | + return PLUGIN_HANDLED | |
| 129 | + } | |
| 130 | + | |
| 131 | + new seconds = get_pcvar_num(g_pDefault) | |
| 132 | + if (read_argc() > 2) | |
| 133 | + { | |
| 134 | + new sArg[8] | |
| 135 | + read_argv(2, sArg, charsmax(sArg)) | |
| 136 | + new n = str_to_num(sArg) | |
| 137 | + if (n > 0) | |
| 138 | + seconds = n | |
| 139 | + } | |
| 140 | + | |
| 141 | + new maxSec = get_pcvar_num(g_pMax) | |
| 142 | + if (maxSec > 0 && seconds > maxSec) | |
| 143 | + seconds = maxSec | |
| 144 | + | |
| 145 | + doFreeze(target) | |
| 146 | + | |
| 147 | + remove_task(target + TASK_UNFREEZE) | |
| 148 | + set_task(float(seconds), "taskUnfreeze", target + TASK_UNFREEZE) | |
| 149 | + | |
| 150 | + new aname[32], tname[32] | |
| 151 | + getName(id, aname, charsmax(aname)) | |
| 152 | + get_user_name(target, tname, charsmax(tname)) | |
| 153 | + | |
| 154 | + client_print(0, print_chat, "[CSB] %s froze %s for %d second(s).", aname, tname, seconds) | |
| 155 | + log_amx("[CSB Freeze] %s froze %s for %d s", aname, tname, seconds) | |
| 156 | + return PLUGIN_HANDLED | |
| 157 | +} | |
| 158 | + | |
| 159 | +public cmdUnfreeze(id, level, cid) | |
| 160 | +{ | |
| 161 | + if (!cmd_access(id, level, cid, 2)) | |
| 162 | + return PLUGIN_HANDLED | |
| 163 | + | |
| 164 | + new arg[32] | |
| 165 | + read_argv(1, arg, charsmax(arg)) | |
| 166 | + | |
| 167 | + new target = cmd_target(id, arg, CMDTARGET_ALLOW_SELF) | |
| 168 | + if (!target) | |
| 169 | + return PLUGIN_HANDLED | |
| 170 | + | |
| 171 | + if (!g_bFrozen[target]) | |
| 172 | + { | |
| 173 | + client_print(id, print_chat, "[CSB] That player is not frozen.") | |
| 174 | + return PLUGIN_HANDLED | |
| 175 | + } | |
| 176 | + | |
| 177 | + doUnfreeze(target) | |
| 178 | + | |
| 179 | + new aname[32], tname[32] | |
| 180 | + getName(id, aname, charsmax(aname)) | |
| 181 | + get_user_name(target, tname, charsmax(tname)) | |
| 182 | + | |
| 183 | + client_print(0, print_chat, "[CSB] %s unfroze %s.", aname, tname) | |
| 184 | + log_amx("[CSB Freeze] %s unfroze %s", aname, tname) | |
| 185 | + return PLUGIN_HANDLED | |
| 186 | +} | |
| 187 | + | |
| 188 | +getName(id, name[], len) | |
| 189 | +{ | |
| 190 | + if (id) | |
| 191 | + get_user_name(id, name, len) | |
| 192 | + else | |
| 193 | + copy(name, len, "CONSOLE") | |
| 194 | +} |
csb.json
A
| @@ -0,0 +1,47 @@ | ||
| 1 | +{ | |
| 2 | + "name": "CSB Admin Freeze", | |
| 3 | + "category": "admin", | |
| 4 | + "tags": "freeze, punish, admin", | |
| 5 | + "image": "", | |
| 6 | + "original_author": "AMX Mod X Development Team (Admin Commands)", | |
| 7 | + "original_url": "", | |
| 8 | + "license": "GPL-3.0", | |
| 9 | + "title": "CSB Admin Freeze", | |
| 10 | + "short_desc": "amx_freeze locks a player in place with FL_FROZEN + maxspeed 1.0, a blue screen fade and a timed auto-unfreeze; amx_unfreeze restores at once.", | |
| 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": "fakemeta", | |
| 20 | + "install_notes": "1. Enable the fakemeta module in addons/amxmodx/configs/modules.ini\n2. Put csb_admin_freeze.amxx in addons/amxmodx/plugins/ and add it to plugins.ini\n3. Change map", | |
| 21 | + "known_conflicts": "Plugins that also set pev_maxspeed each frame (some run/speed mods) will undo the freeze.", | |
| 22 | + "cvars": [ | |
| 23 | + { | |
| 24 | + "name": "csb_freeze_default", | |
| 25 | + "default": "5", | |
| 26 | + "description": "Default freeze length in seconds when none is given." | |
| 27 | + }, | |
| 28 | + { | |
| 29 | + "name": "csb_freeze_max", | |
| 30 | + "default": "60", | |
| 31 | + "description": "Maximum freeze length in seconds (0 = no cap)." | |
| 32 | + } | |
| 33 | + ], | |
| 34 | + "commands": [ | |
| 35 | + { | |
| 36 | + "name": "amx_freeze", | |
| 37 | + "access": "m (ADMIN_SLAY)", | |
| 38 | + "description": "amx_freeze <target> [seconds] - freeze a player in place." | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + "name": "amx_unfreeze", | |
| 42 | + "access": "m (ADMIN_SLAY)", | |
| 43 | + "description": "amx_unfreeze <target> - unfreeze a player." | |
| 44 | + } | |
| 45 | + ], | |
| 46 | + "main": "addons/amxmodx/scripting/csb_admin_freeze.sma" | |
| 47 | +} | |
| 0 | 48 |









