Код
#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
#define HITGROUP_GEAR 10 // alerts NPC, but doesn't do damage or bleed (1/100th damage)
public Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroadcast)
{
static String:s[128];
static String:nick[32];
new victim = GetClientOfUserId(GetEventInt(event, "userid"));
new flags = GetUserFlagBits(victim);
if (!(flags & ADMFLAG_BAN) && !(flags & ADMFLAG_ROOT)) {
return;
}
switch (GetEventInt(event, "hitgroup"))
{
case HITGROUP_GENERIC: s = "общий ущерб?";
case HITGROUP_HEAD: s = "голова";
case HITGROUP_CHEST: s = "грудь";
case HITGROUP_STOMACH: s = "живот";
case HITGROUP_LEFTARM: s = "левая рука";
case HITGROUP_RIGHTARM: s = "правая рука";
case HITGROUP_LEFTLEG: s = "левая нога";
case HITGROUP_RIGHTLEG: s = "правая нога";
case HITGROUP_GEAR: s = "попали по оружию в руках?";
default: s = "неизвестно";
}
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if (attacker < 1 || !GetClientName(attacker, nick, sizeof(nick)))
strcopy(nick, sizeof(nick), "unknown");
PrintToChat(victim,
"В вас попал \"%s\" повреждение \"%s\" снес \"%d ХП\"",
nick, s, GetEventInt(event, "dmg_health"));
}