/*
* CSB Target Info
* Copyright (C) 2026 counter-strike-boost.com
*
* When a player aims at a teammate the plugin resolves the aimed entity with
* get_user_aiming and, if it is a living teammate, shows that teammate's name,
* health and armor in a small HUD refreshed a few times per second. Enemies are
* never revealed, so the plugin gives no wallhack-style advantage.
*
* 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 Target Info"
new const VERSION[] = "1.0.0"
new const AUTHOR[] = "counter-strike-boost.com"
new g_pEnabled, g_pMaxDist
new bool:g_bShow[33]
new g_iSync
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_pEnabled = register_cvar("csb_tinfo_enabled", "1")
g_pMaxDist = register_cvar("csb_tinfo_maxdist", "2000")
register_clcmd("say /tinfo", "cmdToggle")
register_clcmd("say_team /tinfo", "cmdToggle")
g_iSync = CreateHudSyncObj()
set_task(0.25, "taskInfo", 0, _, _, "b")
}
public client_putinserver(id)
{
g_bShow[id] = true
}
public cmdToggle(id)
{
g_bShow[id] = !g_bShow[id]
client_print(id, print_chat, "[CSB] Teammate info HUD %s.", g_bShow[id] ? "enabled" : "disabled")
return PLUGIN_HANDLED
}
public taskInfo()
{
if (!get_pcvar_num(g_pEnabled))
return
new dist = get_pcvar_num(g_pMaxDist)
new players[32], num, id
get_players(players, num, "a")
for (new i = 0; i < num; i++)
{
id = players[i]
if (!g_bShow[id])
continue
new ent, body
get_user_aiming(id, ent, body, dist)
if (ent < 1 || ent > 32 || ent == id)
continue
if (!is_user_alive(ent))
continue
/* only show teammates, never enemies */
if (get_user_team(id) != get_user_team(ent))
continue
new name[32]
get_user_name(ent, name, charsmax(name))
new hp = get_user_health(ent)
new ap = get_user_armor(ent)
new r = 0, g = 200, b = 0
if (hp <= 33)
{
r = 255
g = 60
b = 60
}
else if (hp <= 66)
{
r = 255
g = 200
b = 0
}
set_hudmessage(r, g, b, 0.02, 0.55, 0, 0.0, 0.30, 0.0, 0.0, -1)
ShowSyncHudMsg(id, g_iSync, "%s^nHP %d AP %d", name, hp, ap)
}
}