Is there a way to check if you are in a vehicle?

Hi,
I just wondered if there is a way to check if you are in a vehicle or not.
Or how fast you are currently moving, and based on that, run other actions.

Thanks