Thread: PI What's up with this command?

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36
  1. #1 PI What's up with this command? 
    So when I'm free, I'm free


    Jay Gatsby's Avatar
    Join Date
    Jun 2010
    Posts
    2,307
    Thanks given
    1,148
    Thanks received
    1,982
    Rep Power
    5000
    Hey guys, I've got this command:
    Code:
     if (playerCommand.startsWith("item")&& c.playerRights >= 0) {
    				try {
    					String[] args = playerCommand.split(" ");
    					if (args.length == 3) {
    						int newItemID = Integer.parseInt(args[1]);
    						int newItemAmount = Integer.parseInt(args[2]);
    						if ((newItemID <= 22500) && (newItemID >= 0)) {
    							c.getItems().addItem(newItemID, newItemAmount);		
    						} else {
    							c.sendMessage("That item ID does not exist.");
    						}
    					} else {
    						c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
    					}
    				} catch(Exception e) {
    					
    				} 
    			
    				}
    But it won't work? Like, I get no compile errors but when I do ::item as a normal rank, it just won't spawn anything.
    Anyone have any ideas why? Using PI.
    Reply With Quote  
     

  2. #2  
    Member
    Join Date
    Dec 2008
    Posts
    69
    Thanks given
    20
    Thanks received
    12
    Rep Power
    0
    Reply With Quote  
     

  3. #3  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Is it placed properly?

    For example, if your commands are separated into different areas of rank, then make sure it's under the right place.
    Reply With Quote  
     

  4. #4  
    So when I'm free, I'm free


    Jay Gatsby's Avatar
    Join Date
    Jun 2010
    Posts
    2,307
    Thanks given
    1,148
    Thanks received
    1,982
    Rep Power
    5000
    Quote Originally Posted by Zivik View Post
    Is it placed properly?

    For example, if your commands are separated into different areas of rank, then make sure it's under the right place.
    Yup, placed underneath playercommands.

    The above code didn't work either D:
    Reply With Quote  
     

  5. #5  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Does it work for higher playerRights
    Reply With Quote  
     

  6. #6  
    So when I'm free, I'm free


    Jay Gatsby's Avatar
    Join Date
    Jun 2010
    Posts
    2,307
    Thanks given
    1,148
    Thanks received
    1,982
    Rep Power
    5000
    It does work for higher playerrights yes.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Dec 2012
    Posts
    307
    Thanks given
    63
    Thanks received
    36
    Rep Power
    9
    then its placed in the wrong area most likely
    Reply With Quote  
     

  8. #8  
    So when I'm free, I'm free


    Jay Gatsby's Avatar
    Join Date
    Jun 2010
    Posts
    2,307
    Thanks given
    1,148
    Thanks received
    1,982
    Rep Power
    5000
    Quote Originally Posted by pkerrrr View Post
    then its placed in the wrong area most likely
    Seriously, it's placed like right below the playerrcommands.

    Code:
     public void playerCommands(Client c, String playerCommand){
            if(playerCommand.equalsIgnoreCase("players")){
                c.sendMessage("There are currently " + PlayerHandler.getPlayerCount() + " players online!");
            }
             if (playerCommand.startsWith("item")) {
                            if (c.inWild()) {
                            c.sendMessage("you can't spawn items in the wilderness!");
                            return;
                            }
                                    try {
                                    String[] args = playerCommand.split(" ");
                                    if (args.length == 3) {
                                    int newItemID = Integer.parseInt(args[1]);
                                    int newItemAmount = Integer.parseInt(args[2]);
                                    for (int i : restrictedItems) {
                                                    if (i == newItemID) {
                                                            if (c.playerRights != 3 && c.playerRights != 2) {
                                                                    c.sendMessage("You can't spawn this item!");
                                                            return;
                                                            }
                                                    }
                                            }
                                    if (newItemID <= 30000 && newItemID >= 0) {
                                            c.getItems().addItem(newItemID, newItemAmount);
                                    } else {
                                            c.sendMessage("You can't spawn this item!");
                                    }
                                    } else {
                                            c.sendMessage("Wrong usage: (Ex:(::item_ID_Amount)(::item 995 1))");
                                    }
                                    } catch(Exception e) {
                            }}
    Alright so it's the second command.
    Reply With Quote  
     

  9. #9  
    Registered Member Rojeh's Avatar
    Join Date
    Jun 2012
    Posts
    353
    Thanks given
    7
    Thanks received
    20
    Rep Power
    75
    Quote Originally Posted by Harryy View Post
    Seriously, it's placed like right below the playerrcommands.

    Code:
     public void playerCommands(Client c, String playerCommand){
            if(playerCommand.equalsIgnoreCase("players")){
                c.sendMessage("There are currently " + PlayerHandler.getPlayerCount() + " players online!");
            }
             if (playerCommand.startsWith("item")) {
                            if (c.inWild()) {
                            c.sendMessage("you can't spawn items in the wilderness!");
                            return;
                            }
                                    try {
                                    String[] args = playerCommand.split(" ");
                                    if (args.length == 3) {
                                    int newItemID = Integer.parseInt(args[1]);
                                    int newItemAmount = Integer.parseInt(args[2]);
                                    for (int i : restrictedItems) {
                                                    if (i == newItemID) {
                                                            if (c.playerRights != 3 && c.playerRights != 2) {
                                                                    c.sendMessage("You can't spawn this item!");
                                                            return;
                                                            }
                                                    }
                                            }
                                    if (newItemID <= 30000 && newItemID >= 0) {
                                            c.getItems().addItem(newItemID, newItemAmount);
                                    } else {
                                            c.sendMessage("You can't spawn this item!");
                                    }
                                    } else {
                                            c.sendMessage("Wrong usage: (Ex:(::item_ID_Amount)(::item 995 1))");
                                    }
                                    } catch(Exception e) {
                            }}
    Alright so it's the second command.
    It might be placed twice which cause the problem . make sure it isn't placed in any other place
    Search for ("item") and if there is remove it.
    • If it been done before you can do it too!
    • We're all humans, built from the same resources by different layouts and schemes.
    • Nobody is perfect, everyone has their own defects and disabilities.
    • Choose to be kind, not because you have to but because you understand how it feels to be treated bad.
    • Be against racism regardless of how you were raised because nobody loves feeling odd and not belonging.
      If any of the above inspires you make sure to pass it on
    Reply With Quote  
     

  10. #10  
    So when I'm free, I'm free


    Jay Gatsby's Avatar
    Join Date
    Jun 2010
    Posts
    2,307
    Thanks given
    1,148
    Thanks received
    1,982
    Rep Power
    5000
    Nope, it's only placed there.
    This is such a strange problem!
    Reply With Quote  
     

Page 1 of 4 123 ... LastLast

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] wtf is up with this?!
    By Ninja assassin in forum Help
    Replies: 8
    Last Post: 11-11-2010, 05:01 PM
  2. What's wrong with this command?
    By Zahhak in forum Help
    Replies: 4
    Last Post: 12-24-2009, 05:30 AM
  3. what is up with this
    By Simon in forum Help
    Replies: 0
    Last Post: 09-28-2009, 06:21 PM
  4. What is wrong with this command?
    By 3m0 f0x in forum Help
    Replies: 9
    Last Post: 08-10-2009, 05:18 AM
  5. What's up with this?
    By 'Mystic Flow in forum Chat
    Replies: 11
    Last Post: 07-24-2009, 05:02 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
  •