/*
* CSB No Fall Damage
* Copyright (C) 2026 counter-strike-boost.com
*
* Cancels or scales fall damage. It hooks Ham_TakeDamage and, when the damage
* type carries the DMG_FALL bit, either blocks the damage entirely or multiplies
* it by a cvar. Players holding an exempt admin flag can be left unaffected, and
* a short sound plays on a blocked hard landing as feedback.
*
* 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
#include
new const PLUGIN[] = "CSB No Fall Damage"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
/* GoldSrc damage bit for falling */
#if !defined DMG_FALL
#define DMG_FALL (1<<5)
#endif
new g_pEnabled, g_pMult, g_pSound
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_nofall_enabled", "1")
g_pMult = register_cvar("csb_nofall_mult", "0.0")
g_pSound = register_cvar("csb_nofall_sound", "1")
RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage")
}
public plugin_precache()
{
precache_sound("common/wpn_hudoff.wav")
}
public fwTakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
if (!get_pcvar_num(g_pEnabled))
return HAM_IGNORED
if (!(damagebits & DMG_FALL))
return HAM_IGNORED
if (!is_user_alive(victim))
return HAM_IGNORED
new Float:mult = get_pcvar_float(g_pMult)
if (mult <= 0.0)
{
if (get_pcvar_num(g_pSound))
emit_sound(victim, CHAN_ITEM, "common/wpn_hudoff.wav", 1.0, 0.8, 0, 100)
return HAM_SUPERCEDE
}
SetHamParamFloat(4, damage * mult)
return HAM_IGNORED
}