how do i make it so that when you withdraw say 2b coins from your money pouch and you have 500m coins it wont delete the extra 353m (about) coins and instead add them into your money pouch?
Current Code
Code:
if(playerCommand.startsWith("withdraw")) {
String[] cAmount = playerCommand.split(" ");
int amount = Integer.parseInt(cAmount[1]);
if (c.inWild()) {
c.sendMessage("You cannot do this in the wilderness");
c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
return;
}
if (amount < 1) {
return;
}
if(amount == 0) {
c.sendMessage("Why would I withdraw no coins?");
return;
}
if(c.MoneyCash == 0) {
c.sendMessage("You don't have any cash in the bag.");
c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
return;
}
if(c.MoneyCash < amount) {
if(amount == 1) {
c.sendMessage("You withdraw 1 coin.");
} else {
c.sendMessage("You withdraw "+c.MoneyCash+" coins.");
}
c.getItems().addItem(995, c.MoneyCash);
c.MoneyCash = 0;
c.getPA().sendFrame126(""+c.MoneyCash+"", 8134);
c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
return;
}
if(c.MoneyCash != 0) {
if(amount == 1) {
c.sendMessage("You withdraw 1 coin.");
} else {
c.sendMessage("You withdraw "+amount+" coins.");
}
c.MoneyCash -= amount;
c.getItems().addItem(995, amount);
c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
if(c.MoneyCash > 99999 && c.MoneyCash <= 999999) {
c.getPA().sendFrame126(""+c.MoneyCash/1000+"K", 8134);
} else if(c.MoneyCash > 999999 && c.MoneyCash <= 2147483647) {
c.getPA().sendFrame126(""+c.MoneyCash/1000000+"M", 8134);
} else {
c.getPA().sendFrame126(""+c.MoneyCash+"", 8134);
}
c.getPA().sendFrame126(""+c.MoneyCash+"", 8135);
}
}