Okay, this one is better than v1 because now it has ranks. V3 will have them in order.
Still doesnot show ranks in order, and only shows of people logged in at the time.


Difficulty: 1/10
Classes Modified: Client.java/Server.java
Lets get started!
Step 1: Server.java
Under this,
Code:
public static int cycleTime = 500;
Add these
Code:
public static int Rank1 = 0;
public static int Rank2 = 0;
public static int Rank3 = 0;
public static int Rank4 = 0;
public static int Rank5 = 0;
public static int Rank6 = 0;
public static int Rank7 = 0;
public static int Rank8 = 0;
public static int Rank9 = 0;
public static int Rank10 = 0;
public static int Rank11 = 0;
public static int Rank12 = 0;
public static int Rank13 = 0;
public static int Rank14 = 0;
public static int Rank15 = 0;
public static int Rank16 = 0;
public static int Rank17 = 0;
public static int Rank18 = 0;
public static int Rank19 = 0;
public static int Rank20 = 0;
Done with server.java!
Step 2: Client.java
Add these voids
Code:
public void resetRanks()
{
server.Rank1 = 0;
server.Rank2 = 0;
server.Rank3 = 0;
server.Rank4 = 0;
server.Rank5 = 0;
server.Rank6 = 0;
server.Rank7 = 0;
server.Rank8 = 0;
server.Rank9 = 0;
server.Rank10 = 0;
server.Rank11 = 0;
server.Rank12 = 0;
server.Rank13 = 0;
server.Rank14 = 0;
server.Rank15 = 0;
server.Rank16 = 0;
server.Rank17 = 0;
server.Rank18 = 0;
server.Rank19 = 0;
server.Rank20 = 0;
}
public void highscores() {
clearQuestInterface();
for(int i = 0; i < server.playerHandler.maxPlayers; i++) {
if(server.playerHandler.players[i] != null) { {
sendQuest("@[email protected]", 8144); //Title
sendQuest("@[email protected] ====Highscores====", 8145);
sendQuest("@[email protected]"+server.playerHandler.players[i].playerName+ " = @[email protected] Lvl:@[email protected] " +server.playerHandler.players[i].playerLevel[24]+ "@[email protected] Rank @[email protected]" +server.playerHandler.players[i].playerLevel[22], 8147+i);
}
}
}
sendQuestSomething(8143);
showInterface(8134);
flushOutStream();
}
public int playerRank = 0;
Now search for
Code:
public boolean process() {
and add this crap under it
Code:
playerLevel[24] = totalz;
playerLevel[22] = playerRank;
if(totalz >= server.Rank1)
{
playerRank = 1;
server.Rank1 = totalz;
}
if(totalz >= server.Rank2 && totalz < server.Rank1)
{
playerRank = 2;
server.Rank2 = totalz;
}
if(totalz >= server.Rank3 && totalz < server.Rank2)
{
playerRank = 3;
server.Rank3 = totalz;
}
if(totalz >= server.Rank4 && totalz < server.Rank3)
{
playerRank = 4;
server.Rank4 = totalz;
}
if(totalz >= server.Rank5 && totalz < server.Rank4)
{
playerRank = 5;
server.Rank5 = totalz;
}
if(totalz >= server.Rank6 && totalz < server.Rank5)
{
playerRank = 6;
server.Rank6 = totalz;
}
if(totalz >= server.Rank7 && totalz < server.Rank6)
{
playerRank = 7;
server.Rank7 = totalz;
}
if(totalz >= server.Rank8 && totalz < server.Rank7)
{
playerRank = 8;
server.Rank8 = totalz;
}
if(totalz >= server.Rank9 && totalz < server.Rank8)
{
playerRank = 9;
server.Rank9 = totalz;
}
if(totalz >= server.Rank10 && totalz < server.Rank9)
{
playerRank = 10;
server.Rank10 = totalz;
}
if(totalz >= server.Rank11 && totalz < server.Rank10)
{
playerRank = 11;
server.Rank11 = totalz;
}
if(totalz >= server.Rank12 && totalz < server.Rank11)
{
playerRank = 12;
server.Rank12 = totalz;
}
if(totalz >= server.Rank13 && totalz < server.Rank12)
{
playerRank = 13;
server.Rank13 = totalz;
}
if(totalz >= server.Rank14 && totalz < server.Rank13)
{
playerRank = 14;
server.Rank14 = totalz;
}
if(totalz >= server.Rank15 && totalz < server.Rank14)
{
playerRank = 15;
server.Rank15 = totalz;
}
if(totalz >= server.Rank16 && totalz < server.Rank15)
{
playerRank = 16;
server.Rank16 = totalz;
}
if(totalz >= server.Rank17 && totalz < server.Rank16)
{
playerRank = 17;
server.Rank17 = totalz;
}
if(totalz >= server.Rank18 && totalz < server.Rank17)
{
playerRank = 18;
server.Rank18 = totalz;
}
if(totalz >= server.Rank19 && totalz < server.Rank18)
{
playerRank = 19;
server.Rank19 = totalz;
}
if(totalz >= server.Rank20 && totalz < server.Rank19)
{
playerRank = 20;
server.Rank20 = totalz;
}
if(totalz < server.Rank20)
{
playerRank = 0;
}
almost done!
Step 3:
Search for
Code:
public void logout(){
add this under it
also add with your login screen or login welcome message.
Example:
Code:
sendMessage("Welcome to Trunescape!");
resetRanks();
And thats it! :woot: It shows top 20 players
To make the board open the highscores search for
add this under there
Code:
if(objectID == 3192)
{
highscores();
}
Now if you dont know how to add global objects, umm try this command
Code:
if (command.equalsIgnoreCase("highscores"))
{
highscores();
}
add that with the rest of your commands.
Enjoy!
Post any errors you get! Rep+ would be nice...