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.
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. What is most important in using these techniques is the timing. You must have the noise-maker with you so that you can immediately administer the correction. Another component of aggressive play behavior is hiding and dashing out and attacking people as they walk by.