Vintage-Point
April 19, 2024, 08:58:45 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Post frequently for awesome ranks!
 
  Home Help Search Spend Post Points! Server toplist Donate Buy VIP Staff List Login Register  

Snippet Example

Pages: [1]   Go Down
  Print  
Author Topic: Snippet Example  (Read 48 times)
Malik
Main-Owner
Vintage
*

Reputation: 43594
Offline Offline

Posts: 16777214


Owner


View Profile
Badges: (View All)
Karma Good Karma Bad Search
« on: October 04, 2012, 12:13:24 am »

Money pouch withdraw code [Release]

Paste this into commands.java

Code:
public void playerCommands(Client c, String playerCommand)
    {
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 == 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);
}
}

Note: This is just the withdraw command.

« Last Edit: October 04, 2012, 05:03:20 am by Malik » Report Spam   Logged

Share on Facebook Share on Twitter



Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
some_text some_text some_text some_text
Bookmark this site! | Upgrade This Forum
Free SMF Hosting - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy