Running into a weird issue with my QBCore housing system where entities from previous tenants are showing up in new tenants' properties. Using Onesync Infinity with the bucket system, and when someone moves out and someone else moves in, the furniture entities from the old tenant don't get properly cleaned up from the routing table.
The symptoms are ghost furniture appearing in people's homes, server performance dropping as entity count climbs, and txAdmin showing some buckets with way more entities than they should have. I can see in the routing table that entities are staying in the old bucket instead of getting cleaned up when the tenant changes.
Here's what happens on tenant change:
RegisterNetEvent('qb-housing:server:changeTenant', function(propertyId, newTenant)
-- Remove old tenant
MySQL.query('DELETE FROM housing_tenants WHERE property_id = ?', {propertyId})
-- Add new tenant
MySQL.insert('INSERT INTO housing_tenants (property_id, citizenid) VALUES (?, ?)', {propertyId, newTenant})
-- Spawn furniture for new tenant - but old entities still exist in routing!
TriggerClientEvent('qb-housing:client:spawnFurniture', newTenant, propertyId)
end)Pretty sure I need to be doing some kind of entity cleanup before spawning new ones, but haven't found the right approach for handling the routing bucket side of things.
CloudStrife · 03/09/2026
Sign in to reply.