Thread: Will give 5$ for buy X working

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Will give 5$ for buy X working 
    Registered Member
    Join Date
    Apr 2008
    Age
    27
    Posts
    559
    Thanks given
    9
    Thanks received
    2
    Rep Power
    48
    Hi, anyone know how to get buy X working, IM not doing any teamviewer stuff.

    Or buy 50 will be fine, or buy 100,

    THE BUY 50 OR 100 CAN BE ON THE BUY 10 OPTION

    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Apr 2008
    Age
    27
    Posts
    559
    Thanks given
    9
    Thanks received
    2
    Rep Power
    48
    Anyone else?

    Reply With Quote  
     

  3. #3  
    Registered Member
    Omer5454's Avatar
    Join Date
    Sep 2009
    Posts
    139
    Thanks given
    0
    Thanks received
    6
    Rep Power
    246
    Ye wait up i get it for u..
    Ecstasy



    Reply With Quote  
     

  4. #4  
    Registered Member
    Omer5454's Avatar
    Join Date
    Sep 2009
    Posts
    139
    Thanks given
    0
    Thanks received
    6
    Rep Power
    246
    Quote Originally Posted by tj007razor View Post
    Purpose: create a shop option to buy X
    Difficulty: 3 maybe?
    Assumed Knowledge: search, c+p, some java common sense
    Server Base: old cheeze, should work on all
    Classes Modified: Server side: client.java Client side: class9.java

    Procedure

    Client Side

    Step 1: All we do is tell the client to say buy X
    in class9.java search for
    Code:
    if(class9.aStringArray225[j2].length() == 0)
    and above that add
    Code:
                        if(class9.anInt236 == 3824)
                            class9.aStringArray225[4] = "Buy X";
    That's it for client side.

    Credits: All to reaper for his buy 20 add-on

    Server Side

    Step 1: First we make the shop accept buying X
    in client.java search for
    Code:
    case 208:	//Enter Amount Part 2
    You should see a bunch of if/else ifs so we are just going to add another else if.
    For example one you should see is
    Code:
      else if (XinterfaceID == 6669 && duelStatus >= 1) { //remove from duel window
    					fromDuel(XremoveID, XremoveSlot, EnteredAmount);
    				}
    now add this else if
    Code:
     else if (XinterfaceID == 3900) { //Shop
    					if (EnteredAmount <= 10000)
    						buyItem(XremoveID, XremoveSlot, EnteredAmount);
    					else
    						sendMessage("You cannot buy more than 10k items at a time.");
    				}
    I made it so you cannot buy more than 10k at a time, you can change that.

    Step 2: Now we need to fix that it loops to buy each item one at a time, even if you buy 5k arrows
    I thought it was reasonable not to loop if the purchase is over 100 of an item.
    Search for
    Code:
    public boolean buyItem(int itemID, int fromSlot, int amount) {
    and in that method there's a loop that looks like
    Code:
    for (int i = amount; i > 0; i--) {
    above that add
    Code:
                if (amount > 100) {
    				TotPrice2 = (int)Math.floor(GetItemShopValue(itemID, 0, fromSlot))*amount;
    				Slot = GetItemSlot(995);
    				if (Slot == -1 && TotPrice2 != 0) {
    					sendMessage("You don't have enough coins.");
    				}
    				if(TotPrice2 <= 1) {
    					TotPrice2 = (int)Math.floor(GetItemShopValue(itemID, 0, fromSlot));
    				}
    				if (TotPrice2 <= 0) {
    					if (freeSlots() > 0) {
    						addItem(itemID, amount);
    						server.shopHandler.ShopItemsN[MyShopID][fromSlot] -= 1;
    						server.shopHandler.ShopItemsDelay[MyShopID][fromSlot] = 0;
    						if ((fromSlot + 1) > server.shopHandler.ShopItemsStandard[MyShopID]) {
    							server.shopHandler.ShopItems[MyShopID][fromSlot] = 0;
    						}
    					} else {
    						sendMessage("Not enough space in your inventory.");
    					}
    				} else if (playerItemsN[Slot] >= TotPrice2) {
    					if (freeSlots() > 0) {
    						deleteItem(995, GetItemSlot(995), TotPrice2);
    						addItem(itemID, amount);
    						server.shopHandler.ShopItemsN[MyShopID][fromSlot] -= amount;
    						server.shopHandler.ShopItemsDelay[MyShopID][fromSlot] = 0;
    						if ((fromSlot + 1) > server.shopHandler.ShopItemsStandard[MyShopID]) {
    							server.shopHandler.ShopItems[MyShopID][fromSlot] = 0;
    						}
    					} else {
    						sendMessage("Not enough space in your inventory.");
    					}
    				} else {
    					sendMessage("You don't have enough coins.");
    				}
                }else{
    then add another
    Code:
    }
    at the end of the for loop

    There you should be done.

    Credits: Me, tj007razor

    Video:
    [Only registered and activated users can see links. ]

    $5 please? I accept paypal at [Only registered and activated users can see links. ]
    Ecstasy



    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Apr 2008
    Age
    27
    Posts
    559
    Thanks given
    9
    Thanks received
    2
    Rep Power
    48
    Yeah it works but you know how to make it so my players dont get kicked??

    Reply With Quote  
     

  6. #6  
    Registered Member
    Omer5454's Avatar
    Join Date
    Sep 2009
    Posts
    139
    Thanks given
    0
    Thanks received
    6
    Rep Power
    246
    What you mean your players get kicked? Post your code here I guess cause this code shouldn't kick your players?
    Ecstasy



    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Apr 2008
    Age
    27
    Posts
    559
    Thanks given
    9
    Thanks received
    2
    Rep Power
    48
    Code:
     else if (XinterfaceID == 3900) { //Shop
    					if (EnteredAmount <= 10000)
    						buyItem(XremoveID, XremoveSlot, EnteredAmount);
    					else
    						sM("You cannot buy more than 10k items at a time.");
    				}

    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Feb 2009
    Posts
    491
    Thanks given
    0
    Thanks received
    8
    Rep Power
    300
    I'll do it for gift on Combat Arms
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Apr 2008
    Age
    27
    Posts
    559
    Thanks given
    9
    Thanks received
    2
    Rep Power
    48
    Yeah Ill gift you on CB arms, if you can get it to not DC my players..

    Reply With Quote  
     

  10. #10  
    Registered Member
    Omer5454's Avatar
    Join Date
    Sep 2009
    Posts
    139
    Thanks given
    0
    Thanks received
    6
    Rep Power
    246
    That code isn't causing your players to get dced.
    Ecstasy



    Reply With Quote  
     

Page 1 of 2 12 LastLast

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
  •