function init()
    Vehicles = FindVehicles("", true)

    Vehicle = 1
    --SetPlayerVehicle(Vehicles[Vehicle])

    for i = 1, #Vehicles do
        SetBodyDynamic(GetVehicleBody(Vehicles[i]), false)
    end

    lastPlayerV=0
end

function tick()
    local playerV = GetPlayerVehicle()
    if playerV~= lastPlayerV then
        if playerV~=0 then
            SetBodyDynamic(GetVehicleBody(playerV), true)
        else
            local vB = GetVehicleBody(lastPlayerV)
            SetBodyActive(handle, false)
            SetBodyDynamic(vB, false)
            SetBodyAngularVelocity(vB,Vec())
            SetBodyVelocity(vB,Vec())
        end
        lastPlayerV = playerV
    end

    if InputPressed("n") then
        NextVehicle()
    end
end

function NextVehicle()
    Vehicle = Vehicle % #Vehicles + 1
    SetPlayerVehicle(Vehicles[Vehicle])
end