Best way to Detect Hit/Miss with Awp.
This function seems to do exactly what I need. However, I am not entirely sure how this function works and or how to register the function properly. Also to detect if Hit/Miss I was using get_user_aiming. Not sure if thats the most accurate way.
/** * Description: Called when the main attack of a weapon is triggered. * Forward params: function(this) * Return type: None. * Execute params: ExecuteHam(Ham_Weapon_PrimaryAttack, this); */ Ham_Weapon_PrimaryAttack, |
Re: Best way to Detect Hit/Miss with Awp.
Paulster1022
Quote:
You can use Ham_Takedamage to detect hit and Ham_Weapon_PrimaryAttack to detect shots count. Ham_Weapon_PrimaryAttack count - Ham_Takedamage count = miss count. RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp" "ham_Weapon_PrimaryAttack") RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage") public ham_Weapon_PrimaryAttack(weapon_entity) { } public ham_TakeDamage(victim, inflictor, attacker, Float:damage) // inflictor will probably be weapon_entity from function above { } |
Re: Best way to Detect Hit/Miss with Awp.
Quote:
Code:
new bool: did_damage[33] |
Re: Best way to Detect Hit/Miss with Awp.
Paulster1022
If I remember correctly, ham_primary attack goes before ham_takedamage. You can use a "post" version of the function to detect missed player or not. Also inflictor is weapon_entity, not weapon id! Weapon is not a part of player, it's a separate entity that lives it's own life. PHP Code:
|
Re: Best way to Detect Hit/Miss with Awp.
Thank you, I'll try it out today. I am just hoping the "post" version of Ham_Weapon_PrimaryAttack does in fact happen after the TakeDamage function. By the way, Happy Easter =D.
|
| All times are GMT -4. The time now is 20:09. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.