[TF2] How to hook hitting a building?
I've tried OnTakeDamage and TraceAttack, neither seem to work.
Thanks in advance. Edit: Just to clarify, by building I mean an engineer construction, sentry, dispenser, teleporter. |
Re: [TF2] How to hook hitting a building?
I don't think there is a hook. You can try this although there is an issue with it.
It works but getting the entity(sentry/dispenser/teleporter) isn't reliable since you can hit the building without looking at it. If you don't need the entity then you can delete GetClientAimTarget and your good to go. If you do need the entity maybe someone else knows a better way. Code:
public void OnPluginStart() |
Re: [TF2] How to hook hitting a building?
You could also try hooking CBaseObject::OnWrenchHit(CTFPlayer*, CTFWrench*, Vector) via DHooks.
Edit: If you're asking about any instance of damage (and not just when an Engineer hits another player's building, SDKHook_OnTakeDamage should work. See the old Hitsounds for Buildings plugin. |
Re: [TF2] How to hook hitting a building?
Huh, that plugin does seem to register ontakedamage for entities, I guess I'll explore that a bit more then, in my testing though, I couldn't get any response for ontakedamage when hitting a friendly building, maybe it's because it's not taking any damage?
Edit: Yes, that's what's happening, OnTakeDamage does work for buildings, but obviously, a friendly building doesn't take damage, so I need to find a a way to feign damage on friendly buildings. Edit Edit @Chaosxk: I didn't give your idea much merit at first but it's actually by far the best way to achieve this without doing some team owner tomfoolery, thanks for this, my plugin is almost working now. |
| All times are GMT -4. The time now is 21:08. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.