0

So I want to make some minigame where players can get a certain item when they get into a specific location, where then they can craft with it and then PVP.

So I thought of using the /execute command to then /give them with that specific coordinate.

/execute @a x y z give @p stick

Putting this in an Always Active Repeating Command Block, it still gives me the item even if I'm not in that location.

How can I give items to a player in they're in the given coordinates?

3

You can use the command:
/execute @e[x=#,y=#,z=#,dx=#,dy=#,dz=#] ~ ~ ~ give @s stick

Substitute the # hashtags for coordinates, and everything prefixed with d for distances.

7
  • 2
    There's no distance attribute in Bedrock. Also, there's no as component in /execute. Feb 23 at 17:38
  • Are you sure? this question gaming.stackexchange.com/questions/380383/… seems to say there is, see the command in the question body
    – Ray Wu
    Feb 23 at 18:40
  • I am referring to the first part of his sentence about distance, I think distance is shown in that question's body
    – Ray Wu
    Feb 23 at 18:44
  • I mean see the command in the question code block right under #town for player 1's selector
    – Ray Wu
    Feb 23 at 18:45
  • @RayWu Yes, I see lots of arguments but no distance one. Feb 23 at 18:46
1

You can accomplish this using two command blocks, one repeating and one chain command block. One way is to put the command blocks under that specific area or another way is to not put it under that specific area but make it act upon the that area.

First, you need to lay out both command blocks assigned to one direction. Then make both blocks “Always Active”. Make the chain command block set to “Conditional”.

Repeating Command Block

Type in /testfor @a[x=?,y=?,z=?,r=?] (if your command blocks are under the specific area, you don’t need to type in the coordinates except the ‘r’ value)

Chain Command Block Or Comparator

For this stage, you can either place a redstone comparator out of the repeating command block activating other blocks or place the chain command block. In the chain command block, just type in /give @p stick

0

Oh wait, I just realised that a much more easier way to do this is just place a repeating command block that is ’Always Active’ and just type in /give @a[x=?,y=?,z=?,r=?] stick

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.