Code:
http://pastebin.com/Mbrf7aZi
Any bIsWeapon which I forgot from the code above.
PHP Code:
stock bIsWeapon(client, any:char)
{
new weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
decl String:wepclassname[32];
if (weapon <= MaxClients || !IsValidEntity(weapon) || !GetEdictClassname(weapon, wepclassname, sizeof(wepclassname)))
{
strcopy(wepclassname, sizeof(wepclassname), "");
}
return (wepclassname[11] == char); // tf_weapon_sniperrifle all have 'n' in common that other sniper weapons don't
}
For some reason, this does not always send the message when headshotting someone who has a danger shield equipped.
What's wrong and how can I fix it?
Here's what I suspect:
1. My way of checking if they have a shield is broken
2. My way of detecting headshots is broken
3. TF wearables suck and are broken and it only acts if I have the actual index randomly
Removing the
TF2_IsPlayerInCondition(attacker, TFCond_Zoomed)
check changed nothing.
Unless reloading the plugin removes the OnTakeDamage hook, which it shouldn't considering it's added in OnPluginStart.
Edit: Added a check for body shots too, it's not running any code at all after GetIndexOfWeaponSlot
Also for some reason, after map change, it seems to have completely broken instead of only sometimes detecting it. Wat.
Also, using FindEntityByClassname and checking if the owner of the shield was the victim, had just about the same issue.
__________________