Counts usercmds per real second and flags players whose command rate stays impossibly high.
csb_speedhack_detect.sma v1.0.0
1
/*
2
* CSB Speedhack Detection
3
* Copyright (C) 2026 counter-strike-boost.com
4
*
5
* Counts usercmd frames per real second (from CmdStart) and compares them to a
6
* sane ceiling. A speedhack inflates the command rate; sustained excess over
7
* several strikes is logged and optionally kicked.
8
*
9
* This program is free software: you can redistribute it and/or modify it under
10
* the terms of the GNU General Public License as published by the Free Software
11
* Foundation, either version 3 of the License, or (at your option) any later
12
* version. It is distributed in the hope that it will be useful, but WITHOUT
13
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
* FOR A PARTICULAR PURPOSE. See <https://www.gnu.org/licenses/> for details.
15
*/
16
17
#include <amxmodx>
18
#include <fakemeta>
19
20
new const PLUGIN[] = "CSB Speedhack Detection"
21
new const VERSION[] = "1.0.0"
22
new const AUTHOR[] = "counter-strike-boost.com"
23
24
new g_pEnabled, g_pMaxCmds, g_pStrikes, g_pAction
25
26
new g_iFrames[33]
27
new g_iStrikes[33]
28
29
public plugin_init()
30
{
31
register_plugin(PLUGIN, VERSION, AUTHOR)
32
33
g_pEnabled = register_cvar("csb_speed_enabled", "1")
34
g_pMaxCmds = register_cvar("csb_speed_maxcmds", "350")
35
g_pStrikes = register_cvar("csb_speed_strikes", "3")
36
g_pAction = register_cvar("csb_speed_action", "0")
37
38
register_forward(FM_CmdStart, "fwCmdStart")
39
set_task(1.0, "taskCheck", 0, _, _, "b")
40
}
41
42
public client_putinserver(id)
43
{
44
g_iFrames[id] = 0
45
g_iStrikes[id] = 0
46
}
47
48
public fwCmdStart(id)
49
{
50
if (id >= 1 && id <= 32)
51
g_iFrames[id]++
52
53
return FMRES_IGNORED
54
}
55
56
public taskCheck()
57
{
58
if (!get_pcvar_num(g_pEnabled))
59
return
60
61
new maxCmds = get_pcvar_num(g_pMaxCmds)
62
new maxStrikes = get_pcvar_num(g_pStrikes)
63
64
new players[32], num
65
get_players(players, num, "c") // connected humans only
66
67
for (new i = 0; i < num; i++)
68
{
69
new id = players[i]
70
new frames = g_iFrames[id]
71
g_iFrames[id] = 0
72
73
if (frames > maxCmds)
74
{
75
g_iStrikes[id]++
76
77
log_amx("[CSB Speed] %d usercmds/s from slot %d (strike %d/%d)", frames, id, g_iStrikes[id], maxStrikes)
78
79
if (g_iStrikes[id] >= maxStrikes)
80
{
81
punish(id, frames)
82
g_iStrikes[id] = 0
83
}
84
}
85
else if (g_iStrikes[id] > 0)
86
{
87
// decay: one clean second forgives one strike
88
g_iStrikes[id]--
89
}
90
}
91
}
92
93
punish(id, frames)
94
{
95
new name[32], authid[35]
96
get_user_name(id, name, charsmax(name))
97
get_user_authid(id, authid, charsmax(authid))
98
99
log_amx("[CSB Speed] speedhack confirmed for %s <%s> (%d usercmds/s)", name, authid, frames)
100
101
if (get_pcvar_num(g_pAction) == 1)
102
{
103
server_cmd("kick #%d ^"CSB: speedhack detected^"", get_user_userid(id))
104
server_exec()
105
}
106
else
107
{
108
client_print(0, print_chat, "[CSB] %s is suspected of using a speedhack.", name)
109
}
110
}
111









