#!carry Help
1 messages · Page 1 of 1 (latest)
-Wrong syntax of events.
-Use console.warn() instead of console.log().
-Make sure your manifest script version is -beta.
-BETA API World Settings must be turned on.
and use sendMessage instead of using tellraw on runCommand.
import { world } from "@minecraft/server";
const carryingMap = new Map();
world.beforeEvents.chatSend.subscribe((event) => {
const player = event.sender;
console.warn(`[DEBUG] Chat detected from ${player.name}: "${event.message}"`); // debug log
// Cancel all chat for testing
event.cancel = true;
const message = event.message.trim().toLowerCase();
if (message === "!carry") {
console.warn(`[DEBUG] !carry triggered by ${player.name}`);
// check tag
if (player.hasTag("devil")) {
player.sendMessage(`You can't carry a devil fruit user!`)
return;
}
// find nearby devil fruit user
const nearby = player.dimension.getPlayers({ location: player.location, maxDistance: 3 });
let found = false;
for (const p of nearby) {
if (p.hasTag("devil") && !Array.from(carryingMap.values()).includes(p)) {
found = true;
carryingMap.set(player, p);
player.sendMessage(`You are now carrying ${p.name}!`);
p.sendMessage(`You are being carried by ${player.name}!`);
break;
}
}
if (!found) player.sendMessage(`No devil fruit users nearby!`);
}
if (message === "!release") {
if (carryingMap.has(player)) {
const p = carryingMap.get(player);
carryingMap.delete(player);
player.sendMessage(`You released ${p.name}.`);
p.sendMessage(`You were released by ${player.name}.`);
} else {
player.sendMessage(`You are not carrying anyone!`);
}
}
});
and don't use AI.
so can you make it so it add the /carry system so when someone do /carry to a user with a tag named devil and they are in water it removes their perms and tp's the player with devil tag to the player whos /carrying him until he releases him?
i can't, but you can