/testfor (player you want to kill) [r= (how far you want it) just do a number like 1 block 2 blocks away. and make it a repeating command block and always active
once your done with that place a comparator in front of that command block, then a repeater in front of that. then hook it up to another command block that says /kill @p
and that's it,
if you are confused contact me,