1

I'm making a multiplayer minigame, I don't know how to test for another player in a radius, the command that i want is like when a player get near to another player in a radius of 3 then a command will run, execute @a ~ ~ ~ testfor @a[r=*radius*] don't help because it will just target you in it, add the [c=*count*] don't help me neither, because the command also return true if there's one match (and that's you)

1 Answer 1

1

You almost got it. Use the rm parameter, which specifies the minimum distance:

/execute @a ~ ~ ~ testfor @a[r=R,rm=RM]

Where RM is less then R, logically.

Or, if you would like to execute a command after this one returns true, combine them together:

/execute @a ~ ~ ~ execute @a[r=R,rm=RM] ~ ~ ~ /your-command
3
  • i've found it out at the night that i post this, thank anyway Dec 4, 2016 at 7:33
  • @ĐặngQuốcTrung Thanks for coming back and marking this answer as accepted. By this you help future visitors.
    – user143228
    Dec 4, 2016 at 10:41
  • yea i know :) Hope that everyone know to minecraft awesome commands to do some amazing things Dec 5, 2016 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .