/* * CSB Match Warmup * Copyright (C) 2026 counter-strike-boost.com * * A pre-match warmup: while it is active every player respawns instantly on * death, gets full money, armour and a free weapon set. The warmup ends when * everyone has typed /ready or an admin runs amx_match; the plugin then restores * the saved match money cvar and restarts the round so the game goes live clean. * * 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 Match Warmup" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new g_pEnabled, g_pMoney new bool:g_bWarmup new bool:g_bReady[33] new g_iSavedMoney new g_iSync public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_wu_enabled", "1") g_pMoney = register_cvar("csb_wu_money", "16000") RegisterHam(Ham_Spawn, "player", "fwSpawnPost", 1) register_event("DeathMsg", "eventDeath", "a", "1>0") register_clcmd("say /ready", "cmdReady") register_clcmd("say_team /ready", "cmdReady") register_clcmd("say /notready", "cmdNotReady") register_concmd("amx_match", "cmdMatch", ADMIN_LEVEL_A, "- force the warmup to end and go live") g_iSync = CreateHudSyncObj() set_task(1.0, "taskHud", 0, _, _, "b") } public plugin_cfg() { g_iSavedMoney = get_cvar_num("mp_startmoney") if (get_pcvar_num(g_pEnabled)) startWarmup() } startWarmup() { g_bWarmup = true for (new i = 1; i <= 32; i++) g_bReady[i] = false client_print(0, print_chat, "[CSB] WARMUP started. Type /ready when you are set.") } public client_putinserver(id) { g_bReady[id] = false } public fwSpawnPost(id) { if (!g_bWarmup || !is_user_alive(id)) return new team = cs_get_user_team(id) if (team != CS_TEAM_T && team != CS_TEAM_CT) return cs_set_user_money(id, get_pcvar_num(g_pMoney)) set_user_armor(id, 100) give_item(id, "weapon_hegrenade") give_item(id, "weapon_flashbang") if (team == CS_TEAM_T) give_item(id, "weapon_ak47") else give_item(id, "weapon_m4a1") give_item(id, "weapon_deagle") } public eventDeath() { if (!g_bWarmup) return new victim = read_data(2) if (victim >= 1 && victim <= 32) set_task(1.0, "taskRespawn", victim) } public taskRespawn(id) { if (g_bWarmup && is_user_connected(id) && !is_user_alive(id)) { new team = cs_get_user_team(id) if (team == CS_TEAM_T || team == CS_TEAM_CT) ExecuteHamB(Ham_CS_RoundRespawn, id) } } public cmdReady(id) { if (!g_bWarmup) { client_print(id, print_chat, "[CSB] The match is already live.") return PLUGIN_HANDLED } g_bReady[id] = true new name[32] get_user_name(id, name, charsmax(name)) client_print(0, print_chat, "[CSB] %s is ready.", name) checkAllReady() return PLUGIN_HANDLED } public cmdNotReady(id) { if (g_bWarmup) { g_bReady[id] = false client_print(id, print_chat, "[CSB] You are marked NOT ready.") } return PLUGIN_HANDLED } checkAllReady() { new players[32], num get_players(players, num, "ch") if (num == 0) return for (new i = 0; i < num; i++) { if (!g_bReady[players[i]]) return } endWarmup() } public cmdMatch(id, level, cid) { if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED if (!g_bWarmup) { console_print(id, "[CSB] No warmup is running.") return PLUGIN_HANDLED } endWarmup() return PLUGIN_HANDLED } endWarmup() { g_bWarmup = false set_cvar_num("mp_startmoney", g_iSavedMoney) client_print(0, print_chat, "[CSB] Warmup over. LIVE on restart!") set_cvar_num("sv_restart", 3) } public taskHud() { if (!g_bWarmup) return new players[32], num, ready = 0 get_players(players, num, "ch") for (new i = 0; i < num; i++) { if (g_bReady[players[i]]) ready++ } set_hudmessage(0, 255, 100, 0.02, 0.30, 0, 0.0, 1.2, 0.0, 0.0, -1) ShowSyncHudMsg(0, g_iSync, "WARMUP - %d / %d ready (say /ready)", ready, num) }