/*
* CSB Warmup Round
* Copyright (C) 2026 counter-strike-boost.com
*
* Runs a timed warmup when the map starts: instant respawn, free weapons and no
* score, with a HUD countdown. When the timer runs out the plugin restarts the
* round and resets the score, and the normal game begins.
*
* 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
new const PLUGIN[] = "CSB Warmup Round"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled, g_pDuration
new bool:g_bWarmup
new Float:g_fEndTime
new g_iHudSync
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_warmup_enabled", "1")
g_pDuration = register_cvar("csb_warmup_duration", "60")
RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1)
register_event("DeathMsg", "eventDeath", "a", "1>0")
g_iHudSync = CreateHudSyncObj()
}
public plugin_cfg()
{
if (get_pcvar_num(g_pEnabled))
startWarmup()
}
startWarmup()
{
g_bWarmup = true
g_fEndTime = get_gametime() + get_pcvar_float(g_pDuration)
client_print(0, print_chat, "^x04[Warmup]^x01 Warmup started - free weapons, no score for %d seconds.", get_pcvar_num(g_pDuration))
set_task(1.0, "taskTick", 4646, _, _, "b")
}
public taskTick()
{
if (!g_bWarmup)
{
remove_task(4646)
return
}
new Float:left = g_fEndTime - get_gametime()
if (left <= 0.0)
{
endWarmup()
return
}
set_hudmessage(255, 200, 0, -1.0, 0.15, 0, 0.0, 1.1, 0.0, 0.0, -1)
ShowSyncHudMsg(0, g_iHudSync, "WARMUP %d", floatround(left, floatround_ceil))
}
endWarmup()
{
g_bWarmup = false
remove_task(4646)
client_print(0, print_chat, "^x04[Warmup]^x01 Warmup over - the match begins now!")
/* reset scores and restart the round */
set_task(1.0, "taskRestart")
}
public taskRestart()
{
server_cmd("sv_restartround 2")
}
public fwSpawnPost(id)
{
if (!g_bWarmup || !is_user_alive(id))
return
set_task(0.2, "taskEquip", id)
}
public taskEquip(id)
{
if (!g_bWarmup || !is_user_alive(id))
return
new team = get_user_team(id)
strip_user_weapons(id)
give_item(id, "weapon_knife")
give_item(id, "weapon_hegrenade")
if (team == 1)
{
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
}
else if (team == 2)
{
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
}
}
public eventDeath()
{
new victim = read_data(2)
if (!g_bWarmup || victim < 1 || victim > 32)
return
/* no score during warmup: instant respawn */
set_task(1.5, "taskRespawn", victim)
}
public taskRespawn(id)
{
if (!g_bWarmup || !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)
}