Author Topic: [PI] checkbank/checkinv commands  (Read 382 times)

Offline brandon

  • Veteran
  • Dragon Member
  • *
  • Posts: 240
  • Rep 12
    • View Profile
[PI] checkbank/checkinv commands
« on: March 08, 2011, 01:01:57 pm »
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.
« Last Edit: March 08, 2011, 01:09:04 pm by brandon »

Share on Bluesky Share on Facebook


Offline I Divine I

  • Adamant Member
  • *
  • Posts: 110
  • Rep 8
  • Proud Member of Rune-Kingdom.
  • Location: Look behind you.
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #1 on: March 08, 2011, 08:27:26 pm »
that will help ME
I cant figure out how to get my sig pic damit!

Offline Jake

  • Bandos Member
  • *
  • Posts: 419
  • Rep 4
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #2 on: March 09, 2011, 12:16:22 am »
Cool, I might use this sometime, I'm planning on making a PI just for fun :P.

Offline brandon

  • Veteran
  • Dragon Member
  • *
  • Posts: 240
  • Rep 12
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #3 on: March 09, 2011, 11:47:22 am »
Cool, I might use this sometime, I'm planning on making a PI just for fun :P.

Need any help? Just ask.  :)

Offline Scar

  • Steel Member
  • *
  • Posts: 34
  • Rep 1
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #4 on: March 12, 2011, 04:14:32 am »
Why does it check what's the max players?

Offline brandon

  • Veteran
  • Dragon Member
  • *
  • Posts: 240
  • Rep 12
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #5 on: March 12, 2011, 11:45:40 am »
To see if the player is online. Thats how I set it up on my server, but it will work with no errors on any PI server, unless you did something way out there. :P

Offline Scar

  • Steel Member
  • *
  • Posts: 34
  • Rep 1
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #6 on: March 13, 2011, 01:44:20 am »
So for instance MAX_PLAYERS is 512.
It checks it, gets the int 512.
Int 512 decides if the player is online?
 :fp:

Offline brandon

  • Veteran
  • Dragon Member
  • *
  • Posts: 240
  • Rep 12
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #7 on: March 13, 2011, 03:41:14 am »
Pretty much, thats just how its set up don't start trolling and flaming. Not a good idea...

Offline Scar

  • Steel Member
  • *
  • Posts: 34
  • Rep 1
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #8 on: March 13, 2011, 04:52:10 am »
Theres a Boolean called
Code: [Select]
public static boolean isPlayerOn(String playerName) { in PI.
Everyone uses PI hence they can't learn ****.
Excluding some people.

Offline brandon

  • Veteran
  • Dragon Member
  • *
  • Posts: 240
  • Rep 12
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #9 on: March 13, 2011, 02:10:42 pm »
Theres a Boolean called
Code: [Select]
public static boolean isPlayerOn(String playerName) { in PI.
Everyone uses PI hence they can't learn ****.
Excluding some people.

What are you trying to say... :P

Offline robgob

  • Adamant Member
  • *
  • Posts: 120
  • Rep 5
  • I swarm like locust
  • Location: Michigan
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #10 on: March 15, 2011, 07:54:57 am »
So for instance MAX_PLAYERS is 512.
It checks it, gets the int 512.
Int 512 decides if the player is online?
 :fp:
What are you talking about?
It looks for the player of choice in a loop (from 0 to MAX_PLAYERS) max players being whatever you set it to. in your case 512 players? anyways..

the player being connected and set to a slot in the players[] array depends if the player is logged on.. lol

Offline Alex_Kilroy

  • Adamant Member
  • *
  • Posts: 91
  • Rep 2
  • Java programmer
  • Location: United Kingdom, England.
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #11 on: March 15, 2011, 07:57:38 am »
So for instance MAX_PLAYERS is 512.
It checks it, gets the int 512.
Int 512 decides if the player is online?
 :fp:
What are you talking about?
It looks for the player of choice in a loop (from 0 to MAX_PLAYERS) max players being whatever you set it to. in your case 512 players? anyways..

the player being connected and set to a slot in the players[] array depends if the player is logged on.. lol

Just ignore him, let him think hes right.
I'm a MEXICAN
#facepalm
My various other names are, Byte3, Kaex and Limbo.
I am now known as Alex_Kilroy.

Offline robgob

  • Adamant Member
  • *
  • Posts: 120
  • Rep 5
  • I swarm like locust
  • Location: Michigan
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #12 on: March 15, 2011, 07:59:21 am »
Ignore me?

Offline brandon

  • Veteran
  • Dragon Member
  • *
  • Posts: 240
  • Rep 12
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #13 on: March 15, 2011, 10:58:48 am »
Ignore me?

Hes talking about Scar.

Offline Alex_Kilroy

  • Adamant Member
  • *
  • Posts: 91
  • Rep 2
  • Java programmer
  • Location: United Kingdom, England.
    • View Profile
Re: [PI] checkbank/checkinv commands
« Reply #14 on: March 15, 2011, 11:37:08 am »
I'm a MEXICAN
#facepalm
My various other names are, Byte3, Kaex and Limbo.
I am now known as Alex_Kilroy.