/*
* CSB Anti Boost
* Copyright (C) 2026 counter-strike-boost.com
*
* Stops players standing on each other's heads to reach places they should not.
* A task samples every player's ground entity; when a player has been standing
* on another player for longer than a grace period the plugin pushes them off
* (upward plus a shove away from the base player). Essential on Deathrun and HNS.
*
* 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 Anti Boost"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled, g_pGrace, g_pPush
new g_iOnHead[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_antiboost_enabled", "1")
g_pGrace = register_cvar("csb_antiboost_grace", "3")
g_pPush = register_cvar("csb_antiboost_push", "320")
set_task(0.4, "taskScan", 0, _, _, "b")
}
public client_putinserver(id)
{
g_iOnHead[id] = 0
}
public taskScan()
{
if (!get_pcvar_num(g_pEnabled))
return
new grace = get_pcvar_num(g_pGrace)
if (grace < 1)
grace = 1
new players[32], num
get_players(players, num, "ah")
for (new i = 0; i < num; i++)
{
new id = players[i]
new ground = pev(id, pev_groundentity)
if (ground >= 1 && ground <= 32 && ground != id && is_user_alive(ground))
{
g_iOnHead[id]++
/* the sampler runs at ~0.4s, so grace is roughly seconds/0.4 */
if (g_iOnHead[id] >= grace)
{
pushOff(id, ground)
g_iOnHead[id] = 0
}
}
else
{
g_iOnHead[id] = 0
}
}
}
pushOff(id, base)
{
static Float:fTop[3], Float:fBase[3], Float:fVel[3]
pev(id, pev_origin, fTop)
pev(base, pev_origin, fBase)
new Float:push = get_pcvar_float(g_pPush)
/* horizontal direction from base to the boosted player */
static Float:dir[3]
dir[0] = fTop[0] - fBase[0]
dir[1] = fTop[1] - fBase[1]
dir[2] = 0.0
new Float:len = floatsqroot(dir[0] * dir[0] + dir[1] * dir[1])
if (len < 1.0)
{
/* stacked dead-centre: shove in a fixed direction */
dir[0] = 1.0
dir[1] = 0.0
len = 1.0
}
fVel[0] = dir[0] / len * push
fVel[1] = dir[1] / len * push
fVel[2] = 260.0
set_pev(id, pev_velocity, fVel)
client_print(id, print_chat, "[CSB] No boosting on other players.")
}