AddEventHandler('entityCreated', function(entity) -- not valid anymore? if not DoesEntityExist(entity) then return end -- rest of core remains the same local entityType = GetEntityType(entity) -- not a vehicle? bail out if entityType ~= 2 then return end -- only for 'random' population cars if GetEntityPopulationType(entity) > 5 then return end -- if >0.5 (50% chance of locking), bail out if math.random() > 0.5 then return end -- lock! SetVehicleDoorsLocked(entity, 2) end)