/*
* CSB Respawn Waves
* Copyright (C) 2026 counter-strike-boost.com
*
* Respawns dead players in timed waves instead of instantly. Every N seconds all
* dead players are brought back with Ham_CS_RoundRespawn, up to a maximum number
* of waves per round, and dead players see a HUD countdown to the next wave. Keeps
* a round flowing on deathmatch-style servers without full 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
new const PLUGIN[] = "CSB Respawn Waves"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled, g_pInterval, g_pMaxWaves
new Float:g_fNextWave
new g_iWavesLeft
new g_iHudSync
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_waves_enabled", "1")
g_pInterval = register_cvar("csb_waves_interval", "10")
g_pMaxWaves = register_cvar("csb_waves_max", "3")
register_logevent("eventRoundStart", 2, "1=Round_Start")
g_iHudSync = CreateHudSyncObj()
set_task(1.0, "taskTick", 0, _, _, "b")
}
public eventRoundStart()
{
if (!get_pcvar_num(g_pEnabled))
return
g_iWavesLeft = get_pcvar_num(g_pMaxWaves)
g_fNextWave = get_gametime() + get_pcvar_float(g_pInterval)
}
public taskTick()
{
if (!get_pcvar_num(g_pEnabled) || g_iWavesLeft <= 0)
return
new Float:left = g_fNextWave - get_gametime()
if (left <= 0.0)
{
doWave()
g_fNextWave = get_gametime() + get_pcvar_float(g_pInterval)
g_iWavesLeft--
return
}
/* HUD countdown to the dead */
new players[32], num
get_players(players, num, "b") /* dead players */
for (new i = 0; i < num; i++)
{
new id = players[i]
if (get_user_team(id) != 1 && get_user_team(id) != 2)
continue
set_hudmessage(255, 255, 255, -1.0, 0.65, 0, 0.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(id, g_iHudSync, "Next respawn wave in %d...", floatround(left, floatround_ceil))
}
}
doWave()
{
new players[32], num
get_players(players, num, "b")
new count = 0
for (new i = 0; i < num; i++)
{
new id = players[i]
if (get_user_team(id) != 1 && get_user_team(id) != 2)
continue
if (!is_user_alive(id))
{
ExecuteHamB(Ham_CS_RoundRespawn, id)
count++
}
}
if (count > 0)
client_print(0, print_chat, "^x04[Waves]^x01 Respawn wave! %d player(s) back in.", count)
}