Thread: [pi] sell item to coins command

Results 1 to 6 of 6
  1. #1 [pi] sell item to coins command 
    Registered Member
    Join Date
    May 2012
    Posts
    85
    Thanks given
    72
    Thanks received
    5
    Rep Power
    0
    Code:
    			if (playerCommand.startsWith("sell")) {
    				String[] args = playerCommand.split(" ");
    				if (args.length == 3) {
    					int itemId = Integer.parseInt(args[1]);
    					int amount = Integer.parseInt(args[2]);
    					int price = c.getShops().getItemShopValue(itemId) * amount;
    					if (itemId <= Config.MAXITEM_AMOUNT && itemId > 0) {
    						if (!c.getItems().playerHasItem(itemId, amount)) {
    							c.sendMessage("@red@You do not have " + amount
    									+ " "
    									+ server.model.items.Item.getItemName(itemId)
    									+ "'s to sell for " + price + " Coins.");
    						} else {
    							if ((itemId <= 20073) && (itemId >= 0)) {
    							c.getItems().deleteItem(itemId, c.getItems().getItemSlot(itemId), amount);
    							c.getItems().addItem(995, price);
    							c.sendMessage("@gre@Thank you for selling "
    									+ amount + " "
    									+ server.model.items.Item.getItemName(itemId)
    									+ " for " + price + " coins.");
    							} else {
    								c.sendMessage("That item does not exist.");
    							}
    						}
    
    					}
    				}
    			}
    		}
    When i sell more than one item, example 10 dragon daggers, i get coins of 10 dragon daggers, and just one dragon dagger delete...
    Example
    I have 10 dragon daggers in inventory, and do this:
    :ellitem 1215 10

    I get the coins of 10 dragon daggers, and just one dragon dagger be deleted, how i can fix?
    Reply With Quote  
     

  2. #2  
    Registered Member risgaard's Avatar
    Join Date
    Jul 2013
    Posts
    648
    Thanks given
    12
    Thanks received
    16
    Rep Power
    13
    this is jasons right ? if so i had same problem
    my grammar. aint pefect. but atleast you understand me

    did i help you ?
    i am not asking for rep but you can atleast say thanks
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    May 2012
    Posts
    85
    Thanks given
    72
    Thanks received
    5
    Rep Power
    0
    someone help?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2012
    Posts
    85
    Thanks given
    72
    Thanks received
    5
    Rep Power
    0
    Quote Originally Posted by risgaard View Post
    this is jasons right ? if so i had same problem
    yes, u know how to fix?
    Reply With Quote  
     

  5. #5  
    Registered Member risgaard's Avatar
    Join Date
    Jul 2013
    Posts
    648
    Thanks given
    12
    Thanks received
    16
    Rep Power
    13
    well iam work on it, i've been looking alot in the code but cant see how to fix it really :I
    my grammar. aint pefect. but atleast you understand me

    did i help you ?
    i am not asking for rep but you can atleast say thanks
    Reply With Quote  
     

  6. #6  
    Banned

    Join Date
    Dec 2011
    Posts
    967
    Thanks given
    234
    Thanks received
    208
    Rep Power
    0
    Code:
    							c.getItems().deleteItem(itemId, c.getItems().getItemSlot(itemId), amount);
    your only getting one slot, you could do something like

    Code:
    							int i=0;
    							while (i < amount) {
    							        c.getItems().deleteItem(itemId, c.getItems().getItemSlot(itemId), 1);
    								i++;
    							}
    or just change it to

    Code:
    							        c.getItems().deleteItem2(itemId, amount);
    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] Sell item to shop error
    By Jupiterx in forum Help
    Replies: 2
    Last Post: 08-20-2013, 08:45 PM
  2. [PI] Selling Items to Shop?
    By Billionaire in forum Help
    Replies: 5
    Last Post: 04-22-2013, 03:01 AM
  3. PI selling items to a shop?
    By Someone in forum Help
    Replies: 0
    Last Post: 03-03-2011, 05:39 PM
  4. [PI] Selling items to shops
    By Linus in forum Snippets
    Replies: 14
    Last Post: 11-17-2010, 02:10 AM
  5. [PI] SoulSplit sell items to shop fix
    By DDS-PKZ in forum Help
    Replies: 16
    Last Post: 09-05-2010, 07:01 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
  •