Thread: Pickup Command

Results 1 to 6 of 6
  1. #1 Pickup Command 
    Blue Riband
    Guest
    Code:
    if (playerCommand.startsWith("pickup")) && playerRights >3 {
    		        	String[] args = command.split(" ");
    	         		if(args.length == 3) {
    			int newItemID = Integer.parseInt(args[1]);
    			int newItemAmount = Integer.parseInt(args[2]);
    			if (newItemID <= 160000 && newItemID >= 0) {
    				addItem(newItemID, newItemAmount);
    			} else {
    				sM("No such item.");
    			}
    		} else {
    			sM("Invalid Syntax! ::pickup ID AMOUNT");
    		}
    	    }
    }
    I am using Project Insanity and i can't get the command right.

    Code:
    src\server\model\players\packets\Commands.java:207: illegal start of expression
                            if (playerCommand.startsWith("pickup")) && playerRights >3 {
                                                                    ^
    src\server\model\players\packets\Commands.java:207: not a statement
                            if (playerCommand.startsWith("pickup")) && playerRights >3 {
                                                                                    ^
    src\server\model\players\packets\Commands.java:207: ';' expected
                            if (playerCommand.startsWith("pickup")) && playerRights >3 {
                                                                                      ^
    src\server\model\players\packets\Commands.java:352: class, interface, or enum expected
    }
    ^
    4 errors
    Press any key to continue . . .
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Mar 2010
    Posts
    175
    Thanks given
    3
    Thanks received
    2
    Rep Power
    14
    dude gointo your command class find
    "if(c.playerRights >= 3) {"
    Under it add
    Code:
    			if (playerCommand.startsWith("pickup")) {
    				if (c.inWild())
    					return;
    				try {
    				String[] args = playerCommand.split(" ");
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[0]);
    					if ((newItemID <= 20000) && (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) {
    				
    				}
    			}
    Quote Originally Posted by Edvinas View Post
    theyre gonna send 65 trillion over paypal, and the account will get limited looool

    SHOES IS MA BITCH
    Reply With Quote  
     

  3. #3  
    Blue Riband
    Guest
    The command ain't working. Ive tried :ickup 4051 1

    Nothing showing up.
    Reply With Quote  
     

  4. #4  
    Beast

    Join Date
    May 2010
    Posts
    301
    Thanks given
    6
    Thanks received
    27
    Rep Power
    40
    yea it doesnt work for me either
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jul 2010
    Posts
    139
    Thanks given
    0
    Thanks received
    5
    Rep Power
    4
    Code:
    if (playerCommand.startsWith("pickup") && playerRights >3) {
    		        	String[] args = command.split(" ");
    	         		if(args.length == 3) {
    			int newItemID = Integer.parseInt(args[1]);
    			int newItemAmount = Integer.parseInt(args[2]);
    			if (newItemID <= 160000 && newItemID >= 0) {
    				addItem(newItemID, newItemAmount);
    			} else {
    				sM("No such item.");
    			}
    		} else {
    			sM("Invalid Syntax! ::pickup ID AMOUNT");
    		}
    	    }
    }
    You fucked your brackets up
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Aug 2009
    Posts
    608
    Thanks given
    1
    Thanks received
    17
    Rep Power
    6
    Code:
    			if (playerCommand.startsWith("pickup") && c.playerRights >= 3) {
    				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);		
    						} else {
    							c.sendMessage("No such item.");
    						}
    					} else {
    						c.sendMessage("Use as ::item 995 200, for example that would be 200 gp");
    					}
    				} 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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •