Well for one thing, I hope you see the path this guy chose and how it ended for him. This may be evidence that something has to change.
I think one problem our society has is a lot of people get hung up on how others perceive them and use societal standards as a means of evaluating the quality of their own lives. Number of friends, what others think of them, amount of sex you get. If you can relate to the shooter, it seems likely to be the case that you hold the aforementioned items in high regard. What you should be aware of is that a lot of these things don't really matter at all, or at least are incredibly overvalued by modern society.
There's some things that can be worked out logically, for instance, the value of sex. Some people are born with deformed, missing, or "unusable" genitalia. Are these people still capable of living normal, healthy, happy lives? It's not so unreasonable to think so. The thing that gets most people down is that society told them the amount of sex they have is a measure of their manhood and worth so they believe it and end up feeling shitty and worthless when they don't get any. For the most part it's all an illusion.
As for being lonely, generally as you go through life, you are bound to make friends so long as you are actually doing something. Attending classes at school, working at a job, social interaction is inevitable. Even online you can make some friends too. I had a couple of online "cliques" of friends from playing games.
Again though, if you relate to this shooter, just look at how he ended up. You may want to consider researching or looking into how to go about changing your mentality and discarding a lot of messed up societal values that may be in your head.