Jump to content
Sign in to follow this  
Hope

[Any Revision] Basic Highscores Tutorial

Recommended Posts

[B]This is a very simple and basic highscores system. It does not include the feature to view an individual player's statistics. It's purpose it just to provide those new to coding a system which shows general rankings of players. The system is entirely made from previous highscore scrips made for the RSPS community.

Yes, this is very similar to my Auto-Donation tutorial, but that's only because the website integration side is basically the same thing.

I do not take credit for the stylesheet. Some professional designer made it.
[/B]
To start, please download the following zip file:
[URL]http://uppit.com/tvqw9pjfb37p/Highscores.zip[/URL]

Functions.php:
[URL]http://pastie.org/9016856[/URL]


[SPOILER="Website Side"]

[B]1.) Start by navigating to your web-host control panel and clicking on "Mysql Databases".
[/B]
[IMG]http://i.imgur.com/UJFQq5S.png[/IMG]

[B]2.) Once there, create a new database.
[B]3.) Create a new user + password for that database.
[B]4.) Add the user to the database (Bind the user to the database).
[B]5.) Note: Don't forget the DATABASE NAME, DATABASE PASSWORD AND DATABASE USERNAME. Write it down somewhere.
[/B][/B][/B][/B][COLOR=#ff0000]Important note: Your name and username might say something like website_highscores where 'website' is part of your website name. That whole thing is your database name, not just highscores.[/COLOR]

[B]6.) Navigate back to your main control panel, then select "phpMyAdmin" which should be right next to the Mysql Databases button you previously clicked in the first step.
[B]7.) Once done, select the database you've just created.
[/B][/B]
[IMG]http://i.imgur.com/QuoW9SE.png[/IMG]

[B]8.) If done correctly, it should add a bunch of tables into your database (such as attackxp or skills, ect).
9.) Navigate back to your control panel home once again and go to your file manager. Upload all of the website files to a directory of your choice (I would suggest creating a folder called "highscores" or "hs" in your main public directory).
10.) Once uploaded, find mysql.php in yourhighscoresdirectory/assets/mysql.php
11.) Edit the database information on the top to the correct information (the credentials you created the database with).
[/B]
[B]12.) Remaining in mysql.php go down to where it says:[/B]
[code]
$website = "/cody";
[/code]

[B]and change /cody to whatever directory your highscores is located in. For example: [URL]http://yoursite.com/hs[/URL] or /hs

13.) Visit your highscores page to see if everything is functioning properly. If it is, you'll see NO error messages anywhere on the screen.

13.) Go back to your cpanel home and go to "Remote Mysql" which is located right next to php my admin that you clicked earlier. It will ask you to enter an IP to whitelist. Enter your server VPS IP.

If you've done everything correctly and have gotten no errors, you're done with the website side.
[/B]
[/SPOILER]

[SPOILER="Server Side"]

[B]1.) In the file you downloaded there's a folder called "Server Files". Click on that and copy the Highscores.java file into your server.

2.) Open it up and change the database credentials once again (just like you did in mysql.php).

3.) You'll probably get a lot of errors towards the bottom of the file in the 'saveHighscore(Player player)' method. This is because the methods for getting the player's level and xp are different across server revisions. To fix this, you'll need to change them to how your server gets player skill information.

For example: right now, the syntax in the file is:[/B]
[code]
player.getSkills().getXp(0);
[/code]
[B]
but in YOUR server, it might be:[/B]
[code]
player.getStats().getExperience(0);
[/code]

[B]You'll have to change it accordingly.

4.) To save a player's highscore, simply call the method [/B]
[code]
Highscores.saveHighscore(player);
[/code]

[/SPOILER]


After you're done, your highscores will look like this (players not included).

[IMG]http://img841.imageshack.us/img841/8972/hsql.png[/IMG] Edited by Hope

Share this post


Link to post
Share on other sites
very nice, might use thank you

Share this post


Link to post
Share on other sites
looks good but I need help its not seeming to work for me do u have Skype or anything?

Share this post


Link to post
Share on other sites
Do you mind posting the funtions.php file? I don't think you added it in and the highscores depend on it... :\

Share this post


Link to post
Share on other sites
[quote name='chex']Do you mind posting the funtions.php file? I don't think you added it in and the highscores depend on it... :\[/QUOTE]

Yeah, sorry about that! I'll update the thread with a new compressed archive tomorrow when I can.

Here's this in the meantime:
[url]http://pastie.org/9016856[/url]

Share this post


Link to post
Share on other sites
[quote name='Hope']Yeah, sorry about that! I'll update the thread with a new compressed archive tomorrow when I can.

Here's this in the meantime:
[url]http://pastie.org/9016856[/url][/QUOTE]

Awesome! Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×