No PvP within a certain radius?

Ar
1

I play on the Minecraft Besrock edition and build a map… I want to have a certain zone in which players can't attack each other, so far I've done it by giving the players a resistance effect using a command block with a fixed radius, but I don't want you to be able to hit each other, can you do that?

Ad

Repeating command block under the spawn with:

/ execute @e [r = 50] effekt @a Weakness 5 255 true

(Always active)

Ps: If arrows should also be gone: / kill @e [type = arrow, r = 50]