Welcome!

Join our community of MMORPG enthusiasts and private server developers! By registering, you'll gain access to in-depth discussions on source codes, binaries, and the latest developments in MMORPG server files. Collaborate with like-minded individuals, explore tutorials, and share insights on building and optimizing private servers. Join us today and unlock the full potential of MMORPG server development!

Join Today!

[PI] Ingame HighScores

Initiate Mage
Joined
Aug 9, 2011
Messages
1
Reaction score
0
Location
United States
My First Tutorial on How to add Ingame HighScores for PI Based Servers.
I know theres already been a Tutorial Released, But People were having Problems,
with the names when it only shows one person.

I Give Full Credits to Demise, Since he created the Original Tutorial, and I just edited up the Codes a little, also added more to it.

If you guys don't like it, i can remove it.

Info: If this tutorial, doesn't work for you. I Can Edit it.

Difficulty: 1/10
Skills Needed: Copy & Paste

This is what you are about to Add:
M0dz x Leg3ndz - [PI] Ingame HighScores - RaGEZONE Forums


M0dz x Leg3ndz - [PI] Ingame HighScores - RaGEZONE Forums


_________________________________________________________________

Step 1: Server Sided.
Go to your Client.java and Search for:
Code:
void process() {

Then Add this RIGHT under it:

Code:
int 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]));;
	for (int d = 0; d <= 10; d++) {
		if (totalz >= ranks[d]) {
			if (d == 0) {
			if (d == 0) {
				playerRank = d+1;
				ranks[d] = totalz;
				rankPpl[d] = playerName;
			}else if (d < 10){
				if (totalz < ranks[d-1]) {
					playerRank = d+1;
					ranks[d] = totalz;
					rankPpl[d] = playerName;
				}
			}else{
				if (totalz < ranks[d-1]) {
					playerRank = 0;
				}
			}
		}
	}
Now it should look like this.

Code:
public void process() {
	int 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]));;
        for (int d = 0; d <= 10; d++) {
                if (totalz >= ranks[d]) {
                        if (d == 0) {
                                playerRank = d+1;
                                ranks[d] = totalz;
                                rankPpl[d] = playerName;
                        }else if (d < 10){
                                if (totalz < ranks[d-1]) {
                                        playerRank = d+1;
                                        ranks[d] = totalz;
                                        rankPpl[d] = playerName;
                                }
                        }else{
                                if (totalz < ranks[d-1]) {
                                        playerRank = 0;
                                }
                        }
                }
        }
Still in Client.java, seach for

Code:
public class Client extends Player {

Somewhere, Below it add this:

Code:
public void resetRanks() {
                for (int i = 0; i < 10; i++) {
                        ranks[i] = 0;
                        rankPpl[i] = "";
                }
}
        public void highscores() {
                getPA().sendFrame126("Server Name Highscores", 6399);  //Title
                for(int i = 0; i < 10; i++) {
                        if(ranks[i] > 0) {
                                getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i);
                        }
                }
                getPA().showInterface(6308);
                flushOutStream();
                resetRanks();
        }

        public int playerRank = 0;
        public static int[] ranks = new int[11];
    public static String[] rankPpl = new String[11];

So it would look like this:

Code:
public class Client extends Player {
	public int pieSelect = 0;
	public int kebabSelect = 0;
	public int chocSelect = 0;
	public int bagelSelect = 0;
	public int triangleSandwich = 0;
	public int squareSandwich = 0;
	public int breadSelect = 0;
	public void resetRanks() {
                	for (int i = 0; i < 10; i++) {
                        		ranks[i] = 0;
                        		rankPpl[i] = "";
                	}
	}
        	public void highscores() {
               		getPA().sendFrame126("Server Name HighScores!", 6399);  //Title
                for(int i = 0; i < 10; i++) {
                        if(ranks[i] > 0) {
                                getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i);
		getPA().sendFrame126("Rank "+(i+2)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6403+i);
                        }
                }
                	getPA().showInterface(6308);
                	flushOutStream();
                	resetRanks();
        	}

        	public int playerRank = 0;
        	public static int[] ranks = new int[11];
    public static String[] rankPpl = new String[11];

Step 2: Server Sided

Go to Actionhandler.java, and search for

Code:
case 1765:
			c.getPA().movePlayer(2271, 4680, 0);
		break;
If you can't find that code, search for firstclickobject

Below it add this:

Code:
case 3192:
		c.highscores();
		break;

Now go to ObjectManager.java, and search for
Code:
public void loadCustomSpawns(Client c) {

Then Add this Below it:
Code:
c.getPA().checkObjectSpawn(3192, 3209, 3436, 1, 10);

Step 3: Server Sided (Last Step)

Now back to the Client.java, and search for

Code:
initialize() {

Below it somewhere, add this:
Code:
getPA().sendFrame126("Server Name Top 10", 6399);
			getPA().sendFrame126("Close Window", 6401);
			getPA().sendFrame126(" ", 6402);
			getPA().sendFrame126(" ", 6403);
			getPA().sendFrame126(" ", 6404);
			getPA().sendFrame126(" ", 6405);
			getPA().sendFrame126("Server Name", 640);
			getPA().sendFrame126(" ", 6406);
			getPA().sendFrame126(" ", 6407);
			getPA().sendFrame126(" ", 6408);
			getPA().sendFrame126(" ", 6409);
			getPA().sendFrame126(" ", 6410);
			getPA().sendFrame126(" ", 6411);
			getPA().sendFrame126(" ", 8578);
			getPA().sendFrame126(" ", 8579);
			getPA().sendFrame126(" ", 8580);
			getPA().sendFrame126(" ", 8581);
			getPA().sendFrame126(" ", 8582);
			getPA().sendFrame126(" ", 8583);
			getPA().sendFrame126(" ", 8584);
			getPA().sendFrame126(" ", 8585);
			getPA().sendFrame126(" ", 8586);
			getPA().sendFrame126(" ", 8587);
			getPA().sendFrame126(" ", 8588);
			getPA().sendFrame126(" ", 8589);
			getPA().sendFrame126(" ", 8590);
			getPA().sendFrame126(" ", 8591);
			getPA().sendFrame126(" ", 8592);
			getPA().sendFrame126(" ", 8593);
			getPA().sendFrame126(" ", 8594);
			getPA().sendFrame126(" ", 8595);
			getPA().sendFrame126(" ", 8596);
			getPA().sendFrame126(" ", 8597);
			getPA().sendFrame126(" ", 8598);
			getPA().sendFrame126(" ", 8599);
			getPA().sendFrame126(" ", 8600);
			getPA().sendFrame126(" ", 8601);
			getPA().sendFrame126(" ", 8602);
			getPA().sendFrame126(" ", 8603);
			getPA().sendFrame126(" ", 8604);
			getPA().sendFrame126(" ", 8605);
			getPA().sendFrame126(" ", 8606);
			getPA().sendFrame126(" ", 8607);
			getPA().sendFrame126(" ", 8608);
			getPA().sendFrame126(" ", 8609);
			getPA().sendFrame126(" ", 8610);
			getPA().sendFrame126(" ", 8611);
			getPA().sendFrame126(" ", 8612);
			getPA().sendFrame126(" ", 8613);
			getPA().sendFrame126(" ", 8614);
			getPA().sendFrame126(" ", 8615);
			getPA().sendFrame126(" ", 8616);
			getPA().sendFrame126(" ", 8617);

Then your finished, and Compile.

MORE NAMES: (If you want to add more names to the ScoreBoard)
The Code you just added: Method

Code:
public void resetRanks() {
                for (int i = 0; i < 10; i++) {
                        ranks[i] = 0;
                        rankPpl[i] = "";
                }
}
        public void highscores() {
                getPA().sendFrame126("Server Name Highscores", 6399);  //Title
                for(int i = 0; i < 10; i++) {
                        if(ranks[i] > 0) {
                                getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i);
                        }
                }
                getPA().showInterface(6308);
                flushOutStream();
                resetRanks();
        }

        public int playerRank = 0;
        public static int[] ranks = new int[11];
    public static String[] rankPpl = new String[11];

Copy the
Code:
  getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i);
and Paste it RIGHT under it.

So, it would look like this:

Code:
public void resetRanks() {
                for (int i = 0; i < 10; i++) {
                        ranks[i] = 0;
                        rankPpl[i] = "";
                }
}
        public void highscores() {
                getPA().sendFrame126("Server Name Highscores", 6399);  //Title
                for(int i = 0; i < 10; i++) {
                        if(ranks[i] > 0) {
                                getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i);
                                getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i);
                        }
                }
                getPA().showInterface(6308);
                flushOutStream();
                resetRanks();
        }

        public int playerRank = 0;
        public static int[] ranks = new int[11];
    public static String[] rankPpl = new String[11];

and Do it over and over again. :D

Then change the +(i+1)+ to +(i+2)+ and the 6402+i to 6403+i.

Finally, Now it would look like this..

Code:
public void resetRanks() {
                for (int i = 0; i < 10; i++) {
                        ranks[i] = 0;
                        rankPpl[i] = "";
                }
}
        public void highscores() {
                getPA().sendFrame126("Server Name Highscores", 6399);  //Title
                for(int i = 0; i < 10; i++) {
                        if(ranks[i] > 0) {
                                getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i);
                                getPA().sendFrame126("Rank "+(i+2)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6403+i);
                        }
                }
                getPA().showInterface(6308);
                flushOutStream();
                resetRanks();
        }

        public int playerRank = 0;
        public static int[] ranks = new int[11];
    public static String[] rankPpl = new String[11];

And do that, over and over again..

Now you are Finally DONE!
 
Last edited:
omg this one has a scroll bar! i didn't think of adding that -.-
 
I did everything but after adding more names I went in-game to check how it looks like and it shows the same player all 10 times. How do I fix that?
 
Back