fivem icon indicating copy to clipboard operation
fivem copied to clipboard

Bugged entity ownerships

Open niCe86 opened this issue 8 months ago • 3 comments

What happened?

It randomly occurs, that entity owner is not in entity streaming radius (424.0m) and the entity does not exist in their client either.

When trying to use NetworkRequestControlOfEntity to manually transfer the entity ownership, it obviously fails, as the current owner is not aware of the entity.

This leads to several bugs:

  • Players can't enter vehicle when the vehicle doesn't exist in owner's client (the entering animation freezes)
  • NPCs/peds are invincible when the ped doesn't exist in owner's client
  • This bug is also partially responsible for some weird train behavior - trains speeding up to ultra high speed values when the train doesn't exist in owner's client

Currently, this is unfixable, because there is no way how to set entity owner manually. And FiveM fails to transfer the ownership automatically.

  • I've tried this both with SetEntityOrphanMode set to 2 and without SetEntityOrphanMode.
  • I'm not using SetNetworkIdCanMigrate nor SetEntityIgnoreRequestControlFilter anywhere in the script

Expected result

Entity ownership should be transfered so the owner can sync the entity

Reproduction steps

None (occurs randomly)

Importancy

Unknown

Area(s)

FiveM

Specific version(s)

None

Additional information

No response

niCe86 avatar Apr 15 '25 14:04 niCe86

Are you sure the owner does not see the entity?

A similar issue can be reproduced this way:

  • Player A owns the world grid in which Entity A is
  • Player A is outside Player B scope and near Entity A (Player A is unaware of Player B ped, neither is Player B?)
  • Player B tries to control Entity A (like entering in the vehicle)
  • Player B fails to get the ownership as Player A (owner) does not exist for Player B, which fails the requestControlEvent (or whatever)

PichotM avatar Apr 15 '25 19:04 PichotM

Yes, usually when this occurs, the entity does not exist in owner's client. I've checked it with DoesEntityExist in the owner's client.

What you described is possible when owner is around 424.0m from the entity. It might then occur that owner does see the entity, but doesn't see the player who is trying to enter the vehicle, because they're slightly outside the culling radius.

But in cases we have observed, the owner was often even more than 500.0m from the entity so the entity is culled for them. And there were multiple players around the entity, so I wonder why FiveM didn't transfer the ownership...

niCe86 avatar Apr 15 '25 19:04 niCe86

But in cases we have observed, the owner was often even more than 500.0m from the entity so the entity is culled for them.

That's why I'm asking for confirmation Entities can still be loaded >424m if the owner owns the world grid

PichotM avatar Apr 15 '25 19:04 PichotM