/*
* CSB ScoutzKnivez
* Copyright (C) 2026 counter-strike-boost.com
*
* The classic ScoutzKnivez mode. Everyone spawns with a Scout, a knife and
* unlimited reserve ammo, gravity is lowered for floaty jump-shots, buying is
* blocked and death triggers an instant respawn. Cvars control the gravity, a
* one-shot-kill option and an optional headshot-only rule.
*
* Inspired by ScoutzKnivez by Freecode. Independent GPL re-implementation.
*
* 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
#include
#include
new const PLUGIN[] = "CSB ScoutzKnivez"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
#define HIT_HEAD 1
new g_pEnabled, g_pGravity, g_pOneShot, g_pHsOnly, g_pRespawn
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_scoutz_enabled", "1")
g_pGravity = register_cvar("csb_scoutz_gravity", "0.5")
g_pOneShot = register_cvar("csb_scoutz_oneshot", "1")
g_pHsOnly = register_cvar("csb_scoutz_hsonly", "0")
g_pRespawn = register_cvar("csb_scoutz_respawn", "2.0")
RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1)
RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage", 0)
RegisterHam(Ham_TraceAttack, "player", "fwTraceAttack", 0)
register_event("DeathMsg", "eventDeath", "a", "1>0")
register_event("CurWeapon", "eventCurWeapon", "be", "1=1")
register_clcmd("buy", "blockBuy")
register_clcmd("buyammo", "blockBuy")
}
public fwSpawnPost(id)
{
if (get_pcvar_num(g_pEnabled) && is_user_alive(id))
set_task(0.2, "taskEquip", id)
}
public taskEquip(id)
{
if (!is_user_alive(id) || !get_pcvar_num(g_pEnabled))
return
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_scout")
cs_set_user_bpammo(id, CSW_SCOUT, 90)
set_user_gravity(id, get_pcvar_float(g_pGravity))
}
public eventCurWeapon(id)
{
if (!get_pcvar_num(g_pEnabled) || !is_user_alive(id))
return
new clip, ammo
new wpn = get_user_weapon(id, clip, ammo)
/* keep the scout topped up so ammo is effectively unlimited */
if (wpn == CSW_SCOUT && ammo < 30)
cs_set_user_bpammo(id, CSW_SCOUT, 90)
}
public fwTakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
if (!get_pcvar_num(g_pEnabled) || !get_pcvar_num(g_pOneShot))
return HAM_IGNORED
if (attacker < 1 || attacker > 32 || attacker == victim)
return HAM_IGNORED
if (damagebits & (DMG_BULLET | DMG_SLASH | DMG_NEVERGIB))
SetHamParamFloat(4, 1000.0)
return HAM_IGNORED
}
public fwTraceAttack(victim, attacker, Float:damage, Float:direction[3], ptr, damagebits)
{
if (!get_pcvar_num(g_pEnabled) || !get_pcvar_num(g_pHsOnly))
return HAM_IGNORED
if (attacker < 1 || attacker > 32 || !is_user_alive(victim))
return HAM_IGNORED
if (get_tr2(ptr, TR_iHitgroup) != HIT_HEAD)
{
SetHamParamFloat(3, 0.0)
return HAM_SUPERCEDE
}
return HAM_IGNORED
}
public eventDeath()
{
new victim = read_data(2)
if (!get_pcvar_num(g_pEnabled) || victim < 1 || victim > 32)
return
set_task(get_pcvar_float(g_pRespawn), "taskRespawn", victim)
}
public taskRespawn(id)
{
if (!is_user_connected(id) || is_user_alive(id))
return
if (get_user_team(id) == 1 || get_user_team(id) == 2)
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
public blockBuy(id)
{
if (get_pcvar_num(g_pEnabled))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}