First, pain can cause aggression so if you hit your cat, you may increase the aggressive behavior. Second, painful punishment may cause fear and owner avoidance. Third, owners that attempt to correct the playful aggression with physical contact may actually serve to reward the behavior. For punishment to be effective it must occur while the behavior is taking place and be timed correctly. Punishment also should be species appropriate.
Noise deterrents are often effective in cats.
For very young kittens, a hissing noise may deter excessive play behavior. The noise can be made by you, but if not immediately successful a can of compressed air used for cleaning camera lenses may be more effective and is less likely to cause fear or retaliation. Some cats need an even harsher noise. Commercially available rape alarms or air horns make extremely loud noises that will startle the cat and interrupt the behavior. What is most important in using these techniques is the timing.