Skip to content

Fix stealth kill animation playing on the wrong ped/player - #5282

Open
TheCrazy17 wants to merge 3 commits into
multitheftauto:masterfrom
TheCrazy17:fix/wrong-stealth-kill
Open

Fix stealth kill animation playing on the wrong ped/player#5282
TheCrazy17 wants to merge 3 commits into
multitheftauto:masterfrom
TheCrazy17:fix/wrong-stealth-kill

Conversation

@TheCrazy17

Copy link
Copy Markdown
Contributor

Summary

CEventHandler::ComputeDamageResponse has a shortcut that puts a damaged ped straight into the stealth kill death when the entity that caused the damage currently runs a CTaskSimpleStealthKill, without checking who that task is actually for. A knife kill keeps the task active on the killer for the whole animation, so any other damage they cause during that window (a tear gas tick from a grenade thrown earlier, a stray bullet) makes a different nearby ped play the stealth kill death animation and freeze up as if they were the victim.

This adds a hook at that shortcut which compares the task's real target (CTaskSimpleStealthKill::m_target) against the ped being processed; only the actual victim takes the stealth death path, everyone else gets the normal damage response.

Whitout fix: https://streamable.com/mp3i0d
With fix: https://streamable.com/psaelf

Motivation

Fixes #2897.

Test plan

  1. Throw a tear gas grenade next to two peds or players.
  2. While it ticks, stealth kill one of them with a knife.
  3. Only the stabbed one plays the stealth kill death.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Comment thread Client/multiplayer_sa/CMultiplayerSA.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA.cpp Outdated
@FileEX FileEX added sync bugfix Solution to a bug of any kind labels Aug 30, 2026
Checking at the original active task gate means no register needs
preserving and the skip path lands with its registers as the original
code expects, instead of after the victim's task was already allocated.
Also defines CTaskSimpleStealthKillSAInterface instead of reading the
target through a raw offset.
Comment thread Client/multiplayer_sa/CMultiplayerSA.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA.cpp Outdated
Derives from CTaskSimpleSAInterface there instead of declaring the
vtable and parent by hand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stealth kill (knife) animation may incorrectly be set on nearby players

2 participants