If I do:
/testfor @p[x=,y=,z=,r=]
It says:
The entity UUID is in an invalid format.
You're scanning for the nearest player, your should scan for all the players.
/testfor @a[x=X,y=Y,z=Z,r=R]
Where:
For example:
/testfor @a[x=64,y=10,z=64,r=5]
(Search for players on coordinates 64,64 at height 10, with a radius of 5 blocks)
Specify the location:
Specify the values:
To test if Alice is online:
testfor Alice
To count the number of players in survival mode within a 3-block radius of (0,64,0):
testfor @a[0,64,0,3,m=0]
To count the number of players currently flying:
testfor @a {abilities:{flying:1b}}
To count the number of zombies within a 20-block radius of (0,64,0):
testfor @e[0,64,0,20,type=Zombie]
testfor @a[64,64,10,5,name=playername]
. I'm not twisting his original intention, I'm just answering his question which states: How do I test for a player at specific coordinates?
, which not specifies himself.
Commented
Dec 29, 2014 at 12:17
In newer versions of minecraft you can use something like this:
/execute as @a[x=100,y=100,z=100,dx=0,dy=0,dz=0] at @s run <command>
You need to specify delta values for this to work. The coordinates defined with x y z
are one corner of the specified area, the delta values dx dy dz
define how many blocks the second corner is away from the first corner.
You can also use this command:
/execute positioned 100 100 100 as @a[distance=..1] at @s run <command>
This will execute your command as all players who are within a 1 block radius from the coordinates 100 100 100
.
I've noticed that the invalid UUID doesn't always mean that the format is wrong, as I've gotten the error a lot when the format was correct, but no entity was detected. Make sure you are in the area you've specified, and then retry your command.
You put @p[x,y,z,r] this considers the whole section as the identification of the player try @p [x,y,z,r].