How To Change The Gamemode For A Specific Player? - Minecraft Forum
Maybe your like
Help Sign In/Register
- Home
- Minecraft Forum
- Minecraft: Java Edition
- Redstone Discussion and Mechanisms
- Commands, Command Blocks and Functions
- How to change the gamemode for a specific player?
- Home
- Minecraft Forum
- Minecraft: Java Edition
- Redstone Discussion and Mechanisms
- Commands, Command Blocks and Functions
- How to change the gamemode for a specific player?
Tag » How To Put A Player In Survival Mode
-
How To Use Minecraft Server Commands - Getting Started
-
Command Help: Force Any Player To Be In Creative Mode ... - YouTube
-
How To Use The GameMode Command In Minecraft
-
Commands/gamemode - Minecraft Wiki - Fandom
-
How To Change The Game Mode In Minecraft At Any Time
-
How To Set Players Into Creative Mode When They Join The Game?
-
How To Make Only Myself In "creative Mode" While Everyone Else Is ...
-
How Do I Give Creative Mode In Minecraft? - Quora
-
Survival Mode - Wikipedia
-
[PDF] A Parent's Guide To Minecraft
-
How To /tp Only Players In Survival? - Arqade
-
Set Game Mode - Microsoft MakeCode For Minecraft
-
Player In Game Mode - Microsoft MakeCode For Minecraft
-
Getting Amount Of Players In Survival Mode - Spigot
I want to change the gamemode of a specific player when he enters an area using a command block.
Not sure how to do it:
Tried: (not working)
/gamemode survival @e[m=2,r=20,name=playername] <<=== solved, this works
/gamemode survival @playername[m=2,r=20]
Last edited by herbapou: Jul 31, 2017 Rollback Post to Revision RollBack- Stone Miner
- Join Date: 1/29/2016
- Posts: 81
- Member Details
indeed. But I want to set the game mode for a specific player. Rollback Post to Revision RollBackok I solved it.
The first command I tried works. I had conflicting commands that bug it.
So this works: It will change playername from gamemode adventure to survival.
/gamemode survival @e[m=2,r=20,name=playername]
Rollback Post to Revision RollBackI'm trying to figure this out... I would have thought that @p[r=20, name=playername] would have worked, but if it doesn't, maybe you need to do a work-around... put
gamemode survival playername
into one function (functions/herbapou/utility/playernamemode.mcfunction ) and
execute playername ~ ~ ~ summon minecraft:vex ~ ~1 ~ {CustomName:trigger,NoAI:1b,Silent:1,ActiveEffects:[{Id:14,Amplifier:0,Duration:2147483647}]}
Into another function (I picked the Vex because it naturally despawns after a short while.) Call this one functions/herbapou/utility/playernametrigger.mcfunction.
Then, at your desired location, have two repeating command blocks:
/function herbapou:utility/playernamemode if @e[r=20, name="trigger"]
And:
/function herbapou:utility/playernametrigger if @p[r=20, m=adventure]
What this does is it summons a named vex at the named player's location, regardless of whether the player is nearby, any time any player at all enters the area, then the other block checks if a vex with that name exists within the area, which only happens if the player is in the area. If there is a vex with that name, the player's game mode is changed.
I suppose this could be compacted. But someone else is going to have to figure it out.
Rollback Post to Revision RollBack- Redstone Miner
- Join Date: 11/1/2010
- Posts: 532
- Minecraft: Vindicar
- Member Details
Except it will also work for ANY entity with the same name, like a nametagged mob. I suggest you use @a selector instead of @e. Rollback Post to Revision RollBack- Stone Miner
- Join Date: 1/29/2016
- Posts: 81
- Member Details
thanks Rollback Post to Revision RollBack