Gamemode vanilla 1.8 command block
I have made it so any one entering an area is switched to adventure game mode and then when he leaves the area he is switched back to survival.
How ever I am trying to do the same thing else where in the game but the code that is changing everything to survival beyond building one when they leave is affecting the code for building two when you enter.
What happens is the game mode is constantly changed indefinitely between survival and adventure mode.
The code I am using for the command blocks are:
/gamemode 2 @a[r=60,m=0]
/gamemode 0 @a[rm=60,m=2]
Bother buildings use the same code except the numbers are different due to the radius I am covering so building two has a radius of 30.
So what I'm asking is, how can I make it so I can enter and leave both buildings and have the game mode changed to adventure on entry and survival went vacated without the code of both buildings conflicting with each other?
Just to clarify that the command blocks reside below each building.
I'd be greatful if anyone could solve this for me.
Best Answer
Well the radius is mesured from the comand block. So if you put both command blocks in the same area it changes them constantly. What you can do is try to summon a invisible armor stand in the center of the area with /summon ArmorStand ~ ~ ~ {Invisible:1, CustomName:ArmorGuy,CustomNameVisible:0} then do /execute @e[name=ArmorGuy] ~ ~ ~ your gamemode command. I'm not sure will it work cause I'm sitting on my bed and typing with tablet.
Pictures about "Gamemode vanilla 1.8 command block"



How do you change the gamemode in Minecraft with a command block?
Gamemode. To change the gamemode of a player, you would use the command /gamemode [creative/survival/spectator] [playername] . Simply enter which gamemode you would like, then enter the player name of whoever's gamemode you wish to change.What is the command for gamemode?
You can get a command block in your Minecraft world using a special chat command. You'll need to have both Cheats and Creative Mode enabled in your Minecraft world to get a command block. Once you summon your command block, you can use codes to customize how it works.Can you use a command block in creative mode?
Commands. You can use either /forcegamemode or /fgm as a prefix for any of the commands. /forcegamemode [player] [gamemode]: Will force a gamemode on a player. You can use either (0, 1, 2) or (c, s, a) or (creative, survival, adventure) for gamemode.How to be in Survival and in Creative with Command Blocks l Minecraft Windows 10 Edition
More answers regarding gamemode vanilla 1.8 command block
Answer 2
What the problem here is that the [rm=60] part of the command syntax affects everything outside of the command blocks radius, including fields where there is a contradicting command block.You need to set an [r=60] as well so only players 60 blocks away from the command block witness a change. Apply this anywhere to protect your command zones.
:)
Answer 3
Put this command into a command block and set the status to repeating always:
/gamemode 2 @a[r=60]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ollie Craig, Ivan Babydov, Tatiana Syrikova, Julias Torten und Törtchen
