I would go even more safe way. If player gets wrong answer, then give him scoreboard point in predefind objective and then kill all things with point in that objective. That way you can be sure that nothing else will get killed.
Run this command once to setup the objective:
/scoreboard objectives add wrong dummy
Then I bet the player chooses the answer by pressing some button etc. Just connect one commandblock to it, that will do something like this (update coords and radius for your needs):
/scoreboard players set @p[r=5,c=1] wrong 1
Then when he falls to his fate on pressure plate, the last commandblock will need to have something like:
/kill @p[score_wrong=1]
Plus you need (optional) reset to score, so if he tries again, won't be killed automatically (this also can be at start of the map with some initial button) - be sure you cannot target dead player by @p, only @a works
/scoreboard players set @a[score_wrong=1] wrong 0
The addition to this is that after setting his score in wrong
you can do anything else with the player, even persuade him that he was right and let him through....and then kill him just after that with some another trap. :) Or When he is right, just make him some bad times by throwing him into pit, too. But then not killing him, because his wrong
score is 0, the kill commandblock won't affect him.
Btw. I would recommend you to use /tellraw with all those commands, so players have some output why and what was happening. Typically you can use the wrong
scoreboard again and differ if he is right or wrong and send him apropriate message.
For that, I recommend JSON generator at http://minecraftjson.com
PS: If you want to have more tests, just setup more scoreboards same way, then you can kill players just before end even though they managed through half of puzzle etc.
type
doesn't do anything for@a
and@p
, because it only affects players anyway.@e[type=Player,c=1]
should be equivalent to@p
.