How to set a gamemode radius with command blocks? [duplicate]

I've been trying to figure out how to change a player's gamemode from adventure to survival when walking out a certain radius. The map size I'm using is 2956x2956 & I wanna be sure to cover all of it. I tried using /gamemode creative @a [r=10] with a repeat block just to test out what'll happen. But no matter how far I am from the block it keeps setting my gamemode to creative. Can someone show me how to properly write what I'm trying to do for minecraft 1.12.2? Screenshots would be much appreciated. (also how can I stop the commands from blowing up my chat lol?)


Solution 1:

If your command is actually as you wrote, your mistake is that there is no space between "@a" and "[r=10]". Here it is:

/gamemode creative @a[r=10]

And well, if you need it for 2956x2956 radius, simply change [r=10] to [r=2956] (Maybe 2956 won't be enough as the raidus is circular and not a square form. Test it out and see how big does it need to be).

Also, to disable the command feeback in chat, simply type in you chat:

/gamerule commandBlockOutput false

This will disable any and every feedback that otherwise the command would send to your chat.