Streamed-, In&Out-Event for Serversided Entities

[Explanation]

When a Player has a distance of like 5km to a Entity(vehicle, Player, Ped), FiveM is deleting this Entity because the Entity is out of stream range. The event should be fired.

[UseCase]
(My Usecase)
People like me, are saving vehicles on Server stop & spawn them when the Server Starts. But there is currently no way, to Apply Mods to vehicles serverside, so when a vehicle gets spawned bc it gets into the stream range, get the mods that have to be applied & apply them.

Hello, you could use the server side event entityRemoved ?

Not sure what this adds to the last request, which was closed…

Try state bags and state bag change handlers? These should apply to entities that are recreated, though if vehicle mods aren’t stored with vehicles already when they leave scope, that’s a bug by itself and doesn’t need such an event either.

didn’t know, that there was a state bag changed handler.

What he’s asking is actually sounds like a workaround “fix” for the real issue (which I also encountered myself): It’s not really about vehicle enters scope and adding it mods, but to server to be able to add mods to vehicles by itself. Is this more/less doable than an event? As for now I use really strange workarounds to add liveries and extras to created streamed out vehicles

Mod natives rely on some weird state, so adding them as ‘simply’ RPC setters may not be reliable either. Ideally we’d have server-side direct setters for this → CVehicleAppearanceDataNode parsing/unparsing would also be required.

1 Like