/* * CSB Speedhack Detection * Copyright (C) 2026 counter-strike-boost.com * * Counts usercmd frames per real second (from CmdStart) and compares them to a * sane ceiling. A speedhack inflates the command rate; sustained excess over * several strikes is logged and optionally kicked. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. It is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See for details. */ #include #include new const PLUGIN[] = "CSB Speedhack Detection" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new g_pEnabled, g_pMaxCmds, g_pStrikes, g_pAction new g_iFrames[33] new g_iStrikes[33] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_speed_enabled", "1") g_pMaxCmds = register_cvar("csb_speed_maxcmds", "350") g_pStrikes = register_cvar("csb_speed_strikes", "3") g_pAction = register_cvar("csb_speed_action", "0") register_forward(FM_CmdStart, "fwCmdStart") set_task(1.0, "taskCheck", 0, _, _, "b") } public client_putinserver(id) { g_iFrames[id] = 0 g_iStrikes[id] = 0 } public fwCmdStart(id) { if (id >= 1 && id <= 32) g_iFrames[id]++ return FMRES_IGNORED } public taskCheck() { if (!get_pcvar_num(g_pEnabled)) return new maxCmds = get_pcvar_num(g_pMaxCmds) new maxStrikes = get_pcvar_num(g_pStrikes) new players[32], num get_players(players, num, "c") // connected humans only for (new i = 0; i < num; i++) { new id = players[i] new frames = g_iFrames[id] g_iFrames[id] = 0 if (frames > maxCmds) { g_iStrikes[id]++ log_amx("[CSB Speed] %d usercmds/s from slot %d (strike %d/%d)", frames, id, g_iStrikes[id], maxStrikes) if (g_iStrikes[id] >= maxStrikes) { punish(id, frames) g_iStrikes[id] = 0 } } else if (g_iStrikes[id] > 0) { // decay: one clean second forgives one strike g_iStrikes[id]-- } } } punish(id, frames) { new name[32], authid[35] get_user_name(id, name, charsmax(name)) get_user_authid(id, authid, charsmax(authid)) log_amx("[CSB Speed] speedhack confirmed for %s <%s> (%d usercmds/s)", name, authid, frames) if (get_pcvar_num(g_pAction) == 1) { server_cmd("kick #%d ^"CSB: speedhack detected^"", get_user_userid(id)) server_exec() } else { client_print(0, print_chat, "[CSB] %s is suspected of using a speedhack.", name) } }