How to use /testfor command on a specific location 1.9 [duplicate]

How to use /testfor command on a specific location 1.9 [duplicate] - Crop hacker silhouette typing on computer keyboard while hacking system

I'm making a custom map and I needed some help from you guys! I'm trying to use the /testfor command in 1.9 and here's what I've tried:

/testfor @a[-47,10,-37,1]

/testfor @p[-47,10,-37,0]

/testfor @p[-47,10,-37]

/testfor @p[x=-47,y=10,z=-37,r=1]

Any suggestions? Thanks in advance! :)



Best Answer

Note: This is a duplicate of: https://gaming.stackexchange.com/a/198417/153355

However, here's the answer:

You're scanning for the nearest player, your should scan for all the players.

Solution

/testfor @a[x=X,y=Y,z=Z,r=R]

Where:

  • X the x location
  • Y the y location
  • Z the z location
  • R the radius

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)

Variables

Specify the location:

  • @p nearest player
  • @r random player
  • @a all players
  • @e all entities

Specify the values:

  • x, y, z coordinate
  • r, rm radius (max, min)
  • m game mode
  • c count
  • l, lm experience level (max, min)
  • score_name max score
  • score_name_min min score
  • team team name
  • name entity name
  • dx, dy, dz volume dimensions
  • rx, rxm vertical rotation (max, min)
  • ry, rym horizontal rotation (max, min)
  • type entity type

Examples:

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]

Source: https://gaming.stackexchange.com/a/198417/153355




Pictures about "How to use /testfor command on a specific location 1.9 [duplicate]"

How to use /testfor command on a specific location 1.9 [duplicate] - Thoughtful man using smartphone on street
How to use /testfor command on a specific location 1.9 [duplicate] - From above of crop anonymous male hacker typing on netbook with data on screen while sitting at desk
How to use /testfor command on a specific location 1.9 [duplicate] - Unrecognizable female photographer taking photos and reflecting in rear window



How do you test if a player is in a certain area Minecraft?

How to Enter the Command
  • Test if Players are within 10 blocks. In this example, we will test to see if there are any players within a 10 block radius with the following command: /testfor @a[r=10] ...
  • Test if Mooshrooms are within 50 blocks. ...
  • Test if Nearest Player is at Level 20 experience.


  • How do you use the Testfor command in Minecraft?

    The /testfor command became obsolete in Minecraft 1.13, and has been replaced by the /execute command*. It will do the same as typing /testfor @e {SelectedItem:{id:"<item>"}} and then putting a comparator to the command block with the command, and then running the command which you wanna run.



    How to use /testfor command in a minecraft bedrock mini game




    Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

    Images: Anete Lusina, Andrea Piacquadio, Sora Shimazaki, Dominika Roseclay