/* * CSB Team Status * Copyright (C) 2026 counter-strike-boost.com * * Displays live alive-counts for both teams, and optionally each teammate's * health, in a HUD. It refreshes on death and spawn events and on a slow task. * A cvar restricts the HUD to dead players and spectators so it does not clutter * the screen of players who are still in the 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 new const PLUGIN[] = "CSB Team Status" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" #define TEAM_T 1 #define TEAM_CT 2 new g_pEnabled, g_pDeadOnly, g_pShowHp new g_iSync public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_tstatus_enabled", "1") g_pDeadOnly = register_cvar("csb_tstatus_deadonly", "1") g_pShowHp = register_cvar("csb_tstatus_showhp", "1") register_event("DeathMsg", "eventUpdate", "a", "1>0") register_event("ResetHUD", "eventUpdate", "b") g_iSync = CreateHudSyncObj() set_task(1.0, "taskUpdate", 0, _, _, "b") } public eventUpdate() { set_task(0.1, "taskUpdate") } countAlive(team) { new players[32], num, alive = 0 get_players(players, num, "ae") for (new i = 0; i < num; i++) { if (get_user_team(players[i]) == team) alive++ } return alive } buildHpLine(viewer, out[], len) { out[0] = 0 if (!get_pcvar_num(g_pShowHp)) return new team = get_user_team(viewer) if (team != TEAM_T && team != TEAM_CT) return new players[32], num get_players(players, num, "ae") new written = 0 for (new i = 0; i < num && written < 6; i++) { new id = players[i] if (get_user_team(id) != team) continue new name[16] get_user_name(id, name, charsmax(name)) new piece[48] formatex(piece, charsmax(piece), "%s: %d^n", name, get_user_health(id)) add(out, len, piece) written++ } } public taskUpdate() { if (!get_pcvar_num(g_pEnabled)) return new tAlive = countAlive(TEAM_T) new ctAlive = countAlive(TEAM_CT) new bool:deadOnly = get_pcvar_num(g_pDeadOnly) != 0 new players[32], num, id get_players(players, num, "c") for (new i = 0; i < num; i++) { id = players[i] if (deadOnly && is_user_alive(id)) continue new msg[256] formatex(msg, charsmax(msg), "T %d vs CT %d^n", tAlive, ctAlive) new hpLine[192] buildHpLine(id, hpLine, charsmax(hpLine)) if (hpLine[0]) add(msg, charsmax(msg), hpLine) set_hudmessage(180, 220, 255, 0.02, 0.30, 0, 0.0, 1.1, 0.0, 0.0, -1) ShowSyncHudMsg(id, g_iSync, "%s", msg) } }