how to make setblock a command block with a command that is executed at a certain player
I have made a minigame on my server, mctrees.net, using command blocks but it dosen't work with multiplayer so I would like to make it place the commands that run for the game but for it to make it specific to each player. e.g. I have a command that usually gets run:
/setblock @p[r=10] dirt ~ ~10 ~
and I would like to make it setblock that command in a command block when a player (trebor97351) starts the game. it should setblock a command block with the command:
/setblock trebor97351[r=10] dirt ~ ~10 ~
How would I do this? I know that you can place command blocks with prefilled commands but you can't specify a player when doing that?
Best Answer
By the way, unless you have a mod changing this, the syntax for /setblock
has no player selectors. You can, however, use /execute
, along with [name=]
, to accomplish this:
/execute @p[r=10,name=<username>] ~ ~ ~ setblock ~ ~10 ~ minecraft:dirt
Pictures about "how to make setblock a command block with a command that is executed at a certain player"
How do you make a Setblock command?
How to Enter the CommandHow make command block activate with command?
Go to the \u201cserver. properties\u201d file in your server's config files. Change the line that says \u201cenable-command-block=false\u201d to \u201cenable-command-block=true\u201d Give yourself a Command Block by opening the chat box and entering \u201c/give [your username] minecraft:command_block\u201dWhat does the Setblock command do in Minecraft?
Use /setblock! The /setblock command in Minecraft allows the user to change a block at a specific coordinates in their current Minecraft world to the block specified. The usage and syntax of this command depends on which platform (Java or Bedrock) you are using it.Can you make a command block do multiple things?
To make your command block run multiple commands, you will need to summon FallingSand or falling_block (depending on your version of Minecraft) with command blocks and redstone blocks for each command. The command blocks will be stacked one on top of the other and contain the individual command.How to setblock a Command Block WITH A COMMAND!
More answers regarding how to make setblock a command block with a command that is executed at a certain player
Answer 2
make a certain score. for example apply
then try this
execute @a[score_apply_min=0,score_apply=0] ~ ~ ~ setblock ~ ~10 ~ minecraft:dirt
score_apply_min=0
tests for players with a score of 0 as minimum
score_apply=0
(must be with score_apply_min=0
) acts as the maximum value for the score apply
.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Pressmaster, Pressmaster, Ivan Babydov, Anete Lusina