#need help

1 messages · Page 1 of 1 (latest)

knotty crow
#

why i can't replace the world.sensMessage with for example player.runCommand he's say player is not defined why ?
thsi is the cod

function checkItem() {
    const overworld = world.getDimension("overworld");
    const items = overworld.getEntities({ type: "minecraft:item" }).filter(i => i.getComponent("minecraft:item").itemStack.typeId == "minecraft:stick");
    if(!items) return;
    const locs = items.map(item => item.location);
    for(let i = 0; i < items.length; i++) {
        const { x, y, z } = items[i].location;
        if(overworld.getBlock({ x, y: y - 1, z }).typeId == "minecraft:stone"){
            world.sendMessage("It works!");
            items[i].kill();
        }
    }
};
warm zodiac
#

You have to get the player from events or something
If you have the player just add the argument to the function

knotty crow
#

@warm zodiac but how to get the player 🙂

warm zodiac
#

Like chatSend
ItemUse
They all have data of like message sender, player who used the item

knotty crow
#

@warm zodiac Soo are there any other method to run command without use player.

warm zodiac
knotty crow
rugged shoalBOT
#
Does it work on Marketplace?

Not allowed:

  • Anything beta
  • Anything experimental
  • Gametest
  • Shaders
  • Guns, drugs, violence, religion etc.

Whats allowed?
Everything that isn't shown above. Custom items for example are allowed, as long as you don't use the new experimental components.

Pretty much, if it works in a non-beta, non-experimental world, and it isn't using scripts or shaders, its good.

Why did I see a map using Experimental?
Some maps get special permission from Microsoft to use Experimental. These are usually free, or intended specifically to show-off the new creator-features. You are unlikely to get the same permission.

knotty crow
warm zodiac
#

items[i].runCommand("your command")

#

It might work