Former police officer pleads guilty to gun charges