/* * CSB Boss Round * Copyright (C) 2026 counter-strike-boost.com * * Every N rounds a random player is turned into a boss: a big glowing model with * scaled health, a heavy weapon and a HUD health bar the whole server can see. * Incoming damage to the boss is scaled down in a Ham_TakeDamage hook so it takes * teamwork to bring down, and killing the boss pays a cash reward. * * 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 Boss Round" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new g_pEnabled, g_pInterval, g_pHpPerPlayer, g_pDmgScale, g_pReward new g_iRound new g_iBoss new g_iBossMaxHp new g_iHudSync public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_boss_enabled", "1") g_pInterval = register_cvar("csb_boss_interval", "5") g_pHpPerPlayer = register_cvar("csb_boss_hp_per_player", "400") g_pDmgScale = register_cvar("csb_boss_dmgscale", "0.5") g_pReward = register_cvar("csb_boss_reward", "8000") RegisterHam(Ham_TakeDamage, "player", "fwTakeDamage", 0) register_logevent("eventRoundStart", 2, "1=Round_Start") register_event("DeathMsg", "eventDeath", "a", "1>0") g_iHudSync = CreateHudSyncObj() set_task(0.5, "taskHud", 0, _, _, "b") } public client_disconnected(id) { if (g_iBoss == id) clearBoss() } public eventRoundStart() { clearBoss() if (!get_pcvar_num(g_pEnabled)) return g_iRound++ new interval = get_pcvar_num(g_pInterval) if (interval < 1) interval = 1 if (g_iRound % interval == 0) set_task(2.5, "taskPickBoss", 7373) } public taskPickBoss() { new players[32], num get_players(players, num, "a") if (num < 2) return new boss = players[random_num(0, num - 1)] makeBoss(boss, num) } makeBoss(id, playerCount) { g_iBoss = id g_iBossMaxHp = get_pcvar_num(g_pHpPerPlayer) * playerCount if (g_iBossMaxHp < 200) g_iBossMaxHp = 200 set_user_health(id, g_iBossMaxHp) set_pev(id, pev_scale, 1.3) set_user_rendering(id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 200) give_item(id, "weapon_m249") cs_set_user_bpammo(id, CSW_M249, 200) new name[32] get_user_name(id, name, charsmax(name)) client_print(0, print_chat, "^x04[Boss]^x01 %s is the BOSS this round with %d HP! Take them down!", name, g_iBossMaxHp) } clearBoss() { if (g_iBoss >= 1 && g_iBoss <= 32 && is_user_connected(g_iBoss)) { set_pev(g_iBoss, pev_scale, 1.0) set_user_rendering(g_iBoss, kRenderFxNone, 0, 0, 0, kRenderNormal, 0) } g_iBoss = 0 g_iBossMaxHp = 0 } public fwTakeDamage(victim, inflictor, attacker, Float:damage, damagebits) { if (g_iBoss == 0 || victim != g_iBoss) return HAM_IGNORED new Float:scale = get_pcvar_float(g_pDmgScale) if (scale <= 0.0) scale = 0.5 SetHamParamFloat(4, damage * scale) return HAM_IGNORED } public eventDeath() { new killer = read_data(1) new victim = read_data(2) if (victim != g_iBoss) return if (killer >= 1 && killer <= 32 && killer != victim && is_user_connected(killer)) { new reward = get_pcvar_num(g_pReward) new give = cs_get_user_money(killer) + reward if (give > 16000) give = 16000 cs_set_user_money(killer, give) new kn[32] get_user_name(killer, kn, charsmax(kn)) client_print(0, print_chat, "^x04[Boss]^x01 %s slayed the boss and earned $%d!", kn, reward) } else { client_print(0, print_chat, "^x04[Boss]^x01 The boss has fallen!") } clearBoss() } public taskHud() { if (g_iBoss == 0 || !is_user_alive(g_iBoss)) return new hp = get_user_health(g_iBoss) new pct = g_iBossMaxHp > 0 ? (hp * 100) / g_iBossMaxHp : 0 if (pct < 0) pct = 0 else if (pct > 100) pct = 100 new bar[24], filled = pct / 5 new p = 0 for (; p < filled && p < 20; p++) bar[p] = '|' bar[p] = 0 new name[32] get_user_name(g_iBoss, name, charsmax(name)) set_hudmessage(255, 0, 0, -1.0, 0.08, 0, 0.0, 0.6, 0.0, 0.0, -1) ShowSyncHudMsg(0, g_iHudSync, "BOSS %s [%s] %d%%", name, bar, pct) }