1
I'm doing a SkyWar Game using just commandblocks and I need help to check when there's just one player left (Winner), the others when they die they're kicked from the server, so I need to check when there's just one left. I've searched a lot but couldn't find any solution
2
The simplest way is to just use a /testfor to check how many people are on the server. If you use a comparator as the output of the command block it will output a signal strength for every person it finds. If that signal equals 1, then there is only one person left online.
I'd just suggesting adding a tag or something to track which players are still alive, that way the game won't be locked if a player logs back on to the server. Something like the following:
You could also technically do this faster with /stats, but that's really weird and kinda complicated, so just stick with this.
I'd just suggesting adding a tag or something to track which players are still alive, that way the game won't be locked if a player logs back on to the server. Something like the following:
testfor @a[tag=alive]You could also technically do this faster with /stats, but that's really weird and kinda complicated, so just stick with this.
setup two testfors, one like /testfor @a[c=1] and 1 like /testfor @a[c=2] and then comparators, which are connected to a XOR logic gate, that will give off the output you want.
