A man who shot an alleged drug deal participant in the buttocks has gained his freedom after a judge heard his plans to turn away from a life of crime.