#Code not stopping

1 messages · Page 1 of 1 (latest)

rigid elbow
#
deposit.show(player).then(result => {
        const amount = result.formValues[0]
        const toggle = result.formValues[1]
        if (amount > getScore(player, 'gold')) {
            player.tell("§cYou don't have that enough money!")
            player.runCommandAsync("playsound note.bass @s")
        } else if (amount <= getScore(player, 'gold')) {
        player.runCommandAsync(`scoreboard players remove @s gold ${amount}`)
        player.runCommandAsync(`scoreboard players add @s bank ${amount}`)
        }
        if (toggle == true && amount <= getScore(player, 'gold')) {
            world.say(` §7${player.name} deposited $${amount}`)
            player.runCommandAsync("playsound random.toast @s")
        } else if (toggle == false && amount <= getScore(player, 'gold')) {
            player.tell(` §7Transaction §2Completed!`)
            player.runCommandAsync("playsound random.toast @s")
        }
        if (isNaN(amount)) {
            player.tell("§cAmount cannot contain letters!")
            player.runCommandAsync("playsound note.bass @s")
        }
        if (amount < 0) {
            player.tell("Amount cannot contain negative values!")
            player.runCommandAsync("playsound note.bass @s")
        }
    })```
The thing don't work is 
```js
if (amount < 0) {}

I tried stopping the transaction after that error with return, it doesn't work

#

It doens't work

#

I want after the

if (amount < 0) {
     player.tell("Amount cannot contain negative values!")
     player.runCommandAsync("playsound note.bass @s")
}
#

Stop the transaction

rare narwhal
#

I had this problem too, cus this is alt acc

carmine zephyr
#
const a = '-10'
console.log(`a >= 10 : ${a>=10}\na < 10: ${a<10}\na < 0: ${a<0}`)
summer rockBOT
rigid elbow
#
const a = '-10'
console.log(`a >= 10 : ${a>=10}\na < 10: ${a<10}\na > 0: ${a>0}`)
summer rockBOT
rigid elbow
#

So i need to change < to >?@carmine zephyr

carmine zephyr
#

No, put the if negative on top

rigid elbow
#

Ohokay