Thread: pi item command hlep..

Results 1 to 6 of 6
  1. #1 pi item command hlep.. 
    Registered Member
    Join Date
    Nov 2009
    Posts
    519
    Thanks given
    135
    Thanks received
    10
    Rep Power
    32
    okai so hears my pi item command currently you can spawn food in wild... i added the

    c.inwild crap but still wont workk.. take a look please...

    f(playerCommand.startsWith("item")||playerCommand. startsWith("pickup")) {
    if (c.inWild() && c.inFFA()) {
    c.sendMessage("Can't do this here bud");
    return;
    }
    try
    {
    if (c.playerRights == 7 || c.playerRights == 6 || c.playerRights == 5)
    {
    return;
    }
    String[] args = playerCommand.split(" ");
    if (args.length == 3)
    {
    int newItemID = Integer.parseInt(args[1]);
    for(int i : restrictedItems) {
    if(i == newItemID) {
    c.sendMessage("This item can only be recieved via PKP Shop or Donator Shop.");
    return;
    }
    }
    int newItemAmount = Integer.parseInt(args[2]);
    if(newItemAmount >= 2147483647) {
    c.sendMessage("Please try spawning a lower amount of items.");
    return;
    }
    if ((newItemID <= 21000) && (newItemID >= 0))
    {
    c.getItems().addItem(newItemID, newItemAmount);
    c.sendMessage("You succesfully spawned @blu@" + newItemAmount +" @bla@of the item @red@" + newItemID + "@bla@.");
    } else
    {
    c.sendMessage("That item ID does not exist.");
    }
    } else
    {
    c.sendMessage("Wrong usage: (Ex::item_ID_Amount)(::item 995 1))");
    }
    } catch (Exception e)
    {

    }
    }
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Oct 2011
    Age
    28
    Posts
    1,880
    Thanks given
    311
    Thanks received
    557
    Rep Power
    703
    Change

    if (c.inWild() && c.inFFA()) {

    to

    if(c.inWild()) {

    ?
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Nov 2009
    Posts
    519
    Thanks given
    135
    Thanks received
    10
    Rep Power
    32
    but i have a dif area and there is a FFa area and i need it so that you cant spawn it there lol.. unless it wont matter because that is considered wild it self..
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Oct 2011
    Age
    28
    Posts
    1,880
    Thanks given
    311
    Thanks received
    557
    Rep Power
    703
    Quote Originally Posted by aki2k4 View Post
    but i have a dif area and there is a FFa area and i need it so that you cant spawn it there lol.. unless it wont matter because that is considered wild it self..
    Code:
    if (c.inWild() && c.inFFA()) {
    c.sendMessage("Can't do this here bud");
    return;
    }
    That says if a player is in the wild AND in FFA at the same time it will execute whatever is in the brackets.


    So try this:
    Code:
    if (c.inWild() || c.inFFA()) {
    c.sendMessage("Can't do this here bud");
    return;
    }
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Spoonfeed Me Bitch
    AddictivePkz's Avatar
    Join Date
    Jun 2012
    Age
    28
    Posts
    733
    Thanks given
    79
    Thanks received
    51
    Rep Power
    0
    Quote Originally Posted by Revival View Post
    Code:
    if (c.inWild() && c.inFFA()) {
    c.sendMessage("Can't do this here bud");
    return;
    }
    That says if a player is in the wild AND in FFA at the same time it will execute whatever is in the brackets.


    So try this:
    Code:
    if (c.inWild() || c.inFFA()) {
    c.sendMessage("Can't do this here bud");
    return;
    }
    Yeah I was about to say that . It should work , I use that in my source
    Quote Originally Posted by Fakeblitz View Post
    What does [PI] mean? (sorry i am used to 503+)
    And what base is this?
    Reply With Quote  
     

  7. #6  
    Registered Member
    jordan641's Avatar
    Join Date
    Apr 2010
    Posts
    1,807
    Thanks given
    70
    Thanks received
    128
    Rep Power
    189
    Your conventions make me want to kill myself

    Use this to auto-format your code: http://jsbeautifier.org/

    Code:
    f(playerCommand.startsWith("item") || playerCommand.startsWith("pickup")) {
        if (c.inWild() && c.inFFA()) {
            c.sendMessage("Can't do this here bud");
            return;
        }
        try {
            if (c.playerRights == 7 || c.playerRights == 6 || c.playerRights == 5) {
                return;
            }
            String[] args = playerCommand.split(" ");
            if (args.length == 3) {
                int newItemID = Integer.parseInt(args[1]);
                for (int i: restrictedItems) {
                    if (i == newItemID) {
                        c.sendMessage("This item can only be recieved via PKP Shop or Donator Shop.");
                        return;
                    }
                }
                int newItemAmount = Integer.parseInt(args[2]);
                if (newItemAmount >= 2147483647) {
                    c.sendMessage("Please try spawning a lower amount of items.");
                    return;
                }
                if ((newItemID <= 21000) && (newItemID >= 0)) {
                    c.getItems().addItem(newItemID, newItemAmount);
                    c.sendMessage("You succesfully spawned @blu@" + newItemAmount + " @bla@of the item @red@" + newItemID + "@bla@.");
                } else {
                    c.sendMessage("That item ID does not exist.");
                }
            } else {
                c.sendMessage("Wrong usage: (Ex::item_ID_Amount)(::item 995 1))");
            }
        } catch (Exception e) {
    
        }
    }
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Take item and give item command
    By Lotto230 in forum Help
    Replies: 10
    Last Post: 12-13-2011, 08:29 AM
  2. [pi] item command
    By x Shoter x in forum Help
    Replies: 7
    Last Post: 09-18-2011, 11:07 PM
  3. [PI] Item Command
    By Spider- in forum Help
    Replies: 6
    Last Post: 09-03-2011, 05:17 PM
  4. Item command
    By Diverse Reality in forum Help
    Replies: 3
    Last Post: 04-24-2011, 05:32 PM
  5. ::item command Finding your item?
    By zx Bubbles zx in forum Requests
    Replies: 10
    Last Post: 11-10-2008, 06:41 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •