2

I'm starting a new server with few friends and we're stuck with making "safe zones" and "only X team zones".

We have a survival map where there are 4 teams (Red, Purple, Yellow and Green), but with some "safe areas" that cannot be destroyed and also are not PvP allowed. I used those commands:

gamemode adventure @a[r=40,m=0]
gamemode survival @a[rm=41,r=42,m=2]

This actually works, but people can still PvP in this area (40x40 blocks), which we don't want them to...

Also, we want that only one team can enter certain areas, and the other get teleported to the spawn (x=-237, y=71, z=222).

The last thing we want is to make a "PvP reward" system. Each time someone kill a player from another team, he will receive 2 emeralds. Obviously, we don't want that people on the same team can hit each other, so we will need a command for that.

I hope you guys can help us, we are really new in commands-block, making all our tries not working.

Thanks for all your help.

4
  • So are you asking for a command to prevent PvP? Jan 29, 2017 at 7:39
  • Yes, but not in the entire map, just some areas, like the shopping center, Coliseum, and some others. For example a 40x40 area PvP free, so when they leave this area you can PvP again against the other teams, but not with people inside your own team obviously.
    – Nhyms
    Jan 30, 2017 at 0:21
  • Have you tried using the friendlyFire option in scoreboards?
    – 54D
    Feb 4, 2017 at 9:49
  • Not really, I'm new on this commands stuff, so I really don't know how to use them, i saw some tutorials, but it was more coping them, than understanding...
    – Nhyms
    Feb 28, 2017 at 17:40

2 Answers 2

1

To prevent PVP, you'd want to give weakness to players, as this is the most effective method, because, if done correctly, it won't actually make a player go red.

Command:

/effect @a[r=20] weakness 2 127

The 2 seconds is to make sure a player loses their weakness when they step out the safe zone. You might be able to lower this to 1 second.

To teleport players in a radius:

/tp @a[r=20,team=!Red] X Y Z

This command assumes that players which must not be teleported are on the scoreboard team Red.

To prevent combat between the same team:

/scoreboard teams option Red friendlyfire false

This can be used for all the teams by replacing Red with the other team's name.

Remember, you will need to setup scoreboard teams if you haven't already

More info: http://minecraft.gamepedia.com/Scoreboard

Also, check out http://minecraft.gamepedia.com/Commands#Target_selector_variables for information regarding selecting players in a certain X1 Y1 Z1 to X2 Y2 Z2 area, if using a radius is too inaccurate for you.

To give two emeralds to a player, check out this question: Can you use /testfor to detect the death of a player?

The one thing you'd need to change is change

/testfor @a[score_hasDied_min=1]

to

/give @a[score_hasDied_min=1] emerald 2

(untested, I will test in a couple hours)

3
  • Thanks you a lot!! It's actually working at least with the "Only X Team zones" and with the PvP, I'll try the emeralds reward en a few minutes.
    – Nhyms
    Feb 28, 2017 at 17:43
  • 1.13 syntax for first command: /tp @a[distance=..20,team=!Red] X Y Z.
    – pppery
    Jul 9, 2019 at 4:29
  • 1.13 syntax for last command: /give @a[scores={hasDied=1..}] emerald 2
    – pppery
    Jul 9, 2019 at 4:29
0

You could use teams. Make a team, turn off friendly fire, and set players to the team when within the area, remove it when not. http://minecraft.gamepedia.com/Scoreboard

Enchanted helmet. Equip them with a protection or thorns (personal favorite) 200. Remove when out of area.

0

You must log in to answer this question.

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