fivem icon indicating copy to clipboard operation
fivem copied to clipboard

fix(citizen-server-impl): validate onesync range when reassigning entity ownership

Open DaniGP17 opened this issue 1 month ago • 5 comments

Goal of this PR

Fixes a bug where vehicle entities become stuck/frozen after players change routing buckets or disconnect. The issue occurred when entity ownership was incorrectly transferred to players outside of OneSync range, causing entities to be uninteractable until the assigned owner (who is too far away) teleports back to the entity.

How is this PR achieving the goal

Validate that the candidate player is in the same routing bucket and is in the culling radius of the entity.

This PR applies to the following area(s)

Server

Successfully tested on

I couldn't test this because the user that report this on the forum said that to reproduce the issue I need 20-30 players.

Checklist

  • [ ] Code compiles and has been tested successfully.
  • [x] Code explains itself well and/or is documented.
  • [x] My commit message explains what the changes do and what they are for.
  • [x] No extra compilation warnings are added by these changes.

Fixes issues

https://forum.cfx.re/t/server-side-vehicles-being-frozen-at-random/

DaniGP17 avatar Nov 18 '25 20:11 DaniGP17

this would explain some of the issues people are experiencing when changing routing buckets, great work!

lLukDreams avatar Nov 18 '25 20:11 lLukDreams

This is great work

C4LLZ avatar Nov 19 '25 07:11 C4LLZ

I'm a bit confused on how this actually fixes ownership (at least in the case of routing buckets), the logic is already handled via relevantTo

See: https://github.com/citizenfx/fivem/blob/96dec18b3b375cfa2cfa17f867aff052daa828e9/code/components/citizen-server-impl/src/state/ServerGameState.cpp#L1200-L1206

AvarianKnight avatar Nov 19 '25 13:11 AvarianKnight

I've made changes in case anyone wants to review it.

DaniGP17 avatar Nov 21 '25 08:11 DaniGP17

Would be a big thing if this could get added if working, been a long standing issue 🙏

alberttheprince avatar Dec 10 '25 23:12 alberttheprince