fix(server/vehicle): entity exists check

This commit is contained in:
Andyyy7666
2023-08-25 03:09:34 +02:00
parent 46fc396924
commit 105ac16560

View File

@@ -340,10 +340,12 @@ else
NDCore.giveVehicleKeys(veh, src, target)
end, false)
end
RegisterNetEvent("entityCreated", function(entity)
if GetEntityType(entity) ~= 2 then return end
if not DoesEntityExist(entity) or GetEntityType(entity) ~= 2 then return end
local state = Entity(entity).state
if state.owner or math.random(1, 100) <= Config.randomUnlockedVehicleChance then return end
if state.locked ~= nil then return end
state.locked = true
end)