Add debug logging to onClientResourceStop cleanup, bump to 1.1.5

Temporary tracing to diagnose why safe props still show after
resource stop despite DeleteObject being called.
This commit is contained in:
Bxio 2026-08-03 11:58:50 +00:00
parent 091e4864f1
commit d21d04f606
3 changed files with 6 additions and 2 deletions

View File

@ -292,11 +292,15 @@ end)
AddEventHandler('onClientResourceStop', function(resourceName) AddEventHandler('onClientResourceStop', function(resourceName)
if resourceName ~= GetCurrentResourceName() then return end if resourceName ~= GetCurrentResourceName() then return end
dbg('onClientResourceStop disparado, limpando', tostring(next(spawnedSafes) and 'safes existentes' or 'nenhum safe'))
for id, ent in pairs(spawnedSafes) do for id, ent in pairs(spawnedSafes) do
dbg('safe', id, 'entity', ent, 'DoesEntityExist antes:', DoesEntityExist(ent))
if ent and DoesEntityExist(ent) then if ent and DoesEntityExist(ent) then
pcall(function() ox_target:removeLocalEntity(ent) end) pcall(function() ox_target:removeLocalEntity(ent) end)
FreezeEntityPosition(ent, false) FreezeEntityPosition(ent, false)
DeleteObject(ent) DeleteObject(ent)
dbg('safe', id, 'DoesEntityExist depois do DeleteObject:', DoesEntityExist(ent))
end end
spawnedSafes[id] = nil spawnedSafes[id] = nil
end end

View File

@ -4,7 +4,7 @@ lua54 'yes'
author 'SeuNome' author 'SeuNome'
description 'Sistema de safes com ox_inventory e ox_target' description 'Sistema de safes com ox_inventory e ox_target'
version '1.1.4' version '1.1.5'
-- Dependências -- Dependências
dependencies { dependencies {

View File

@ -1,3 +1,3 @@
{ {
"version": "1.1.4" "version": "1.1.5"
} }