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

SDKHooks_TakeDamage's DamageCustom


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Aderic
Senior Member
Join Date: Oct 2011
Old 05-03-2014 , 15:25   SDKHooks_TakeDamage's DamageCustom
Reply With Quote #1

Hey guys, I'm having a bit of a problem with this plugin I've been working on.. I can't seem to emulate TF2 kills perfectly.

What I'm doing is hooking into SDKHook_OnTakeDamage, cancelling the damage by returning Plugin_Handled, and inside this hook calling SDKHooks_TakeDamage to damage the attacker instead.

The issue? SDKHooks_TakeDamage does not have a customkill parameter. Special flags like whether a backstab or headshot has occured can't be carried over to the attacker.
... and yet SDKHook_OnTakeDamage does have a customkill parameter.

Any help would be greatly appreciated!

Thanks,

Mark.

Some code examples:
Code:
SDKHook(clientID, SDKHook_OnTakeDamage, OnClientTakeDamage); // Here I would hook the damage method.


public Action:OnClientTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3], damagecustom)
{
        // No damagecustom in SDKHooks_TakeDamage, wtf?
        SDKHooks_TakeDamage(attacker, inflictor, victim, damage, damagetype, weapon, damageForce, damagePosition);
        return Plugin_Handled;
}
__________________

Last edited by Aderic; 05-03-2014 at 15:28.
Aderic is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 05-03-2014 , 16:13   Re: SDKHooks_TakeDamage's DamageCustom
Reply With Quote #2

You can do it still a tricky way like setting damage to 512.0241294
And in OnTakeDamage if damage would have 0241294 part then do wanted action
__________________
...
Oshizu is offline
Aderic
Senior Member
Join Date: Oct 2011
Old 05-03-2014 , 16:22   Re: SDKHooks_TakeDamage's DamageCustom
Reply With Quote #3

Quote:
Originally Posted by Oshizu View Post
You can do it still a tricky way like setting damage to 512.0241294
And in OnTakeDamage if damage would have 0241294 part then do wanted action
Well, my problem isn't detecting whether a headshot or backstab took place. The issue is trying to call (through code) a headshot damage type to the attacker.

I essentially want the attacker to shoot the victim and blow the attacker's head off instead.
__________________
Aderic 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 04:49.


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