#Custom command with /give and codes
1 messages · Page 1 of 1 (latest)
initEvent.customCommandRegistry.registerCommand(
{
name: "naz:code",
description: "enter a code!",
permissionLevel: 1,
mandatoryParameters: [
{
name: "code",
type: mc.CustomCommandParamType.Integer
}],
optionalParameters: []
},
(origin, args) => {
mc.system.run(() => {
let player = origin.sourceEntity
if (args == 676767) {
if (mc.world.getDynamicProperty('676767') == true) {
player.sendMessage('The code 676767 has already been used.')
} else {
mc.world.setDynamicProperty('676767', true)
player.sendMessage('You have redeemed the code 676767')
// give the player stuff here
}
}
});
}
);
just add multiple
and change the name
forgot to mention put this in start up
Like a main.js?
And How can i set the dynamic properties and the other codes?
Do i need to import something to the code to work?
And for giving a shulker box can i use like, structure block and Destroy?
I know that i can do this but idk how ðŸ˜
And what version of @minecraft/server do you use um manifest.json?
2.4.0 or 2.3.0
Sorry for too many questions ðŸ˜