/* * CSB Last Man Standing * Copyright (C) 2026 counter-strike-boost.com * * When only one player is left alive on a team the plugin buffs them: extra HP, a * team-coloured glow, a HUD marker and a private count of the enemies that * remain. All buffs are cleared at the start of the next round. * * 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 Last Man Standing" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new g_pEnabled, g_pBonusHp, g_pGlow new bool:g_bBuffed[33] new g_iSync public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_lms_enabled", "1") g_pBonusHp = register_cvar("csb_lms_bonushp", "50") g_pGlow = register_cvar("csb_lms_glow", "1") register_event("DeathMsg", "evDeath", "a", "1>0") register_logevent("evRoundStart", 2, "1=Round_Start") g_iSync = CreateHudSyncObj() set_task(1.0, "taskHud", 0, _, _, "b") } public client_putinserver(id) { g_bBuffed[id] = false } public evRoundStart() { new players[32], num get_players(players, num, "a") for (new i = 0; i < num; i++) clearBuff(players[i]) } public evDeath() { if (!get_pcvar_num(g_pEnabled)) return checkTeam(1) checkTeam(2) } checkTeam(team) { new players[32], num, alive = 0, last = 0 get_players(players, num, "ae") for (new i = 0; i < num; i++) { if (get_user_team(players[i]) == team) { alive++ last = players[i] } } if (alive == 1 && last && !g_bBuffed[last]) buff(last, team) } buff(id, team) { g_bBuffed[id] = true new bonus = get_pcvar_num(g_pBonusHp) set_user_health(id, get_user_health(id) + bonus) if (get_pcvar_num(g_pGlow)) { if (team == 1) set_user_rendering(id, kRenderFxGlowShell, 255, 60, 60, kRenderNormal, 16) else set_user_rendering(id, kRenderFxGlowShell, 60, 120, 255, kRenderNormal, 16) } new enemies = countTeam((team == 1) ? 2 : 1) new name[32] get_user_name(id, name, charsmax(name)) client_print(0, print_chat, "[CSB LMS] %s is the last one standing! +%d HP.", name, bonus) client_print(id, print_chat, "[CSB LMS] %d enemy player(s) remain.", enemies) } countTeam(team) { new players[32], num, c = 0 get_players(players, num, "ae") for (new i = 0; i < num; i++) if (get_user_team(players[i]) == team) c++ return c } clearBuff(id) { if (g_bBuffed[id]) { g_bBuffed[id] = false set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0) } } public taskHud() { new players[32], num get_players(players, num, "ae") for (new i = 0; i < num; i++) { new p = players[i] if (g_bBuffed[p]) { set_hudmessage(255, 220, 0, -1.0, 0.75, 0, 0.0, 1.1, 0.0, 0.0, -1) ShowSyncHudMsg(p, g_iSync, "LAST MAN STANDING") } } }