Raised This Month: $12 Target: $400
 3% 

[SOLVED][SDKHooks] Remove damage without removing push force?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrTimcakes
Senior Member
Join Date: Jan 2012
Location: Uk
Old 07-12-2015 , 15:50   [SOLVED][SDKHooks] Remove damage without removing push force?
Reply With Quote #1

I'd like to remove Rocket/Sticky self-damage in tf2, however I wish to keep the self-push force but my code removes that.
PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){

    if(
victim == attacker){
        
damage 0.0;
        return 
Plugin_Changed;
    }    
    return 
Plugin_Continue;

__________________

Last edited by MrTimcakes; 07-15-2015 at 08:27.
MrTimcakes is offline
turtsmcgurts
SourceMod Donor
Join Date: Jul 2011
Old 07-12-2015 , 16:18   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #2

A hacky workaround I used to accomplish this was to simply add the damage amount to the victims health to negate the incoming damage. If I remember correctly though, OnTakeDamage doesn't report the correct damage all the time (perhaps because of random damage spread?). I might be confusing it with OnPlayerHurt, it was one of them.

PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype){ 

    if(
victim == attacker){ 
        
SetEntityHealth(victimvictim_health damage);
    }     
    return 
Plugin_Continue


Last edited by turtsmcgurts; 07-12-2015 at 16:25.
turtsmcgurts is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 07-12-2015 , 16:25   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #3

1.7 Syntax

PHP Code:
public Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{    
    if(
victim == attacker)
    {
        
damage 0.0
        
TeleportEntity(attackerNULL_VECTORNULL_VECTORdamageForce);
        return 
Plugin_Changed
    }

    return 
Plugin_Continue;

__________________

Last edited by Pelipoika; 07-12-2015 at 16:52.
Pelipoika is offline
MrTimcakes
Senior Member
Join Date: Jan 2012
Location: Uk
Old 07-12-2015 , 16:45   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #4

Thanks. Also in the gun mettle update they added
Code:
Random damage spread is off by default (convar tf_damage_disablespread). Existing users will still use their currently set value.
Search Spread Here
__________________

Last edited by MrTimcakes; 07-12-2015 at 16:46.
MrTimcakes is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-12-2015 , 18:01   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #5

What about OnTakeDamage_Alive?

This was added to SM only a few revisions back.
__________________
Neuro Toxin is offline
MrTimcakes
Senior Member
Join Date: Jan 2012
Location: Uk
Old 07-12-2015 , 18:08   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #6

Quote:
Originally Posted by Pelipoika View Post
1.7 Syntax

PHP Code:
public Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{    
    if(
victim == attacker)
    {
        
damage 0.0
        
TeleportEntity(attackerNULL_VECTORNULL_VECTORdamageForce);
        return 
Plugin_Changed
    }

    return 
Plugin_Continue;

TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, damageForce); nor TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, damagePosition); produces the desired result, damageForce pushes the player way too far and damagePosition pushes the player to hard and always the same direction
__________________
MrTimcakes is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 07-12-2015 , 18:13   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #7

Quote:
Originally Posted by Neuro Toxin View Post
a few revisions back
"A few" revisions back, refering to a bit more than 10 months ago, or a bit more than 5 months for the stable. That's hundreds/thousands.
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work

Last edited by RedSword; 07-12-2015 at 18:20.
RedSword is offline
VoiDeD
AlliedModders Donor
Join Date: Mar 2009
Location: Illinois, USA
Old 07-12-2015 , 20:20   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #8

If you don't care about the damage source, you can set the player's m_takedamage to DAMAGE_EVENTS_ONLY to avoid using any hooks.
__________________
VoiDeD is offline
MrTimcakes
Senior Member
Join Date: Jan 2012
Location: Uk
Old 07-12-2015 , 21:03   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #9

Quote:
Originally Posted by VoiDeD View Post
If you don't care about the damage source, you can set the player's m_takedamage to DAMAGE_EVENTS_ONLY to avoid using any hooks.
I don't think this does what I'd like. I'd like something that only makes self-damage do no damage, I'd like still to be damaged by other players just not by myself.
__________________
MrTimcakes is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-12-2015 , 21:40   Re: [SDKHooks] Remove damage without removing push force?
Reply With Quote #10

Quote:
Originally Posted by RedSword View Post
"A few" revisions back, refering to a bit more than 10 months ago, or a bit more than 5 months for the stable. That's hundreds/thousands.
I think it was 172
__________________
Neuro Toxin is offline
Reply


Thread Tools
Display Modes

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 08:49.


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