Another idea is to provide dogs or stray dogs some suitable place to sit or sleep near the car at night.
I have a cat that loves to sit on my car, so now i provided cat with a suitable sitting and sleeping place in my garage, and now the cat utilises that place most of the times very happily.
But stray dogs in streets are always an issue, especially for those who have to park the car outside the garage.