world.beforeEvents.chatSend.subscribe((eventData) => {
const player = eventData.sender;
switch (eventData.message) {
case '?accept':
eventData.cancel = true;
player.runCommandAsync('tp @p[tag=tpr] @s[tag=tpa]') && player.runCommandAsync('tag @a remove tpa') && player.runCommandAsync('tag @a remove tpr');
break;
}
});```
#My chatsend event isnt working
1 messages · Page 1 of 1 (latest)
Description
A script that detects a chat message then the script handles all custom command inputs and outputs
Credits
These scripts were written by Smell of Curry
Minecraft vstable
·
you don't need the && statements
oh ok
import { sendPlayerMessage, config } from '../../../config';
export function acceptHelp(player) {
sendPlayerMessage(player, `§7[§c!§7]: -- §bSaturn Lifesteal Help Page §7-- §bAccept§7
> Accept a tp request
> Usage: ${config.prefix}accept
> Examples:
${config.prefix}accept
`);
}
new Command({
name: 'accept',
code({ player, args }) {
if (!player.hasTag(`tpa`))
return sendPlayerMessage(player, `§cAccepted tp request!`);
player.runCommandAsync('tp @p[tag=tpr] @s[tag=tpa]')
player.runCommandAsync('tag @a remove tpa') && player.runCommandAsync('tag @a remove tpr');
}
});```
changed my code completly and added a handler
but still isnt working
wait
i got it working but it sends it in chat still
alright i will test it
export { Command };
export const commands = Command.commands;
world.beforeEvents.chatSend.subscribe(data => {
if (data.message.startsWith("!")) {
data.cancel = true;
const args = data.message.slice(config.prefix.length).toLowerCase().split(/\s+/g);
const command = args.shift();```
When u plugged it in it didnt work and made the commands stop working here is what i have