According to human psychology, it is said that the person who is possessed by drugs and/or gambling addictions needs to deal with it himself, the love and affection are just hopes and can't really do much unless that person willfully wants to get out of these things. Loneliness leads a person to either creativity (see big names like Bill Gates and Steve Jobs, they were alone as well) or the bad way - drugs, gambling, crime and other sort of addictions. I believe that it completely depends upon the choice they adopt during that situation.
It depends on their upbringing as well. Someone who grew up surrounded by creative people and seeing them release their anger or their negative emotions through songs, poetry, or painting will do that to cope with stress. Those who grew up in an environment where people drags a cigarette everytime they come across a small hurdle in life will do the same thing. But there will always be exceptions where the person will find better ways of dealing with loneliness. Perhaps, a healthier one.
In some cases, other people are able to help. Sometimes the gambler prioritizes being authentic, being true, and being credible to whatever he said. So he can promise to people that he's going to stop gambling and because he hates lying, he would try his best to stop gambling because relapsing would mean that he lied to those people. Sometimes all it takes is knowing your personality and taking advantage of it. I'm that kind of person too. I promise to people that I'm going to improve this and that. If I don't, I'm genuinely going to hate myself so I end up doing the things I promised.