Skip to content

Fix/player damage event fix#4841

Open
NanoBob wants to merge 5 commits intomultitheftauto:masterfrom
NanoBob:fix/player-damage-event-fix
Open

Fix/player damage event fix#4841
NanoBob wants to merge 5 commits intomultitheftauto:masterfrom
NanoBob:fix/player-damage-event-fix

Conversation

@NanoBob
Copy link
Copy Markdown
Contributor

@NanoBob NanoBob commented Apr 20, 2026

Summary

The onPlayerDamage event was broken, attacker, bodypart and weapon info was no longer being sent.
This seems to have been erroneously removed when resetting the bitstream version and getting rid of version checks.

The version check however was still present on the the VehiclePuresyncPacket (but not the CSim variant). This also would've caused vehicle sync to completely break some ~23 bitstream versions in the future.

This PR:

  • Re-introduce sending of this data
  • Modifies the puresync packet to read it again
  • Removes the incorrect version check

Motivation

Otherwise stuff would break

Test plan

This simple script could reproduce the issue:

function onPlayerDamage(attacker, weapon, bodypart, loss)
    iprint({
        event = "onPlayerDamage", 
        source = source,
        attacker = attacker,
        weapon = weapon,
        bodypart = bodypart,
        loss = loss
    })
end
addEventHandler("onPlayerDamage", root, onPlayerDamage)

Before these fixes the output would be:

[22:43:28] INFO: {
  bodypart = 255,
  event = "onPlayerDamage",
  loss = 9,
  source = elem:player[SAES>NanoLaptop],
  weapon = 255
}

(Even though SAES>NanoBob shot SAES>NanoLaptop)

After the fix it looks like this:

[23:14:26] INFO: {
  attacker = elem:player[SAES>NanoBob],
  bodypart = 9,
  event = "onPlayerDamage",
  loss = 8,
  source = elem:player[SAES>NanoLaptop],
  weapon = 29
}

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 Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp Outdated
Comment thread Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp Outdated
@FileEX FileEX added sync bugfix Solution to a bug of any kind labels Apr 20, 2026
@NanoBob NanoBob requested a review from FileEX April 21, 2026 00:02
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.

2 participants