I found the /testfor
command today in Minecraft, but when I use it in a command block it says
Usage: /testfor <player>
and when I do that it then says
/testfor must be used by command blocks with an analog output.
What does that mean and how can I use the command?
Best Answer
As per the Minecraft Wiki Commands page, the syntax of the
/testfor
command is either of:So, e.g., a command block that fires the command
/testfor notch
, with a redstone comparator attached to it, would output a signal from the comparator, assuming that Notch is playing on that server.Using the Command Block selectors syntax lets you do things like
/testfor @a[r=3]
, which will cause the comparator to emit a signal strength equal to the number of players within three meters. Or/testfor @a[m=2]
, which would cause the comparator to emit a signal strength equal to the number of Creative Mode players currently on the server.