1
Command Block testfor
I am trying to do a simple TESTFOR <USERNAME>[r=3] to test if that specific user is within 3 blocks of the command block. It does not work. Is this supposed to work? I couldn't get it to work when I was trying TESTFOR <USERNAME>[x=XX,y=YY,z=ZZ] either.
So, am I doing something wrong or is there just not a way to test for a specified user in the vicinity of the command block?
Any help would be greatly appreciated.
So, am I doing something wrong or is there just not a way to test for a specified user in the vicinity of the command block?
Any help would be greatly appreciated.
3
davidj919[/quote]/testfor @p[r=3]
or if you need a specific player's name, do what Olive said.
For coordinates:testfor @p[x=#,y=#,z=#,r=3]
Note: you need to have a radius! Set it to "1" if you want that exact block.
Em did you read the post? Cuz he clearly stated he wants to use a specific player name. Anyway, this works if you just want to tp the player that is the nearest to the commandblock out of all player that are within a range of 3 blocks from the commandblock.
Also if you enter cords you dont NEED to enter a range. If you dont put in a rage it will just asume you only mean to use that one specific block. If you just use @p without a range it will assume you dont want to limit its radius and pick the player who is the closest to the commandblock, however far away he might be.
testfor @p[r=3]or if you need a specific player's name, do what Olive said.
For coordinates:
testfor @p[x=#,y=#,z=#,r=3]Note: you need to have a radius! Set it to "1" if you want that exact block.
Do it like this: /testfor @p[r=3,name="enter username"]
