Required Code for Ham_TakeDamage to get proper Damage
Just like in Damage event, I want to use Ham_TakeDamage to get the damage done to the victim. However I have some problem with getting the correct damage. It's something related to offsets as it has been described here : https://forums.alliedmods.net/showpo...8&postcount=71
However, as a function, it's not giving the correct damage. I want to use it instead of Damage event as it's a little quicker than that. As Tested, it's 0.00845 seconds or 8ms faster which is quite a big difference. So, please if any one could make the function similar to the Damage event function, It would be really grateful :) |
Re: Required Code for Ham_TakeDamage to get proper Damage
Well, the fourth parameter of Ham_TakeDamage is the taken damage, but floated. You can use floatround() to get it as an integer, did you try it?
|
Re: Required Code for Ham_TakeDamage to get proper Damage
yes but it's giving OFF-CHART values than actual inflicted damage :(
Sometimes, it gives correct damage. Sometimes different damage. eg. If I damage myself with an HE GRENADE, it gives correct damage... but den some does a HEADSHOT to me, and it gives double the damage... |
Re: Required Code for Ham_TakeDamage to get proper Damage
Double, you mean like if it is HS with AK (the damage is 140), it shows 280? That's strange...
Well, if so, I guess I will stand next to you, trying to understand how to get most properly the damage taken. |
Re: Required Code for Ham_TakeDamage to get proper Damage
To get the real damage done (after calculation armor, weapon power, etc), you need to hook TakeDamage as post, and retrieve value of pev_dmg_take, which is used by Damage event after.
Please search before posting, already asked/answered many times, and stop with your weird request/assumptions each time. :/ Quote:
|
Re: Required Code for Ham_TakeDamage to get proper Damage
@Arkshine - I searched. But I couldn't find the exact thing. Anyways, so you mean I should get the entity's value of pev_dmg_take inside TakeDamage Post Function and ignore Float:damage parameter?
PHP Code:
|
Re: Required Code for Ham_TakeDamage to get proper Damage
Look at HLSDK, even if not CS code, this is the same kind of code, meaning, a base damage is passed, then, there are modifiers which will reduce (or increase) base damage (armor value, weapon ratio, teamate). After all that, final damage is set in pev_dmg_take.
|
| All times are GMT -4. The time now is 13:03. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.