PDA

View Full Version : [317]Adding In-Game Highscores[317]



the real deal
September 19th, 2010, 12:42
Difficulty 3/10
In Client.java & Server.java
I Suggest Making a copy of both before doing this, just in case you receive an Error)

First Open client.java & search for


public class client extends Player implements Runnable {

And add This Under it


public int totalz = totalz = (getLevelForXP(playerXP[0]) + getLevelForXP(playerXP[1]) + getLevelForXP(playerXP[2]) + getLevelForXP(playerXP[3]) + getLevelForXP(playerXP[4]) + getLevelForXP(playerXP[5]) + getLevelForXP(playerXP[6]) + getLevelForXP(playerXP[7]) + getLevelForXP(playerXP[8]) + getLevelForXP(playerXP[9]) + getLevelForXP(playerXP[10]) + getLevelForXP(playerXP[11]) + getLevelForXP(playerXP[12]) + getLevelForXP(playerXP[13]) + getLevelForXP(playerXP[14]) + getLevelForXP(playerXP[15]) + getLevelForXP(playerXP[16]) + getLevelForXP(playerXP[17]) + getLevelForXP(playerXP[18]) + getLevelForXP(playerXP[19]) + getLevelForXP(playerXP[20]) + getLevelForXP(playerXP[21]) + getLevelForXP(playerXP[22]));
//In-game highscores
public int playerRank = 0;

public void resetRanks() {
for (int i = 0; i < 10; i++) {
server.ranks[i] = 0;
server.rankPpl[i] = "";
if (playerRights >= 2) {
playerRank = 0;
totalz = 0;
}
}
}
public void highscores() {
clearQuestInterface();
sendQuest("@dbl@", 8144); //Title
sendQuest("@dre@~In-Game Top 10 Highscores~By:The Real Deal!", 8145);
for(int i = 0; i < 10; i++) { // you also need to change this for it to display more, simply the number you want it to display, say 20 = for(int i = 0; i < 20; i++)
if(server.ranks[i] > 0) {
sendQuest("@bla@Rank "+(i+1)+": @red@"+server.rankPpl[i]+ "@bla@ - Total Lvl:@whi@ " +server.ranks[i], 8147+i);
}
}
sendQuestSomething(8143);
showInterface(8134);
flushOutStream();
resetRanks();
}
//end highscores

Now add this command so ppl see the Highscores.. add it under any command


if (command.equalsIgnoreCase("highscore")) {
highscores();
}

& Now Search for


public boolean process() {

And add this under it


//in-game highscores
playerLevel[24] = totalz;
if (playerRights >= 2) {
playerRank = 0;
totalz = 0;
}

for (int d = 0; d <= 10; d++) {
if (totalz >= server.ranks[d]) {
if (d == 0) {
playerRank = d+1;
server.ranks[d] = totalz;
server.rankPpl[d] = playerName;
}else if (d < 10){
if (totalz < server.ranks[d-1]) {
playerRank = d+1;
server.ranks[d] = totalz;
server.rankPpl[d] = playerName;
}
}else{
if (totalz < server.ranks[d-1]) {
playerRank = 0;
}
}
}
}
//end highscores
int oldtotal = totalz;
totalz = (getLevelForXP(playerXP[0]) + getLevelForXP(playerXP[1]) + getLevelForXP(playerXP[2]) + getLevelForXP(playerXP[3]) + getLevelForXP(playerXP[4]) + getLevelForXP(playerXP[5]) + getLevelForXP(playerXP[6]) + getLevelForXP(playerXP[7]) + getLevelForXP(playerXP[8]) + getLevelForXP(playerXP[9]) + getLevelForXP(playerXP[10]) + getLevelForXP(playerXP[11]) + getLevelForXP(playerXP[12]) + getLevelForXP(playerXP[13]) + getLevelForXP(playerXP[14]) + getLevelForXP(playerXP[15]) + getLevelForXP(playerXP[16]) + getLevelForXP(playerXP[17]) + getLevelForXP(playerXP[18]) + getLevelForXP(playerXP[19]) + getLevelForXP(playerXP[20]) + getLevelForXP(playerXP[21]));

Now Close the client.java & Open Server.java

& Add this anywhere..


/*Highscores*/
/*For more highscores to be recorded, change the #s in [] to the number you want kept, +1*/
/*For example, if you want the top 20, put 21 in the [] ([21])*/
public static int[] ranks = new int[11];
public static String[] rankPpl = new String[11];
Now close Server.java & Compile and Run..

If any error please post here and ill be kind enough to help:)

_1Greg1_
September 19th, 2010, 18:07
What base is this for?

the real deal
September 19th, 2010, 18:08
Anytype

Mish
September 19th, 2010, 19:03
This is Aintarios :s, need to give credits.

aintaro
September 19th, 2010, 19:26
This is Aintarios :s, need to give credits.

+ 1

bannanarama
September 19th, 2010, 21:48
yh antarios made a tutorial exactly like this

Give credit's.

Trey
September 19th, 2010, 21:52
This isn't even antarios, this chunk of bad code has been around for years. Antario just found it in a source and posted it.

Fenway`
September 19th, 2010, 21:55
This isn't even antarios, this chunk of bad code has been around for years. Antario just found it in a source and posted it.

hes right

the real deal
September 20th, 2010, 01:30
i got permission of the maker to post this, he even said i dont need to give credits, so idk what u people r talking about tbh:s

Deadly a g s
September 20th, 2010, 11:40
Process.. EW EW EW EW, NO NO NO, NO~!!

Lucas Pk
February 28th, 2011, 22:46
Now, after reading all the comments feel like if i use this something will go wrong. Is it safe to use in my server without anything going wrong?

_1Greg1_
March 1st, 2011, 04:41
Now, after reading all the comments feel like if i use this something will go wrong. Is it safe to use in my server without anything going wrong?

Most people don't like gravediggers...

As long as you do it right, nothing should error...
But I could do it for you :)
I've got a thread about that somewhere...

specced v2
April 8th, 2011, 05:51
ughhhhhhh...... i got 96 errors lol could somone help???