I gotta agree with M2M. Its all about consistancy, patience, and of course repeating yourself lol. I would go with M2M's method if I were you. Also maybe emphasize on the sympathy factor, like "Oh no, you don't want to hit Alegra, that will hurt! You'll make her cry!" or something like "No no, don't hurt sister, that makes mommy very sad". If you can get him to look you in the eyes when you tell him not to hit, or why not to hit, that would be even better. It will take a lot of reminders and a chunk of time before it sinks in with him, probably.
I obviously only have one child, but Eli has occasionally smacked us haha whether it be out of anger or just getting too riled up while playing, and I always stop everything and look him in the eyes and I get a sad look on my face and say "Hey hey, no you don't hit mommy, that's not nice. That hurts! Mommy doesn't hit you."
Another thing I've found to be pretty important is to always say "Ow!". Most kids by a pretty young age know how to relate to "ow". Even if it didn't really hurt, or even if he didn't do it to you, it will help him understand that hitting someone is a bad thing, and that it causes pain etc. All this stuff always seemed to work for me. Eli only ever hits us once in a blue moon and its almost like he just forgot for a second that he wasn't supposed to lol.
On another similar note, my child makes me so proud sometimes. Every now and again, I will yell too quickly or snap at him without thinking (I think it happens to everyone) and I always give him the respect of saying "Mommy's sorry for being mean" etc. I don't mind admitting that I was wrong. Anyway, a while ago every time he would throw a tantrum or yell at me or any of that naughty toddler stuff, he would (and does) come up to me after it was done and say "Mommy, I'm sorry for being mean" and want a hug. Sometimes I seriously think he is like the sweetest kid on the planet. lol