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.