#how to cancel event?

1 messages · Page 1 of 1 (latest)

leaden elm
#

wdym bruh, all beforeEvents have cancel property.

#

chatSend after and before Events are in still experimental.

#

you can't cancel beforeEvents if you're doing data.cancel = true inside a system.run()

#

then your if check is failing?

fleet bison
#

show full code

#

manifest

leaden elm
#

no

fleet bison
#

no
chat send is beta

#

is beta api enabled?

wind heronBOT
#
Debug Result

There are 3 errors in this [code](#1224829196216438847 message):

message.js:75:18 - error TS18048: 'cr' is possibly 'undefined'.

75     const casr = cr.getScore(player);
                    ~~

``````ansi
message.js:76:24 - error TS2304: Cannot find name 'money'.

76     const moneyScore = money.getScore(player);
                          ~~~~~

``````ansi
message.js:77:16 - error TS18048: 'qpoint' is possibly 'undefined'.

77     const qp = qpoint.getScore(player);
                  ~~~~~~

fleet bison
#

fix those and see

#

also test the event without any code to see if it is working or not

leaden elm
#

oh it's prob logic issue

#

when trying to type .warp hub

you're checking if any string matched inside the commands array.
However, you forgot to split it into tokens. And because of the extra hub, it doesn't find a matching string.

fleet bison
#

huh

#

do console warn

leaden elm
#

have you fixed ur logic issue?

fleet bison
#

nothing?

leaden elm
#

wrap teleport in system.run()

#

system.run(()=>{
player.teleport(warploc[arg]);
})

fleet bison
#

whats in message

#

yep

#

what do you type

#

pretty sure cmds and arg are undefined

#

bruh just type here what you type in game

#

the corrds need to be object with properties x y and z
{x:22,y:33,z:54}

leaden elm
#

it's there

fleet bison
#

cool

leaden elm
#

Cold

fleet bison
#

lol

leaden elm
#

#1224829196216438847 message

#

Me 10 seconds after opening my pack who only have 3 lines of code: "Nah, I'll do this tomorrow"

fleet bison
#

can you send your pack

leaden elm
#

Unnecessary, it's all here

#

I don't think it works in the first place.

fleet bison
#

wired
do console.warn(ev.cancel)

leaden elm
#

The code is "broken" which implies that it was potentially working before. However, I don't see how it was working unless you haven't made the warp system the last time you checked.

#
if (cmds === commands[0]) {
    ev.cancel = true;
    system.run(()=>{
        return ( warploc[arg] ? player.teleport(warploc[arg] : undefined )
    })
}
fleet bison
#

try new world
you said you tried this? no?

world.beforeEvents.chatSend.subscribe((event) => {
    event.cancel = true;
});
#

try new world than

leaden elm
#

you got other pack in that world?

fleet bison
#

i have no idea than
good luck with that