You don't stop riots by shooting at them. You stop riots by preventing or resolving the economic and social conditions that lead to them; that is, by improving the quality of life of those who have the lowest quality of life.
Unfortunately, shooting at them is easier to both conceptualize and implement, so governments tend to simply do that anyway.