Hello!
I want to write a plugin that when getting into the hands of dropped weapons. Here is the code:
Code:
public PlayerHurtEvent(Handle:event, const String:name[], bool:dontBroadcast)
{
if (GetConVarInt(g_Cvar_Enable))
{
new client = GetClientOfUserId(GetEventInt(event, "userid"))
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"))
if (client > 0)
{
if (attacker > 0)
{
new String:weapon[64]
GetEventString(event, "weapon", weapon, 64)
new hitgroup = GetEventInt(event, "hitgroup")
new damage = GetEventInt(event, "damage")
new String:attacker_name[64]
GetClientName(attacker, attacker_name, 64)
// Hitgroups
// 1 = Head
// 2 = Upper Chest
// 3 = Lower Chest
// 4 = Left arm
// 5 = Right arm
// 6 = Left leg
// 7 = Right Leg
if ((hitgroup == 4) || (hitgroup == 5))
{
PrintToChatAll("hand")
ForceWeaponDrop(attacker)
}
if (hitgroup == 1)
{
PrintToChatAll("hand")
}
}
}
}
}
Runs only if you kill a man in the arm...How to make it to run when hit in the arm?