Issue with SetEntityRoutingBucket

So the entity exists and everything but the setter of entity routing bucket does not work at all. I print some info about the vehicle and the routing bucket and returns true when I check if the entity exists (other natives used on this entity works) and I check the dimension variable that is “100” and then when i print “GetEntityRoutingBucket” returns 0.

image
image

I tried doing this:
image

And this is the result

Couple of queries around this;

You running onesync?

Is there a player in that same dimension?

I’m missing a lot of specific reproduction steps and information. How are you expecting this to be actionable in any way? What’s with the ‘EnsureEntityStateBag’ call?

Yes Im running onesync and Im using artifacts 5969. The player does not need to be at the same dimension? That doesn’t make any sense

EnsureEntityStateBag i was testing that native. Didn’t know what was his functionallity but I remove it and I have the same issue with the routing buckets or “dimensions” with the entities. (With players works)

I’ve been using the native “CreateVehicleServerSetter” and right now I tried with CreateVehicle and CreateAutomobile too and I have the same issue. I have onesync infinity on so I think it’s the artifacts version maybe?? Im using 5969 artifacts version

Can you post the actual code you’re using and steps you’re checking with instead of some half-complete info?

init.lua (server-side)

function Init(Job, callback)
    if not Job then return end
    if not VEHICLES_DATA[Job] then return end

    local Count = 0

    for key, value in next, VEHICLES_DATA[Job] do
        if not value.Type or not value.Model then
            return
        end

        Count += 1

        SpawnVehicle(value.Model, value.Type, value.Position, value.Job, value.Dimension)
    end

    if Count == #VEHICLES_DATA[Job] then
        return callback(true)
    end
end

Citizen.CreateThread(function()
    print('^5Garages^7 - Init.lua has been loaded')

    Init('police', function(spawned)
        if not spawned then
            return 'error'
        end
    end)
end)

server.lua:

Entities = {}

function LiveryApplied(EntityId)
    local Vehicle = NetworkGetEntityFromNetworkId(EntityId)

    if DoesEntityExist(Vehicle) then
        Entity(Vehicle).state.liveryApplied = true
    end
end

RegisterNetEvent('Garages:liveryApplied', LiveryApplied)

function SpawnVehicle(Model, Type, Position, Job, Dimension)
    local Vehicle = CreateVehicleServerSetter(joaat(Model), Type, Position.x, Position.y, Position.z, Position.w)
    local VehicleId = NetworkGetNetworkIdFromEntity(Vehicle)
    Wait(300)

    while not DoesEntityExist(Vehicle) do
        Wait(500)
    
        print('^5Garages^7 - Entity with model ^5'..Model..'^7 does not exist')
    end

    print('^5Garages^7 - Entity with model ^5'..Model..'^7 has been created')

    local Ped = GetPedInVehicleSeat(Vehicle, -1)
    if Ped then
        DeleteEntity(Ped)
    end

    SetVehicleDirtLevel(Vehicle, 0.0)
    SetVehicleDoorsLocked(Vehicle, 1)

    Entity(Vehicle).state.job = Job
    Entity(Vehicle).state.isFaction = true
    Entity(Vehicle).state.liveryApplied = false

    table.insert(Entities, VehicleId)
end

AddEventHandler('onResourceStop', function(resource)
    if resource ~= 'Garages' then
        return
    end

    for key, value in next, Entities do
        local Entity = NetworkGetEntityFromNetworkId(value)

        DeleteEntity(Entity)
    end
end)

So, any idea?