GamerzPlanet - For All Your Online Gaming Needs!!  

Go Back   GamerzPlanet - For All Your Online Gaming Needs!! > Online Gaming > RuneScape > RuneScape General > RuneScape Private Servers

RuneScape Private Servers RuneScape Private Server Discussion.



Adding an in-game highscores board

RuneScape Private Servers


Reply
 
Thread Tools Display Modes
Old 07-15-2008, 06:44 PM   #1
Lurker
 
Last Online: 08-27-2008 12:23 PM
Join Date: Apr 2007
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
tjrazor is on a distinguished road
iTrader: 0 / 0%
Points: 2,314.96
Bank: 0.00
Total Points: 2,314.96
Adding an in-game highscores board

Before someone says something, I have posted this on some other forums under the name of tj007razor.

Purpose
: To simply add in-game highscores to your server

Difficulty: 1 or 2, not hard.

Assumed Knowledge: copy + paste, ability to READ

Server Base: old cheezescape - should work on all

Classes Modified: client.java, server.java

Procedure

Step 1: First, we declare what we need in server.java
Open up server.java and directly underneath
Code:
public static final int cycleTime = 500;
put
Code:
    /*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];
Step 2: Now we move into client.java
Open up client.java and underneath
Code:
public class client extends Player implements Runnable {
put
Code:
//In-game highscores
public int playerRank = 0;

public void resetRanks() {
    for (int i = 0; i < 10; i++) {
        server.ranks[i] = 0;
        server.rankPpl[i] = "";
    }
}

public void highscores() {
    clearQuestInterface();
    sendQuest("@dbl@", 8144);  //Title
    sendQuest("@dre@~In-Game Top 10 Highscores~", 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
Step 3: Now for the process
Still in client.java, inside of
Code:
public boolean process() {        // is being called regularily every 500ms
and add
Code:
    //in-game highscores
    playerLevel[24] = totalz;
    
    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
Step 4: This is where we add how to access teh highscores.
I used a scoreboard object. You don't need to. Find
Code:
case 132:
, your object click packet, and in it put
Code:
//highscores
if(objectID == 3192)
{
highscores();
}
or, if you want a command, in with the rest of your commands add this:
Code:
    if (command.equalsIgnoreCase("highscores")) {
        highscores();
    }
Step 5: Now to add the object, again, if you don't want to use one, you don't need to.
Most servers I believe have this - find
Code:
public void NewObjects() {
and add
Code:
        //(coordX, coordY, objID, face, ??)
        AddGlobalObject(2604, 3160, 3192, -1, 10);//Scoreboard, change coords to fit your needs
        AddGlobalObject(2605, 3162, 3192, -2, 10);//Scoreboard, change coords to fit your needs
Pic:

Save - Compile - and Bam! you have highscores.

Credits: 10% Bulby Strife for letting me use his idea 90% Me, tj007razor, for completely redoing it

Just if anyone needs it - you may need to declare
Code:
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[6]) + getLevelForXP(playerXP[17]) + getLevelForXP(playerXP[18]) + getLevelForXP(playerXP[19]) + getLevelForXP(playerXP[20]) + getLevelForXP(playerXP[21]));
then in boolean process add
Code:
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[17]) + getLevelForXP(playerXP[18]) + getLevelForXP(playerXP[19]) + getLevelForXP(playerXP[20]) + getSummonLvlForXP(summonXP));
if(oldtotal != totalz)
sendFrame126("Total Lvl: "+totalz, 3984);
Some sources already have this, some don't.

**If you get errors post here!**
tjrazor is offline   Reply With Quote
Sponsored Links
Old 07-23-2008, 04:20 PM   #2
Banned
 
Last Online: 08-25-2008 02:53 PM
Join Date: May 2008
Posts: 38
Thanks: 16
Thanked 4 Times in 4 Posts
wizman12333 is on a distinguished road
iTrader: 0 / 0%
Points: 5,080.31
Bank: 0.00
Total Points: 5,080.31
Re: Adding an in-game highscores board

Hey, nice, i like this, i think that some figmentscape servers already have this, but if they dont its a nice addition, thanks for sharing with us from rune-server
wizman12333 is offline   Reply With Quote
Old 07-24-2008, 06:05 PM   #3
Lurker
 
Last Online: 08-27-2008 12:23 PM
Join Date: Apr 2007
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
tjrazor is on a distinguished road
iTrader: 0 / 0%
Points: 2,314.96
Bank: 0.00
Total Points: 2,314.96
Re: Adding an in-game highscores board

If figmentscape has it then they used my tutorial because I posted this same tutorial on rune-server back in January and I coded it myself.
tjrazor is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT -7. The time now is 02:47 AM.


Powered by: vBulletin
Copyright ©2008, GamerzPlanet.Net
SEO by vBSEO 3.2.0 RC5 ©2008, Crawlability, Inc.
Network: GamerzPlanet | ForumzPlanet | GzPUpload | GzPArcade | GzP Host | Poker Tips | Visits: