Instead of walking in pride, and telling someone about what you know, and what you went through that may be similar to what they are going through, walk in love, peace, and understanding by just giving your ear to listen, a body to hug, and a shoulder to cry on.
Once you get over yourself, and get away from your own self righteousness, the people that you choose to listen to and understand will undoubtedly start to pour more of themselves into you more and more each time you are able to connect.
Though there is a time to give advice, much of building relationships with people has to do with the way that we are just there for them in their times of true need. When you take time out of your own life and give of yourself by just being there and giving your ear, or shoulder to lean on, you will in turn have someone to be there for you in your times of need as well.
People don't always need advice. Sometimes all they need is a hand to hold, ear to listen and a heart to understand.