Thread: buy x problem

Results 1 to 10 of 10
  1. #1 buy x problem 
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    Currently got this code:



    RSInterface.java
    Code:
    					if(rsInterface.itemActions[l3].length() == 0)
    						rsInterface.itemActions[l3] = null;
    and under that add:

    Code:
    					if(rsInterface.parentID == 3824)
                            rsInterface.itemActions[4] = "Buy X";
    This will add Buy X under the Buy 10 option.

    That's it for client sided, now in your server files.

    in your packets open BankX1.java and add this:

    Code:
    		 if (XinterfaceID == 3900) { //Shop
    				if (EnteredAmount <= 10000)
    					c.getShops().buyItem(XremoveID, XremoveSlot, EnteredAmount);
    				else
    					c.sendMessage("You cannot buy more than 10k items at a time.");
    			}
    Now in ShopAssistant.java search for

    Code:
    for (int i = amount; i > 0; i--) {
    and add this above:

    Code:
                if (amount > 100) {
    				TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot))*amount;
    				Slot = c.getItems().getItemSlot(995);
    				if (Slot == -1 && TotPrice2 != 0) {
    					c.sendMessage("You don't have enough coins.");
    				}
    				if(TotPrice2 <= 1) {
    					TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
    				}
    				if (TotPrice2 <= 0) {
    					if (c.getItems().freeSlots() > 0) {
    						c.getItems().addItem(itemID, amount);
    						Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
    						Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    						if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
    							Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    						}
    					} else {
    						c.sendMessage("Not enough space in your inventory.");
    					}
    				} else if (c.playerItemsN[Slot] >= TotPrice2) {
    					if (c.getItems().freeSlots() > 0) {
    						c.getItems().deleteItem(995, c.getItems().getItemSlot(995), TotPrice2);
    						c.getItems().addItem(itemID, amount);
    						Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= amount;
    						Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
    						if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
    							Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
    						}
    					} else {
    						c.sendMessage("Not enough space in your inventory.");
    					}
    				} else {
    					c.sendMessage("You don't have enough coins.");
    				}
                }else{
    Now at the end of the BuyItem method in ShopAssistant you still need to add above

    Code:
    return false;
    add
    Code:
    }

    But it does not work, what's wrong with it?

    The buy is there in shops, and you can click it, and it opens the interface where u enter a number, but it does not buy anything
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    need some help
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2009
    Posts
    65
    Thanks given
    6
    Thanks received
    2
    Rep Power
    1
    if(rsInterface.parentID == 3824)
    if (XinterfaceID == 3900) { //Shop

    maybe thats the problem? didn't try

    edit: nwm its not that
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    I tried that, it doesnt work :\
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    bump, who knows?
    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    need some help
    Reply With Quote  
     

  7. #7  
    Super Donator

    Tyluur's Avatar
    Join Date
    Jun 2010
    Posts
    4,026
    Thanks given
    1,363
    Thanks received
    1,278
    Rep Power
    682
    Are you sure its for PI?
    [Only registered and activated users can see links. ]

    Quote Originally Posted by Velocity View Post
    i'd love to get called in the middle of the night just to hear an indian voice whisper "the nulls are back friend, how i fix"
    Reply With Quote  
     

  8. #8  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    Quote Originally Posted by Big Sean View Post
    Are you sure its for PI?

    I didnt get it myself, somebody posted it
    Reply With Quote  
     

  9. #9  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    need some help
    Reply With Quote  
     

  10. #10  
    Banned
    Join Date
    Sep 2010
    Posts
    883
    Thanks given
    20
    Thanks received
    6
    Rep Power
    0
    bump
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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

Similar Threads

  1. Else if problem
    By Exsinity in forum Help
    Replies: 17
    Last Post: 08-12-2009, 05:52 AM
  2. Replies: 6
    Last Post: 07-04-2009, 04:19 PM
  3. Replies: 3
    Last Post: 02-22-2009, 08:14 PM
  4. Replies: 4
    Last Post: 04-23-2008, 04:54 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
  •