Thread: How to fix the dupe in the trading.

Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1 How to fix the dupe in the trading. 
    gold cobra
    Guest
    Purpose: Title says it .

    Difficulty: 1/10, shouldn't be too confusing.

    Assumed Knowledge: Well, you'll learn in this tutorial.

    Server Base: Every server that's from a winterlove base.

    Classes Modified: Client class

    Procedure
    Step 1: Ok, people like to dupe some items in trade right? So, it's one statement around some code in a method is all it takes. They hit accept, then decline really fast.

    So, let's go to our decline trade method.

    You should see something like this:

    Code:
    public void DeclineTrade() {
    		for (int i = 0; i < playerTItems.length; i++) {
    			if (playerTItems[i] > 0) {
    				fromTrade((playerTItems[i] - 1), i, playerTItemsN[i]);
    			}
    		}
    		resetItems(3214);
    		resetTrade();
    	}
    So, what we need to do is disable it if they accepted the trade.

    Now, we'll make use of the hasAccepted boolean.

    We need to make a statement using that boolean.

    So, we'll do this:


    Code:
    public void DeclineTrade() {
            if (!hasAccepted) {
                for (int i = 0; i < playerTItems.length; i++) {
                    if (playerTItems[i] > 0) {
                        if (tradeStatus < 4) {
                            fromTrade((playerTItems[i] - 1), i, playerTItemsN[i]);
                        }
                    }
                }
            }
            resetItems(3214);
            resetTrade();
        }
    See the if(!hasAccepted) {? The "!" is an logical complement operator, I used that instead of false value. There is no need to put the false value, or the true value in your if statements. Use ! instead of false value, and just put the variable or method name instead of true value.

    Step 2: Ok, if you're getting the cannot find the symbol error, then do this step. If you're not, then ignore this step.

    Declare this:

    Code:
    private boolean hasAccepted = false;
    I made the boolean private because it's not going to be called in another class, you should start doing this when you're declaring.

    Find where the ConfirmTrade method is called in process, and add hasAccepted = true;


    Credits: Me.
     

  2. #2  
    Registered Member

    Join Date
    Jan 2008
    Age
    28
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    Very nice gold thanks.
     

  3. #3  
    Уважение и любовь Market Banned Market Banned

    R0cky 0wnz's Avatar
    Join Date
    Mar 2008
    Age
    28
    Posts
    2,569
    Thanks given
    642
    Thanks received
    511
    Rep Power
    1716
    ty mate so much!
    SELLING CREATIVESCAPE 2012 SOURCE

    [Only registered and activated users can see links. ]

    Snippets
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
     

  4. #4  
    Endeavor

    Mikey`'s Avatar
    Join Date
    Dec 2007
    Posts
    4,421
    Thanks given
    693
    Thanks received
    1,425
    Rep Power
    1202
    Lol if the player declines you lose that item.
     

  5. #5  
    gold cobra
    Guest
    Quote Originally Posted by avenged7fold View Post
    Lol if the player declines you lose that item.
    I'll fix it, sec.
     

  6. #6  
    Registered Member
    Unborn's Avatar
    Join Date
    Dec 2007
    Age
    28
    Posts
    516
    Thanks given
    1
    Thanks received
    3
    Rep Power
    317
    I added something like this to my server not a long time ago.
    Only problem was, my players didn't give up until they found more bugs.

    Good job on posting this.


     

  7. #7  
    nitto jo
    Guest
    if you have accepted a trade of something you are giving to another player the item gets deleted. this works in a way though
     

  8. #8  
    Simon
    Guest
    Thank you ben.
     

  9. #9  
    owned pk
    Guest
    if only it worked for me...no matter where i put the private thing it comes up with 100 errors =(
     

  10. #10  
    Registered Member

    Join Date
    Oct 2007
    Posts
    1,063
    Thanks given
    155
    Thanks received
    162
    Rep Power
    286
    Players can dupe in trades on many ways, only one part is
    accepting and declining very fast.

    Another way would be massing items in trade.


    Good tut anyway
     

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
  •