/*
* CSB Match Score HUD
* Copyright (C) 2026 counter-strike-boost.com
*
* Shows a permanent match HUD: team scores tracked from TeamScore events, the
* current round number, a first/second-half indicator derived from mp_maxrounds,
* and each team's total money (economy state). The scores reset when a new game
* commences.
*
* 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 Match Score HUD"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled
new g_iScoreT, g_iScoreCT
new g_iRound
new g_iSync
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_scorehud_enabled", "1")
register_event("TeamScore", "evTeamScore", "a")
register_logevent("evRoundStart", 2, "1=Round_Start")
register_logevent("evGameCommencing", 2, "1=Game_Commencing")
g_iSync = CreateHudSyncObj()
set_task(1.0, "taskHud", 0, _, _, "b")
}
public evGameCommencing()
{
g_iScoreT = 0
g_iScoreCT = 0
g_iRound = 0
}
public evTeamScore()
{
new team[4]
read_data(1, team, charsmax(team))
new score = read_data(2)
if (team[0] == 'C') /* CT */
g_iScoreCT = score
else if (team[0] == 'T') /* TERRORIST */
g_iScoreT = score
}
public evRoundStart()
{
g_iRound++
}
teamMoney(team)
{
new sum = 0
new players[32], num
get_players(players, num, "e", team == 1 ? "TERRORIST" : "CT")
for (new i = 0; i < num; i++)
sum += cs_get_user_money(players[i])
return sum
}
public taskHud()
{
if (!get_pcvar_num(g_pEnabled))
return
new maxr = get_cvar_num("mp_maxrounds")
new half[12]
if (maxr > 0 && g_iRound > maxr / 2)
copy(half, charsmax(half), "2nd half")
else
copy(half, charsmax(half), "1st half")
new moneyT = teamMoney(1)
new moneyCT = teamMoney(2)
set_hudmessage(0, 210, 255, 0.02, 0.15, 0, 0.0, 1.2, 0.0, 0.0, -1)
ShowSyncHudMsg(0, g_iSync, "TERROR %d - %d CT^nRound %d (%s)^nEco: T $%d CT $%d",
g_iScoreT, g_iScoreCT, g_iRound, half, moneyT, moneyCT)
}