Detect Weapons in Hamsandwich Ham_TakeDamage
I am using
Code:
RegisterHam(Ham_TakeDamage,"player","ClientDamage")So, what I want to do is detect the weapon that was used to cause the damage within the ClientDamage function. Is this possible? If so, how? |
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Quote:
Code:
I also use !(bitDamage & DMG_GRENADE) to ignore grenade damage but not sure if this can be used to detect all weapons. |
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Thanks!
Do you have any idea what the difference between inflictor and attacker are? From what I could tell when I tested with several people spamming chat of who was: this, inflictor, attacker, etc; attacker and inflictor were always the same. |
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Quote:
/* * Ham_TakeDamage * Description: Usually called whenever an entity takes any kind of damage. * Inflictor is the entity that caused the damage (such as a gun). * Attacker is the entity that tirggered the damage (such as the gun's owner). * Forward params: function(this, idinflictor, idattacker, Float:damage, damagebits); * Return type: Integer. * Execute params: ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits); */ |
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Right. Should have read that one myself, considering I have the include open in notepad right now. :oops:
Still havn't gotten a chance to try get_user_weapon because I can't get my friends to join my server to experiment with it. :evil: It may just return inflictor. Thanks again. |
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Quote:
PHP Code:
|
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Why do you use get_user_attacker native when you have attacker passed in the forward ?
First check if attacker is a player ( 1 <= attacker <= maxplayer ) Then check if inflictor is equal to attacker. If it's equal, check get_user_weapon( attacker ) Else, inflictor is a nade or an another entity (may be created by another plugin ) In that case you can use fm_cs_get_grenadeid by VEN. |
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Quote:
|
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Ah that's true, but note that it's not safe to use get_user_weapon with inflictor.
You could save hitzone in TraceAttack that is called just before TakeDamage. |
Re: Detect Weapons in Hamsandwich Ham_TakeDamage
Quote:
|
| All times are GMT -4. The time now is 09:07. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.