This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[Tf2] Sdkhook_OnTakeDamage crit + change damage bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lobnico
Member
Join Date: Sep 2012
Old 10-04-2016 , 18:51   [Tf2] Sdkhook_OnTakeDamage crit + change damage bug
Reply With Quote #1

When changing damage value inside hook function,
if attack is a crit it will negate value,
giving infinite overheal instead of damaging.
PHP Code:

public Action:OnTakeDamageAlive(victim, &attacker, &inflictor, &Float:damageint &damagetypeint &weapon,
        
float damageForce[3], float damagePosition[3], int damagecustom)
{

    
damage 1.0 //any change to damage will work unless its a crit

    
return Plugin_Changed;

Bug occurs wheter it's OnTakeDamage Pre/Post, OnTakeDamageAlive Pre/Post.
__________________
lobnico is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 10-05-2016 , 07:20   Re: [Tf2] Sdkhook_OnTakeDamage crit + change damage bug
Reply With Quote #2

I'm getting some reports on SF2 where apparently some players get infinite overheal, so I'm interested to know if it's this function causing it.
__________________
Benoist3012 is offline
lobnico
Member
Join Date: Sep 2012
Old 10-05-2016 , 15:19   Re: [Tf2] Sdkhook_OnTakeDamage crit + change damage bug
Reply With Quote #3

Quote:
Originally Posted by Benoist3012 View Post
I'm getting some reports on SF2 where apparently some players get infinite overheal, so I'm interested to know if it's this function causing it.
Sounds like it. Any modification of damage during hook cause that bug if dmg is crit

Temporary fix is to move dmg modification on Player_Hurt event and use
SetEntProp to apply victim new health; works swell, prevent death too !

PHP Code:

public Action:Event_PlayerDmg(Event event,const String:name[],bool:dontBroadcast){

    
int victim GetClientOfUserId(event.GetInt("userid"));
    
int dmg event.GetInt("damageamount");
    
int healthModifier
    
//... modify dmg here and get health difference

    //reset proper display value for attacker
    
event.SetInt("damageamount"dmg); 
    
//reset proper health value remainin for victim
    
SetEntProp(
       
victim,
       
Prop_Send,
       
"m_iHealth"
       
GetEntProp(victimProp_Send"m_iHealth") + healthModifier
    return 
Plugin_Changed;

__________________

Last edited by lobnico; 10-05-2016 at 15:22.
lobnico is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode