/*
* CSB Deathmatch Respawn
* Copyright (C) 2026 counter-strike-boost.com
*
* A lightweight CSDM-style deathmatch core: players respawn after a short,
* configurable delay, receive temporary spawn protection (godmode + a glow
* shell) and get their backpack ammo topped up so the action never stops.
*
* Inspired by CSDM (Counter-Strike Deathmatch) by Alfred "BAILOPAN" Reynolds
* and the AMX Mod X team. This is an independent GPL re-implementation written
* from scratch against fakemeta/hamsandwich, not a copy of their source.
*
* 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. Distributed WITHOUT ANY WARRANTY. See the GNU General
* Public License for more details: .
*/
#include
#include
#include
#include
#include
new const PLUGIN[] = "CSB Deathmatch Respawn"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
#define TASK_RESPAWN 7000
#define TASK_PROTECT 8000
#define is_valid_id(%1) (1 <= %1 && %1 <= g_iMaxPlayers)
new g_pEnabled, g_pDelay, g_pProtect, g_pArmor, g_pRefill
new bool:g_bProtected[33]
new g_iMaxPlayers
// weapon -> backpack ammo the refill tops players up to
new const g_iRefill[][2] =
{
{ CSW_AK47, 90 }, { CSW_M4A1, 90 }, { CSW_AWP, 30 }, { CSW_DEAGLE, 35 },
{ CSW_MP5NAVY, 120 }, { CSW_M3, 32 }, { CSW_XM1014, 32 }, { CSW_SCOUT, 90 },
{ CSW_SG552, 90 }, { CSW_AUG, 90 }, { CSW_P90, 100 }, { CSW_UMP45, 100 },
{ CSW_MAC10, 100 }, { CSW_TMP, 100 }, { CSW_GALIL, 90 }, { CSW_FAMAS, 90 },
{ CSW_USP, 24 }, { CSW_GLOCK18, 40 }, { CSW_P228, 52 }, { CSW_FIVESEVEN, 100 },
{ CSW_ELITE, 120 }, { CSW_M249, 200 }
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_csdm_enabled", "1")
g_pDelay = register_cvar("csb_csdm_respawn_delay", "1.5")
g_pProtect = register_cvar("csb_csdm_protection", "3.0")
g_pArmor = register_cvar("csb_csdm_armor", "100")
g_pRefill = register_cvar("csb_csdm_refill", "1")
RegisterHam(Ham_Killed, "player", "fwPlayerKilled", 1)
RegisterHam(Ham_Spawn, "player", "fwPlayerSpawnPost", 1)
g_iMaxPlayers = get_maxplayers()
}
public client_disconnected(id)
{
g_bProtected[id] = false
remove_task(id + TASK_RESPAWN)
remove_task(id + TASK_PROTECT)
}
public fwPlayerKilled(victim, attacker, shouldgib)
{
if (!get_pcvar_num(g_pEnabled) || !is_valid_id(victim))
return
if (!onPlayingTeam(victim))
return
remove_task(victim + TASK_RESPAWN)
set_task(get_pcvar_float(g_pDelay), "taskRespawn", victim + TASK_RESPAWN)
}
public taskRespawn(taskid)
{
new id = taskid - TASK_RESPAWN
if (!is_user_connected(id) || is_user_alive(id) || !onPlayingTeam(id))
return
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
public fwPlayerSpawnPost(id)
{
if (!get_pcvar_num(g_pEnabled) || !is_user_alive(id) || !onPlayingTeam(id))
return
new armor = get_pcvar_num(g_pArmor)
if (armor > 0)
set_user_armor(id, armor)
if (get_pcvar_num(g_pRefill))
refillAmmo(id)
new Float:prot = get_pcvar_float(g_pProtect)
if (prot > 0.0)
{
g_bProtected[id] = true
set_user_godmode(id, 1)
set_user_rendering(id, kRenderFxGlowShell, 0, 128, 255, kRenderNormal, 16)
remove_task(id + TASK_PROTECT)
set_task(prot, "taskUnprotect", id + TASK_PROTECT)
}
}
public taskUnprotect(taskid)
{
new id = taskid - TASK_PROTECT
if (!is_user_connected(id))
return
g_bProtected[id] = false
set_user_godmode(id, 0)
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 16)
}
refillAmmo(id)
{
new weapons = pev(id, pev_weapons)
for (new i = 0; i < sizeof(g_iRefill); i++)
{
new csw = g_iRefill[i][0]
if (weapons & (1 << csw))
cs_set_user_bpammo(id, csw, g_iRefill[i][1])
}
}
bool:onPlayingTeam(id)
{
new CsTeams:team = cs_get_user_team(id)
return (team == CS_TEAM_T || team == CS_TEAM_CT)
}