Код:
#include <amxmodx>
#include <amxmisc>
#include <csx>
#include <cstrike>
public PlayerName
new g_status_sync
new g_friend[33]
new color1
new color2
new color3
public plugin_init() {
register_plugin("Players_status", "1.1", "xD");
register_event("StatusValue", "setTeam", "be", "1=1");
register_event("StatusValue", "showStatus", "be", "1=2", "2!0");
register_event("StatusValue", "hideStatus", "be", "1=1", "2=0");
g_status_sync = CreateHudSyncObj()
return PLUGIN_CONTINUE;
}
public hideStatus(id)
{
if (PlayerName)
{
ClearSyncHud(id, g_status_sync)
}
}
public setTeam(id)
g_friend[id] = read_data(2)
public showStatus(id)
{
if(!is_user_bot(id) && is_user_connected(id) && PlayerName)
{
new name[32], pid = read_data(2)
get_user_name(pid, name, 31)
if (get_user_team(pid) == 1)
color1 = 255
color2 = 0
color3 = 32
else
color1 = 0
color2 = 100
color3 = 255
if (g_friend[id] == 1) // friend
{
new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo)
new wpnname[32]
if (wpnid)
xmod_get_wpnname(wpnid, wpnname, 31)
set_hudmessage(color1, color2, color3, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1)
ShowSyncHudMsg(id, g_status_sync, "%s -- %d Здоровья", name, get_user_health(pid))
} else {
set_hudmessage(color1, color2, color3, -1.0, 0.60, 1, 0.01, 3.0, 0.01, 0.01, -1)
ShowSyncHudMsg(id, g_status_sync, "%s", name)
}
}
}