/*
* CSB Shotgun Arena
* Copyright (C) 2026 counter-strike-boost.com
*
* Shotgun-only rounds. Everyone spawns with an XM1014 or an M3 (cvar), a knife
* and unlimited reserve ammo, buying is blocked, and an optional knockback push
* is applied on every hit through pev_velocity so fights feel punchy. Death
* triggers an instant respawn.
*
* 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 Shotgun Arena"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled, g_pWeapon, g_pKnockback, g_pRespawn
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_shotgun_enabled", "1")
g_pWeapon = register_cvar("csb_shotgun_weapon", "1") /* 1 = XM1014, 0 = M3 */
g_pKnockback = register_cvar("csb_shotgun_knockback", "6.0")
g_pRespawn = register_cvar("csb_shotgun_respawn", "2.0")
RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1)
RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage", 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")
if (get_pcvar_num(g_pWeapon))
{
give_item(id, "weapon_xm1014")
cs_set_user_bpammo(id, CSW_XM1014, 32)
}
else
{
give_item(id, "weapon_m3")
cs_set_user_bpammo(id, CSW_M3, 32)
}
}
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)
if ((wpn == CSW_XM1014 || wpn == CSW_M3) && ammo < 8)
cs_set_user_bpammo(id, wpn, 32)
}
public fwTakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
if (!get_pcvar_num(g_pEnabled))
return HAM_IGNORED
new Float:power = get_pcvar_float(g_pKnockback)
if (power <= 0.0)
return HAM_IGNORED
if (attacker < 1 || attacker > 32 || attacker == victim || !is_user_alive(victim))
return HAM_IGNORED
static Float:fVic[3], Float:fAtt[3], Float:fDir[3]
pev(victim, pev_origin, fVic)
pev(attacker, pev_origin, fAtt)
fDir[0] = fVic[0] - fAtt[0]
fDir[1] = fVic[1] - fAtt[1]
new Float:len = floatsqroot(fDir[0]*fDir[0] + fDir[1]*fDir[1])
if (len < 1.0)
return HAM_IGNORED
static Float:fVel[3]
pev(victim, pev_velocity, fVel)
fVel[0] += fDir[0] / len * damage * power
fVel[1] += fDir[1] / len * damage * power
fVel[2] += damage * power * 0.3
set_pev(victim, pev_velocity, fVel)
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
}