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

Solved Passing CTakeDamageInfo to an SDKCall?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 11-04-2019 , 22:57   Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #1

Yep, I have no idea what to do.

I attempted this a long time ago but I didn't really know what I was doing, and it all blew up in my face.
I learned a bit from my mistakes, but since then I kinda left it alone.
Until now.

EDITED-IN EXPLANATION: I'm trying to create a death notice in the kill feed in TF2 using actual values from a TakeDamage hook.
PHP Code:
SDKCall(hPlayerEventKilledvictimint[
float m_vecDamageForce[3]; m_vecDamageForce == damageForce
]); 
I am completely aware that this is wrong, but I have no other ideas how it's done other than individual values crammed into a datapack. :\
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4

Last edited by Shadowysn; 11-12-2019 at 08:28.
Shadowysn is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 11-05-2019 , 00:20   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #2

If you don't already have an CTakeDamageInfo instance on hand, you'll probably need to use something like Source Scramble to allocate one, set up the desired values, then pass its address. Refer to game/shared/takedamageinfo.h in the Source SDK for how it's laid out.

However, it does seem like you're posting about an attempt to solve a different problem (the XY problem) -- what are you actually trying to solve, if anything?
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 11-05-2019 , 00:57   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #3

Quote:
Originally Posted by nosoop View Post
If you don't already have an CTakeDamageInfo instance on hand, you'll probably need to use something like Source Scramble to allocate one, set up the desired values, then pass its address. Refer to game/shared/takedamageinfo.h in the Source SDK for how it's laid out.

However, it does seem like you're posting about an attempt to solve a different problem (the XY problem) -- what are you actually trying to solve, if anything?
Generally just trying to make an SDKCall that utilizes CTakeDamageInfo to work properly.
In that case, I'm trying to create a CTakeDamageInfo object or getting it to function some other way.
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4

Last edited by Shadowysn; 11-05-2019 at 07:59.
Shadowysn is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 11-05-2019 , 03:30   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #4

Can't you just use SDKHooks_TakeDamage? It uses a custom CTakeDamageInfo object to inflict damage.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 11-05-2019 at 14:00.
DJ Tsunami is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 11-05-2019 , 05:31   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #5

Quote:
Originally Posted by DJ Tsunami View Post
Can't you just use SDKHook_TakeDamage? It uses as custom CTakeDamageInfo object to inflict damage.
If you mean passing it to the SDKCall, does it actually work? And besides that, I don't want to damage the person for a second time, as I want to pass real values to the function I'm using.

If you mean taking a look in how it works, sure, but I'm getting the feeling it could just be from an inbuilt-extension and thus isn't applicable to normal Sourcemod plugins.

EDIT: Oh wait, you're the creator of SDKHooks, okay.
Um, my early outburst aside, SDKHook_TakeDamage is a void function which means it's not going to return anything.
But since you created that function, (I hope) can you tell how you made the CTakeDamageInfo object?
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4

Last edited by Shadowysn; 11-05-2019 at 08:17.
Shadowysn is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 11-05-2019 , 13:58   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #6

It's unclear from your first post what you are actually trying to do. If you're trying to inflict damage, what are you expecting the call to return?

Either way, the custom CTakeDamageInfo object is here: https://github.com/alliedmodders/sou...geinfohack.cpp
And the TakeDamage call is here: https://github.com/alliedmodders/sou....cpp#L178-L179

This is of course C++, so I'm not sure if it can be done directly in SourcePawn with SDKCall.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 11-06-2019 , 03:56   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #7

Quote:
Originally Posted by DJ Tsunami View Post
It's unclear from your first post what you are actually trying to do. If you're trying to inflict damage, what are you expecting the call to return?

Either way, the custom CTakeDamageInfo object is here: https://github.com/alliedmodders/sou...geinfohack.cpp
And the TakeDamage call is here: https://github.com/alliedmodders/sou....cpp#L178-L179

This is of course C++, so I'm not sure if it can be done directly in SourcePawn with SDKCall.
Not trying to inflict damage, but passing down the TakeDamage values to CMultiplayRules::DeathNotice to create a fake kill in the killfeed.

Welp, looks like I'm slumped.
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4

Last edited by Shadowysn; 11-06-2019 at 04:26.
Shadowysn is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 11-06-2019 , 05:27   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #8

There's the XY problem that should've been mentioned sooner.
Not that it improves the situation much since the killfeed does calls for getting weapon names, assisters and such, but those are things you can recreate.

For Source Scramble, you can allocate a MemoryBlock (size 0x64 in TF2, not sure about other games), then populate the members then SDKCall. This plugin reads / writes offsets in a CTakeDamageInfo struct retrieved via DHooks (I went this route because the extension's objectptr accessors have a few issues), but it should be the same principle with the manually-allocated one.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 11-09-2019 , 06:45   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #9

If you only care about the killfeed, just fire the player_death event yourself, that can all be done with natives built in to SM.
__________________
asherkin is offline
Shadowysn
Senior Member
Join Date: Sep 2015
Location: Location:
Old 11-10-2019 , 00:07   Re: Passing CTakeDamageInfo to an SDKCall?
Reply With Quote #10

EDIT: Apologies for causing an XY problem, but damn it I did not realize whatever was causing it until it was too late. I really hate how my way of learning is to keep getting into problems I don't even realize completely.
Quote:
Originally Posted by asherkin View Post
If you only care about the killfeed, just fire the player_death event yourself, that can all be done with natives built in to SM.
I'm already using that method, but I'd have to recreate all the code to pass onto the event in order to make a convincing feigned death.

Weapons, deathflags, tauntkills, so much stuff needed to do.
At it's current state the event will only report unique weapons as stock, as well as other inconsistencies. (Like taunt kills using the normal weapon's killicon instead.)
Plus, crit glows on the killfeed don't work for some reason.

End result would most likely be a long mess of code that can become outdated with any updates to the killfeed system, even if major updates don't happen.
Better reuse than copy, I guess.


I only made a bit of progress in the gamedata part because all the other things like CTFGameRules::DeathNotice still need CTakeDamageInfo.
And oddly enough, all of the DeathNotice function(s) weren't called in CTFPlayer's Event_Killed or FeignDeath function.

Instead, they called a weird function in the Linux binary - EconEntity_OnOwnerKillEaterEvent - that didn't need a CTakeDamageInfo passed to it, but I was unable to find it on Windows.
(The fact I'm using IDA Free which has no decompiler isn't helping.)

Welp, if all else fails I guess I'm gonna have to give up and use Source Scramble for this.
__________________
ragdoll spam, that is all

Steam profile, where I game, obviously.
Youtube channel, where I do Stick Death Maze animations and some other stuff.
no plugin requests, sorry


My Plugins:
-search list-
Modified Plugins:
1 | 2 | 3 | 4

Last edited by Shadowysn; 11-10-2019 at 02:06.
Shadowysn 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 11:35.


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