Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 345
0 Users 13 Guests Online

Pet System Hiscores

Hello everyone, second tutorial here. In this tutorial I will show everyone how to have a hiscores for your Pet System.

What does this do? It grabs a user's pet and it lists the EXP, THEN it grabs the EXP in the pet and lists it. Then the list orders it by EXP. Most Exp is listed at highest and lowest exp is listed at bottom. Like a hiscores table!

I'd also like to thank MOD-Shadow as he did the part were it gives you the Rank table like 1, 2, 3, etc.

You must have SkillMasters + MOD-Dan's Pet System for this to work. Anyways. Here it is:

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
session_start
();
include 
"pet_config.php";
switch(
$_GET[page])
{
default:

echo 
"<table><tr><td>Rank</td><td>Pet Name</td><td>Owner</td><td>Experience Points</td></tr>"//table start for hiscores
$fetch mysql_query("SELECT * FROM `user_pet` ORDER BY `xp` DESC"); //grabs exp and orders it by - highest at top and lowest at bottom
$i 1
while (
$pets mysql_fetch_array($fetch)) //makes list
{
echo (
"<tr><td>$i <a href='?page=viewpet&id=$pets[id]'>$pets[pet_name]</a></td><td>$pets[owner]</td><td>$pets[xp]</td></tr>"); //the hiscore main table
$i++;
}
echo 
"</table>"//end table
break;

case 
'viewpet':
$fetch mysql_query("SELECT * FROM `user_pet` WHERE `id` = '$_GET[id]'"); //selects the pet you clicked on amd grabs data
$pets mysql_fetch_array($fetch);
echo (
"
<img src='
$pets[image]' align='right'>
$pets[owner] - the owner<br>
Pets name: 
$pets[pet_name]<br>
Type of pet: 
$pets[name]<br>
Experience points: 
$pets[xp]<br>
Hitpoints remaining: 
$pets[hp]
Pet level: 
$pets[level]<br>
Birthdate: 
$pets[birthdate]<br>
Last time you fed your pet: 
$pets[last_fed]<br>
"
);
break; 
//end page
//end case viewpet
?>


Enjoy. :-)
UrbanTwitch
Views:
2148
Rating:
Posted on Wednesday 27th August 2008 at 04:03 PM
jambomb
jambomb
non just put it on ur site and call it sumin like

pet_highscores.php

thats wat i did and it works
Posted on Wednesday 27th August 2008 at 03:42 PM
MrArmstrong
MrArmstrong
What File Do we put this in ?
Posted on Friday 1st August 2008 at 12:38 PM
jambomb
jambomb
well thats short lol