#include <amxmodx>
#if AMXX_VERSION_NUM < 183
#define argbreak strbreak
#define client_disconnected client_disconnect
#endif
new WebSite[256]
new g_Cvar[6], g_admin
new Float:HudUpdateInterval
public plugin_init()
{
g_Cvar[1] = register_cvar("hudbar_random_color", "0")
g_Cvar[2] = register_cvar("hudbar_color", "255 255 255")
g_Cvar[3] = register_cvar("hudbar_xypos", "-1.0 0.0")
g_Cvar[4] = register_cvar("hudbar_update", "1.0")
g_Cvar[5] = register_cvar("hudbar_web_site", "https://vk.com/e1337ace")
HudUpdateInterval = get_pcvar_float(g_Cvar[4])
}
public client_putinserver(id)
{
set_task(HudUpdateInterval, "HudBar", id, _, _, "b")
if (get_user_flags(id) & ADMIN_BAN)
g_admin ++
}
public client_disconnected(id)
{
if (get_user_flags(id) & ADMIN_BAN)
g_admin --
}
public HudBar(id)
{
static buffer[256], len, SyncHudMsg
if (!SyncHudMsg) SyncHudMsg = CreateHudSyncObj()
get_pcvar_string(g_Cvar[5], WebSite, 255)
len = format(buffer, charsmax(buffer), "Кол-во админов онлайн: %d", g_admin)
len += format(buffer[len], charsmax(buffer) - len, "^nНаша группа: %s", WebSite)
static r, g, b, Float:x, Float:y
HudMsgPos(x, y); HudMsgColor(g_Cvar[2], r, g, b)
if (get_pcvar_num(g_Cvar[1]) == 0) set_hudmessage(r, g, b, x, y, 0, 0.0, HudUpdateInterval, _, _, -1)
else set_hudmessage(random_num(0, 255), random_num(0, 255), random_num(0, 255), x, y, 0, 0.0, HudUpdateInterval, _, _, -1)
ShowSyncHudMsg(id, SyncHudMsg, "%s", buffer)
}
stock HudMsgPos(&Float:x, &Float:y)
{
static coords[16], piece[10]
get_pcvar_string(g_Cvar[3], coords, sizeof(coords) -1)
argbreak(coords, piece, sizeof(piece) -1, coords, sizeof(coords) -1)
x = str_to_float(piece), y = str_to_float(coords)
}
stock HudMsgColor(cvar, &r, &g, &b)
{
static color[16], piece[5]
get_pcvar_string(cvar, color, sizeof(color) -1)
argbreak(color, piece, sizeof(piece) -1, color, sizeof(color) -1)
r = str_to_num(piece)
argbreak(color, piece, sizeof(piece) -1, color, sizeof(color) -1)
g = str_to_num(piece), b = str_to_num(color)
}