1

HELP Checking when there is just one player left on the serv

NotWP •5/14/16 9:20 pm
•
277
•
5/14/2016 9:31 pm
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
Posted by
NotWP
Level 1 : New Miner
0

  Have something to say?

Join • Sign in

2

Jmal116
• 05/14/2016 9:31 pm
• Level 34 : Artisan System
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: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.
1
CGBrothers
• 05/14/2016 9:30 pm
• Level 53 : Grandmaster Lego Builder
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.
1

Welcome