change switch case weapon to for loop with if condition to shorten the
code