-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ham_Killed/DeathMsg getting called before Ham_TakeDamage? #713
Comments
|
Because player dies in takedamage |
|
@fl0werD that doesn't explain why death is called before damage. |
|
pre takedamage |
|
First thing to notice, you are hooking Ham_TakeDamage as Post If there is another function getting called is because it was called inside TakeDamage, so let's follow the function from the SDK: It's TakeDamage from player, so let's find CBasePlayer::TakeDamage: There is a call in line 507 to CBaseMonster::TakeDamage, so let's go there and check: Oh, what is in line 909? if ( pev->health <= 0 )
{
g_pevLastInflictor = pevInflictor;
if ( bitsDamageType & DMG_ALWAYSGIB )
{
Killed( pevAttacker, GIB_ALWAYS );
}
else if ( bitsDamageType & DMG_NEVERGIB )
{
Killed( pevAttacker, GIB_NEVER );
}
else
{
Killed( pevAttacker, GIB_NORMAL );
}
g_pevLastInflictor = NULL;
return 0;
}So CBasePlayer::Killed is called on TakeDamage... So functions are called like this Thats why are you getting that result |
|
Thanks for the detailed explanation. If that's how the game works, I'm not going to judge it. |
I don't think this is how it should work. Why is the damage dealt after the player has died?
Result:
The text was updated successfully, but these errors were encountered: