Does a rental house have to have a certificate of occupancy to be able to rent it?

I was renting a house month to month. The roof constantly leaked and landlord's answer was to put buckets around to catch the water. When the bathroom ceiling collapsed it was the last straw. I moved out. Now I am being sued for thousands of dollars and have a criminal complaint filed for the "theft" of my own washer and dryer. The house never had a certificate of occupancy. Can that be in my favor?
Please sign in to answer this question.