So i have a small issue with my custom commands, where when i use a command it still sends the message of the command instead of hiding it
Code:
world.beforeEvents.chatSend.subscribe((eventData) => {
const player = eventData.sender;
if (!player.hasTag('owner' || 'admin' || 'staff')) {
const commandMapping = {
'!help': 'say test',
'!lobby': 'function tp/lobby'
};
const command = commandMapping[eventData.message];
if (command) {
player.runCommandAsync(command);
eventData.cancel = true;
}
} else {
const commandMapping = {
'!gmc': 'gamemode c',
'!gma': 'gamemode a',
'!gms': 'gamemode spectator'
};
const command = commandMapping[eventData.message];
if (command) {
player.runCommandAsync(command);
eventData.cancel = true;
}
}
});