Passing CTakeDamageInfo to an SDKCall?
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:
|
Re: Passing CTakeDamageInfo to an SDKCall?
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? |
Re: Passing CTakeDamageInfo to an SDKCall?
Quote:
In that case, I'm trying to create a CTakeDamageInfo object or getting it to function some other way. |
Re: Passing CTakeDamageInfo to an SDKCall?
Can't you just use SDKHooks_TakeDamage? It uses a custom CTakeDamageInfo object to inflict damage.
|
Re: Passing CTakeDamageInfo to an SDKCall?
Quote:
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? |
Re: Passing CTakeDamageInfo to an SDKCall?
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. |
Re: Passing CTakeDamageInfo to an SDKCall?
Quote:
Welp, looks like I'm slumped. |
Re: Passing CTakeDamageInfo to an SDKCall?
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. |
Re: Passing CTakeDamageInfo to an SDKCall?
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.
|
Re: Passing CTakeDamageInfo to an SDKCall?
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:
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. |
All times are GMT -4. The time now is 16:18. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.