TransWikia.com

how to make setblock a command block with a command that is executed at a certain player

Arqade Asked by trebor97351 on December 25, 2020

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?

2 Answers

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

Answered by ash4fun on December 25, 2020

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.

Answered by scriptmastere02 on December 25, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP