Kiddo, you already put onion water in your hair. You think vinegar is somehow going to make it worse?
Jokes aside, vinegar is awesome for removing build-up on the hair, and, I’d imagine, odd smells as well. If you have color, it might fade it a little, but it’s worth a shot. Make sure you follow up with a deep conditioner. Dish detergent like Dawn would probably work, too, but that strips a LOT of oil out of your hair and can leave it dry and damaged, so I’d save that as a last resort.
ETA: Yes, apple cider vinegar. I somehow forgot that fairly key point in my answer.