Bad practice to call native on every tick.

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0) -- Wacht 1 seconde voordat opnieuw te controleren/---- Wait 1 second before checking again

        local playerCoords = GetEntityCoords(PlayerPedId())
        
        for _, zone in ipairs(zones) do
            local distanceToZone = #(zone.center - playerCoords)

            if distanceToZone <= zone.distance then
                DeleteEntitiesInZone(zone)
            end
        end
    end
end)
1 Like