He had the right to arrest you once you took the weapon out the rule you might be thinking of only protects you if you kept it in your hotbar Its a big of a shit move on his side but he did have the right to do it.
- Carrying a gun in your hotbar is illegal and warrants an arrest, excluding pistols and gang weapons.