A gunman who wore a fake police uniform and fired blank rounds during an incident which forced the evacuation of nearby properties has been jailed for three years.