Multiple Clicks - A combat/PKing fix.
I've just recently discovered something that should help out a reasonably large amount of people with their PKing and what not. It turns out, doing some research with different sources can seriously help you discover things that will help everyone! I was playing around with packet 98 (the walking packet), when I found out that if you click someone again while in combat, it'll send the walking packet. If you have a resetAttack() or something like that in your walking packets, another click when in combat will screw everything up.
So, I've come up with a fix! Just follow this tutorial and everything will be made more realistic. :)
Step 1: Declare this:
Code:
public boolean dontStopAttacking = false;
Step 2: Now go into your packet 73 (attacking another player), and add this ABOVE EVERYTHING (including the part about AttackingOn =):
Code:
if (server.playerHandler.players[AttackingOn] != null)
{
dontStopAttacking = true;
}
Step 3: In the same packet, comment everything out having to do with your attackingDelay/pkingDelay/whatever delay being less than or equal to 0:
Code:
/* if(PkingDelay <= 0)
{ */
...
//}
Step 4: And then finally, in your packet 98, replace everything having to do with resetting combat (such as resetAttack() and faceNPC = -1) with this:
Code:
if (!dontStopAttacking)
{
resetAttack();
faceNPC(-1);
faceNPCupdate = true;
//And anything else...
}
And you should be done! If you have any questions, bugs, concerns, glitches, etc. having to do with this tutorial, PLEASE ask me: Don't hesitate! :) Thanks, and have fun!