I agree that players in the unoccupied team should be protected against criminals, cops as well and to make that possible a restriction is needed, but the main focus should be that you can´t just switch on or off duty multiple times just to troll someone, however the ability to change the occupation once like going on shift to help other cops around if a gangwar randomly start right next to the cop as well as going off shift in order to fall back.
Just like the /fine command might be abused there is a message at the top of the screen that also is visible in eventual report screenshots, a message like that who show in a couple of seconds would prevent abuse from players that goes off or on shift just to report someone, a couple of seconds is enough time to notice that kind of changes and stop shooting if needed. On the other hand what about criminals that probably will stalk off duty cops in order to prevent them from going off shift or if a cop really don´t want to get randomly killed gets prevented from ending shift just because a wanted criminal are hunting him.