You can create a lookup table for your dumpsters.

local dumpsters = {
    [218085040] = true, 
    [666561306] = true, 
    [-58485588] = true
}

CreateThread(function()
    while true do
        local objects = GetGamePool('CObject')

        for i = 1, #objects do
            local entity = objects[i]
            local model = GetEntityModel(entity)

            if dumpsters[model] then
                -- Distance computation here
            end
        end
        Wait(1000)
    end
end)
1 Like