/* * CSB HP Armor HUD * Copyright (C) 2026 counter-strike-boost.com * * A clean replacement HUD that shows the player's HP, armor, money and the * ammo of their current weapon in a configurable corner, with colour thresholds * on the HP. Refreshed on a short task, toggleable per player with /hud. Useful * on servers that hide the default HUD. * * 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 HP Armor HUD" new const VERSION[] = "1.0.0" new const AUTHOR[] = "counter-strike-boost.com" new g_pEnabled, g_pRefresh, g_pX, g_pY new g_iSync new bool:g_bShow[33] public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) g_pEnabled = register_cvar("csb_hud_enabled", "1") g_pRefresh = register_cvar("csb_hud_refresh", "0.3") g_pX = register_cvar("csb_hud_x", "0.02") g_pY = register_cvar("csb_hud_y", "0.85") register_clcmd("say /hud", "cmdToggle") register_clcmd("say_team /hud", "cmdToggle") g_iSync = CreateHudSyncObj() new Float:refresh = get_pcvar_float(g_pRefresh) if (refresh < 0.1) refresh = 0.1 set_task(refresh, "taskHud", 90, _, _, "b") } public client_putinserver(id) { g_bShow[id] = true } public cmdToggle(id) { g_bShow[id] = !g_bShow[id] client_print(id, print_chat, "[CSB] Custom HUD %s.", g_bShow[id] ? "enabled" : "disabled") return PLUGIN_HANDLED } public taskHud() { if (!get_pcvar_num(g_pEnabled)) return new Float:x = get_pcvar_float(g_pX) new Float:y = get_pcvar_float(g_pY) new players[32], num get_players(players, num, "ah") for (new i = 0; i < num; i++) { new id = players[i] if (!g_bShow[id]) continue new hp = get_user_health(id) new armor = get_user_armor(id) new money = cs_get_user_money(id) new clip, ammo new wpn = get_user_weapon(id, clip, ammo) new r, g, b if (hp <= 25) { r = 255; g = 40; b = 40 } else if (hp <= 60) { r = 255; g = 200; b = 40 } else { r = 40; g = 220; b = 90 } set_hudmessage(r, g, b, x, y, 0, 0.0, 1.0, 0.0, 0.0, -1) if (wpn > 0 && (clip >= 0 && ammo >= 0)) { ShowSyncHudMsg(id, g_iSync, "HP %d AP %d $%d AMMO %d/%d", hp, armor, money, clip, ammo) } else { ShowSyncHudMsg(id, g_iSync, "HP %d AP %d $%d", hp, armor, money) } } }