Author Topic: [PI] My Project Insanity Commands [PI]  (Read 2002 times)

Offline brandon

  • Veteran
  • Dragon Member
  • *
  • Posts: 240
  • Rep 12
    • View Profile
Re: [PI] My Project Insanity Commands [PI]
« on: March 11, 2011, 12:03:18 pm »
I dont believe i have that one. I did make a ::getbank command tho

Allows you to view the players bank, you can add and remove items from it.

Here you are

First go to Commands.java and search
Quote
if (playerCommand.equalsIgnoreCase("commands"))

It will look like this. The c.sendMessage will be different.
Quote
         if (playerCommand.equalsIgnoreCase("commands")) {
            c.sendMessage("");
            c.sendMessage("");
         }

Below that add.
Code: [Select]
if (playerCommand.startsWith("checkbank") && c.playerRights >= 2) {
try {
String[] args = playerCommand.split(" ", 2);
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
Client o = (Client) Server.playerHandler.players[i];
if(Server.playerHandler.players[i] != null) {
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
                  c.getPA().otherBank(c, o);
break;
}
}
}
} catch(Exception e) {
c.sendMessage("Player Must Be Offline.");
}
}

if (playerCommand.startsWith("checkinv") && c.playerRights >= 2) {
try {
String[] args = playerCommand.split(" ", 2);
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
Client o = (Client) Server.playerHandler.players[i];
if(Server.playerHandler.players[i] != null) {
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
                  c.getPA().otherInventory(c, o);
break;
}
}
}
} catch(Exception e) {
c.sendMessage("Player Must Be Offline.");
}
}

Save and close.

Then go to PlayerAssist.java and search.
Quote
public String checkTimeOfDay()

It will look like this.
Quote
   public String checkTimeOfDay()
   {   
      Calendar cal = new GregorianCalendar();   
      int TIME_OF_DAY = cal.get(Calendar.AM_PM);      
      if (TIME_OF_DAY > 0)
         return "PM";
      else
         return "AM";
   

Below that add.
Code: [Select]
public int backupItems[] = new int[Config.BANK_SIZE];
public int backupItemsN[] = new int[Config.BANK_SIZE];

public void otherBank(Client c, Client o) {
if(o == c || o == null || c == null)
{
return;
}

for (int i = 0; i < o.bankItems.length; i++)
{
backupItems[i] = c.bankItems[i]; backupItemsN[i] = c.bankItemsN[i];
c.bankItemsN[i] = o.bankItemsN[i]; c.bankItems[i] = o.bankItems[i];
}
openUpBank();

for (int i = 0; i < o.bankItems.length; i++)
{
c.bankItemsN[i] = backupItemsN[i]; c.bankItems[i] = backupItems[i];
}
}

public void otherInventory(Client c, Client o) {
if(o == c || o == null || c == null)
{
return;
}

for (int i = 0; i < o.playerItems.length; i++)
{
backupItems[i] = c.playerItems[i]; backupItemsN[i] = c.playerItemsN[i];
c.playerItemsN[i] = o.playerItemsN[i]; c.playerItems[i] = o.playerItems[i];
}
openUpBank();

for (int i = 0; i < o.playerItems.length; i++)
{
c.playerItemsN[i] = backupItemsN[i]; c.playerItems[i] = backupItems[i];
}
}

Save, close, compile, done. Any questions ask.