In command blocks, @p is kind of risky to use. Someone could walk in front of it and the guy who activated the command block. Introducing, the @s selector.
The @s selector does the command on the source of redstone power. So lets say, a player steps on a pressure plate. The command block has /give @s diamond_sword. The player was the redstone activator, and he will get the diamond sword. If a Zombie stands on it, IT will get a diamond sword. I hope thats enough, i'm pretty sure it is pretty simple.
97% of teenagers would cry if they saw Justin Bieber on top of a tower about to jump. If your the 3% who is sitting there with popcorn screaming "DO A BACKFLIP", copy and paste this as your signature[/b]