How do I track player death in a specific area? [duplicate]
The usual way to test for dead players is to set up a scoreboard objective. Check out the linked wiki page for general information, as well as the command reference for using scoreboards.
First, you have to set up an objective, I'll call it hasDied
using
/scoreboard objectives add hasDied deathCount
Using the deathCount
criterion means that it is automatically updated when someone dies. Now you can check whether a player has died using
/testfor @a[score_hasDied_min=1]
On a clock. The output of this command block will turn on once at least one player, somewhere, has a death score of at least 1. As part of this output (or the game start routine) you should reset the scoreboard objective for everyone using
/scoreboard players set @a hasDied 0
For an unknown number of players detecting the last man standing can be tricky, but it's doable. You can easily track people that have not died (using @a[score_hasDied=0]
), and detect when the comparator outputs at signal strength 1.