if ownedVehicles[plate] and ownedVehicles[plate] > 0 then
                local currentCoords = GetEntityCoords(playerPed)
                if lastCoords == nil then
                    lastCoords = currentCoords
                end
                local distance = GetDistanceBetweenCoords(currentCoords, lastCoords, true)
                lastCoords = currentCoords           
                ownedVehicles[plate] = ownedVehicles[plate] + distance
                if ownedVehicles[plate] > 1000 then               
                    if currentKilometer == nil then
                        Citizen.Wait(500)
                        ESX.TriggerServerCallback('ExeLds:getKilometer', function(kilometre)       
                            currentKilometer = kilometre + 1
                        end, plate)
                    else
                        currentKilometer = currentKilometer + 1
                    end
                    TriggerServerEvent('ExeLds:updateCar', plate)
                    ownedVehicles[plate] = 1
                end
            end
        else
            lastCoords = nil
            currentKilometer = nil
            ownedVehicles = {}
        end   
        Citizen.Wait(1000)
    end
end)