Purpose: To learn how to have almost 100% skulls on your server (cba to make you not get skulled for retaliating)
Difficulty: 1/10
Assumed Knowledge: none... im here to teach you right?
Server Base: pimpscape
Classes Modified: client.java (server), client.java (client)
Procedure:
*NOTE* If you want your client to have prayer icons leave now because you can not have skulls and prayer icons at the same time (to my knowledge)
Step 1: This is the only part I will not be explaining, because it is too confusing to do so to you and most of you probably don't give a **** anyway. Anyway... the first thing you want to do is get your client compatible with the skull head-icons. Search your client.java for this:
Code:
try {
for(int i4 = 0; i4 < 20; i4++)
aClass30_Sub2_Sub1_Sub1Array987[i4] = new Class30_Sub2_Sub1_Sub1(class44_2, "hitmarks", i4);
} catch(Exception _ex) { }
and somewhere above or under that you will need to add a statement that looks a little something like this:
Code:
try {
for(int j4 = 0; j4 < 8; j4++)
aClass30_Sub2_Sub1_Sub1Array1095[j4] = new Class30_Sub2_Sub1_Sub1(class44_2, "headicons_pk", j4);
} catch(Exception _ex) { }
And congratulations! Your client will now show skulls for head icons!
On to the server side part.
Step 2: Open your client.java (server) and go into case 73 (pvp case). Yours should look something like mine:
Code:
case 73: //PVP
if(PkingDelay <= 1) {
try {
AttackingOn = inStream.readSignedWordBigEndian();
client plz = (client) server.playerHandler.players[AttackingOn];
if(playerEquipment[playerWeapon] == 861 || playerEquipment[playerWeapon] == 841 || playerEquipment[playerWeapon] == 843 || playerEquipment[playerWeapon] == 849 || playerEquipment[playerWeapon] == 853 || playerEquipment[playerWeapon] == 857 || playerEquipment[playerWeapon] == 4214 || playerEquipment[playerWeapon] == 4734 || playerEquipment[playerWeapon] == 6724 || playerEquipment[playerWeapon] == 11785 || playerEquipment[playerWeapon] == 7648) {
UseBow = true;
CheckArrows();
teleportToX = absX;
teleportToY = absY;
} else {
UseBow = false;
}
if(UseBow) {
if(HasArrows && bowLevel && !nonWild() && !plz.nonWild() && plz != null && UseBow) {
IsAttacking = true;
inCombat();
} else if(!nonWild() || !plz.nonWild() || plz != null) {
sendMessage("You can't attack this player!");
IsAttacking = false;
ResetAttack();
resetAnimation();
} else if(!HasArrows) {
sendMessage("You don't have any arrows in your quiver!");
IsAttacking = false;
ResetAttack();
} else if(!bowLevel) {
sendMessage("You need a higher level bow to shoot this arrow!");
IsAttacking = false;
ResetAttack();
}
} else if(!UseBow) {
if(!nonWild() && !plz.nonWild() && plz != null && !UseBow) {
IsAttacking = true;
inCombat();
}
if(server.playerHandler.players[AttackingOn] != null) {
if(server.playerHandler.players[AttackingOn].absX != absX && server.playerHandler.players[AttackingOn].absY != absY)
faceNPC = 32768+AttackingOn;
faceNPCupdate = true;
}
else if(!nonWild() || !plz.nonWild() || plz != null) {
resetAnimation();
ResetAttack();
sendMessage("You can't attack this player!");
}
}
} catch(Exception E) {
}
}
break;
Now, what you will have to do, is add a timer for the skulls. You can call this anything you want, but for the purposes of this tutorial we will call it "skullTimer".
Now, in the part of your case that successfully attacks, you will add:
which is 20 minutes (i think) and you can edit that to be whatever you want (10 min... 30 min... whatever).
The part of the case that actually attacks should look like this:
Code:
if(!nonWild() && !plz.nonWild() && plz != null && !UseBow) {
IsAttacking = true;
inCombat();
}
but you probably won't have that since i made my case 73 from scratch... so just add the timer under anything that says "inCombat();"
Now to add the skullTimer int and the head-icons themselves.
Step 3: Now search for void process (or boolean) and inside it you should see something like this:
Code:
public void process() { // is being called regularily every 500ms
if (actionAmount < 0) {
actionAmount = 0;
}
if (actionTimer > 0) {
actionTimer -= 1;
}
if (actionAmount > 25) {
sendMessage("Kicked for acting too fast!");
misc.println("Client acts too fast - disconnecting it");
disconnected = true;
}
if (theifTimer > 0) {
theifTimer -= 1;
}
if (AgilityTimer > 0) {
AgilityTimer -= 1;
}
if (WCTimer > 0) {
WCTimer -= 1;
}
if (fishTimer > 0) {
fishTimer -= 1;
}
if (fishTimer2 > 0) {
fishTimer2 -= 1;
}
if (RCTimer > 0) {
RCTimer -= 1;
}
if (healTimer > 0) {
healTimer -= 1;
}
if (messageTimer > 0) {
messageTimer -= 1;
}
if (messageTimer2 > 0) {
messageTimer2 -= 1;
}
if (attackTimer > 0) {
attackTimer -= 1;
}
if (rangedTeleportTimer > 0) {
rangedTeleportTimer -= 1;
}
if (darkBowTimer > 0) {
darkBowTimer -= 1;
}
if (ddsSpecTimer > 0) {
ddsSpecTimer -= 1;
}
Now, you will need to add an if statement to have the timer actually count down.
This is very easy to do, you must start by declaring the if statement like this:
Code:
if (skullTimer > 0) {
}
This basically states that if the skullTimer is greater then 0, then something will happen.
Now we must add a function to count the timer down each tick. We can do this by adding a line of code that looks like this:
This means that every time the void ticks, the skullTimer will decrease by one each time (note the -= 1)
and your if statement should look like this:
Code:
if(skullTimer > 0) {
skullTimer -= 1;
}
Now we must make the client show the head-icon. We can do this by adding this:
Code:
headIcon = 1;
appearanceUpdateRequired = true;
This means that if the skullTimer is greater then 0, the client will show headIcon 1, and then update your appearance so that the headicon will show without you having to move or start an action. You can change this to show a red skull instead of the usual white skull by changing the ID of the headIcon (i believe the red skull is 4.. just guess and check).
Your if statement should now look like this:
Code:
if(skullTimer > 0) {
skullTimer -= 1;
headIcon = 1;
appearanceUpdateRequired = true;
}
Now, we have to add a piece of code to remove the skull when the timer decreases to 0. All you have to do, is add an else statement. You must start the else statement after the closing bracket of the if statement. Start the else statement like this:
Code:
else if(skullTimer <= 0) {
}
Now, inside of the else statment, you will have to add something similar to the if statement, but it sets the headIcon to 0 (no headIcon) instead of 1 (skull). You can do this by adding this inside the else statement:
Code:
headIcon = 0;
appearanceUpdateRequired = true;
Now, when the timer reaches zero, the headIcon will disappear.
Your final statement should look like this:
Code:
if (skullTimer > 0) {
skullTimer -= 1;
headIcon = 1;
appearanceUpdateRequired = true;
} else if(skullTimer <= 0) {
headIcon = 0;
appearanceUpdateRequired = true;
}
And finally, we need to declare the int skullTimer. Do this by adding:
Code:
public int skullTimer = 0;
above void process or wherever you feel like adding your ints (really makes no difference)
Step 4: Now, you must make it so if you die (lets hope you don't) the skull will go away. There is really no need to explain this part, just add
to your boolean applydead (or whatever your death boolean is).
Now, you have pking skulls! One more thing for people who want it, you can make the timer save, so logging out won't lose you your skull. To do this, you must find this in your client.java:
Code:
} else if (token.equals("
and under that whole statement add this statement:
Code:
} else if (token.equals("character-skullTimer")) {
skullTimer = Integer.parseInt(token2);
}
*NOTE* Don't add this under the line I told you to find, you must add it under the entire statement, which will look something like this:
Code:
} else if (token.equals("character-pkpoints")) {
pkpoints = Integer.parseInt(token2);
}
and search for this:
Code:
characterfile.write("
and under that whole statement add this:
Code:
characterfile.write("character-skullTimer = ", 0, 23);
characterfile.write(Integer.toString(skullTimer), 0, Integer.toString(skullTimer).length());
characterfile.newLine();
*NOTE* Don't add this under the line I told you to find, you must add it under the entire statement, which will look something like this:
Code:
characterfile.write("character-pkpoints = ", 0, 21);
characterfile.write(Integer.toString(pkpoints), 0, Integer.toString(pkpoints).length());
characterfile.newLine();
And congratulations! You now have 99% pking skulls in your server. If you get any errors you added something wrong so post it and I can tell you what is wrong. Have fun pking
Heres a pic: