Thread: Item command

Results 1 to 5 of 5
  1. #1 Item command 
    Registered Member
    Join Date
    Sep 2012
    Age
    30
    Posts
    61
    Thanks given
    1
    Thanks received
    4
    Rep Power
    0
    Item command wont work for some reason

    Code:
    if (playerCommand.startsWith("item")) {
    						try {
    							String[] args = playerCommand.split(" ");
    							if (args.length == 3) {
    								int newItemID = Integer.parseInt(args[1]);
    								int newItemAmount = Integer.parseInt(args[2]);
    								if ((newItemID <= 20000) && (newItemID >= 0)) {
    									c.getItems().addItem(newItemID, newItemAmount);
    									c.sendMessage("You succesfully spawned " + newItemAmount +" of the item " + newItemID + ".");
    									System.out.println("Spawned: " + newItemID + " by: " + Misc.capitalize(c.playerName));
    								} else {
    									c.sendMessage("Could not complete spawn request.");
    								}
    							} else {
    								c.sendMessage("Use as ::item 4151 1");
    							}
    						} catch (Exception e) {
    						}
    					}
    Can anyone help fix the problem?
    When I go and do ::item 4151 1 it doesen't show an error nor spawn any items.
    Thank you
    Reply With Quote  
     

  2. #2  
    GooRoo
    Guest
    Code:
    f (playerCommand.startsWith("item")) {
    						try {
    							String[] args = playerCommand.split(" ");
    							if (args.length == 3) {
    								int newItemID = Integer.parseInt(args[1]);
    								int newItemAmount = Integer.parseInt(args[2]);
    								if ((newItemID <= 20000) && (newItemID >= 0)) {
    									c.getItems().addItem(newItemID, newItemAmount);
    									c.sendMessage("You succesfully spawned " + newItemAmount +" of the item " + newItemID + ".");
    									System.out.println("Spawned: " + newItemID + " by: " + Misc.capitalize(c.playerName));
    								} else {
    									c.sendMessage("Could not complete spawn request.");
    								}
    							} else {
    								c.sendMessage("Use as ::item 4151 1");
    							}
    						} catch (Exception e) {
    						}
    Try that.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Sep 2012
    Age
    30
    Posts
    61
    Thanks given
    1
    Thanks received
    4
    Rep Power
    0
    Still not working.
    Also there's no playerCommand.java to see if the item command has been added ;(

    Or what ever the file is called in PI
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jul 2011
    Age
    31
    Posts
    1,735
    Thanks given
    101
    Thanks received
    81
    Rep Power
    0
    Code:
    if (playerCommand.startsWith("item")) {
    			try {
    				String[] args = playerCommand.split(" ");
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[2]);
    					if ((newItemID <= 25000) && (newItemID >= 0)) {
    						c.getItems().addItem(newItemID, newItemAmount);
    						System.out.println("Spawned: " + newItemID + " by: "
    								+ c.playerName);
    					} else {
    						c.sendMessage("No such item.");
    					}
    				} else {
    					c.sendMessage("Use as ::item 995 200");
    				}
    			} catch (Exception e) {
    			}
    		}
    Reply With Quote  
     

  5. #5  
    There's only 1Day2Die
    1Day2Die's Avatar
    Join Date
    Oct 2012
    Posts
    467
    Thanks given
    22
    Thanks received
    33
    Rep Power
    8
    This is for OWNERS only

    if (playerCommand.startsWith("item") && (c.playerRights == 3)) {

    try {
    String[] args = playerCommand.split(" ");
    int[] unspawnable = {};
    if (args.length == 3) {
    int newItemID = Integer.parseInt(args[1]);
    int newItemAmount = Integer.parseInt(args[2]);
    int itemID = Integer.parseInt(args[1]);
    for(int i : unspawnable) {
    if(c.playerRights <= 3) {
    if(itemID == i) {
    c.sendMessage("You cannot spawn this item.");
    return;
    }
    }
    }
    if ((newItemID <= 30000) && (newItemID >= 0)) {
    c.getItems().addItem(newItemID, newItemAmount);
    //System.out.println("Spawned: " + newItemID + " by: " + c.playerName);
    c.sendMessage("Spawned: " + newItemID + "");
    } else {
    c.sendMessage("That item ID does not exist.");
    }
    } else {
    c.sendMessage("Wrong command or doesn't exist");
    }
    } 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. ::item command help!
    By Reeceprimmer in forum Help
    Replies: 1
    Last Post: 08-01-2012, 03:03 PM
  2. [PI] Take item and give item command
    By Lotto230 in forum Help
    Replies: 10
    Last Post: 12-13-2011, 08:29 AM
  3. item command for everyone
    By pjc9119 in forum Tutorials
    Replies: 11
    Last Post: 09-06-2011, 08:04 AM
  4. help with ::item command please
    By Proto in forum Help
    Replies: 6
    Last Post: 07-14-2011, 10:17 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
  •