Open
Description
What happened?
Since artifact 12160 and the changes in DeleteVehicle
, it's impossible to get a vehicle state before its complete deletion.
On older artifacts you could still for a bit of time get an entity state on deletion, in order to have some actions on vehicle deletion for exemple :
AddEventHandler('entityRemoved', function(entity)
if DoesEntityExist(vehicle.entity) then
local State = Entity(EntityId).state
-- do some stuff ...
end
end)
Since artifact 1260, the DoesEntityExist
always return false in this event, and the state is empty.
For scripting doing impound and garage functionality, this is a must have to be able to handle vehicle deletion and persistence correctly.
We would either need an event EntityRemoving
similar to creating, or still get the old behavior on older artifacts.
Expected result
Getting access to vehicle data on deletion
Reproduction steps
- Add an event handler on 'entityRemoved', and try to get the vehicle state using
Entity(EntityId).state
in the function's body - Remove an entity using the DeleteVehicle native
- the state is not accessible and the entity is indicated as removed by the
DoesEntityExist
native immediately, instead of having a grace period.
Importancy
Slight inconvenience
Area(s)
FiveM, ScRT: Lua
Specific version(s)
FiveM 12160 and newer
Additional information
No response