I am trying to test for if a player is at a certain x and z, but not a certain height, and I can't find anything that says how to do it.
Here's what I have:
/testfor @a[x=-50,z=79,r=1]
The problem is, it's only true if the player is standing on the command block, and I need it to be true if the player is anywhere directly above the command block, like five blocks above. What am I doing wrong?
Best Answer
You could do this by using the cubic volume selectors (
dx
,dy
,dz
) rather than a radius.For example, to test for players around (
-50
,79
) with any height (or rather, a height from -5000 to 5000):This tests for anyone with x from
-51
(x) to-49
(x + dx), a z from78
(z) to80
(z + dz), and y from-5000
(y) to5000
(y + dy)