Post retirado do OTFans!
Funciona apenas para servers SQL com o nova estrutura de Banco de Dados.
Versão antiga que funciona com estrutura antiga pode ser encontrado nesse link:
http://rapidshare.com/files/25881668/highscores.rar.html
-------------------------------------------------------------------------------------------
Hello!
This highscores was made by me.
The codes are based on the script made by Junkfood, and some credits will be to him.
No GM's in the Rank and 25 players per page.
ChangeLog:
Bugs:
Config.php
<?
/*
Script made by Tatu_Hunter
Please dont remove this Credits
*/
$group_id = "2"; // Players with group_id more or equal to this variable will not shown in the rank.
$db['user'] = "root"; // Your USER for MySQL.
$db['pass'] = "password"; // Your Password.
$db['host'] = "localhost"; // HOST.
$db['name'] = "database"; // Data Base name.
@mysql_connect($db['host'], $db['user'], $db['pass']) or die("Unable to connect with the date base.");
@mysql_select_db($db['name']) or die("Unable to select the data base <b>".$db['name']."</b>.");
?>
and Highscores.php
<?
/*
Script made by Tatu_Hunter
Please dont remove this Credits
*/
include("config.php");
$cfg['rank'] = 25;
if(isset($_GET['skill'])){
$skill = $_GET['skill'];
} else {
$skill = "Level";
}
if(!isset($_GET['pg'])) {
$pg = 1;
} else {
$pg = $_GET['pg'];
}
if($pg > 11){
$inicio = 11;
}else{
$inicio = $pg - 1;
}
$ini = $inicio * $cfg['rank'];
$prox = $cfg['rank'] * $pg + 1;
$prox_ = $cfg['rank'] * $pg + $cfg['rank'];
if($pg == 2){
$ante = "1-".$cfg['rank'];
}elseif($pg > 2){
$aa = $pg - 1;
$b = $pg - 2;
$a = $cfg['rank'] * $b;
$ante = $a+'1'."-".$cfg['rank']*$aa;
}
if($pg == 1 or $pg == ""){
$asd = " ";
}else{
$asd = " | ";
}
?>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<div align="center"><h3 class="headerstyle">Highscores - Top 300</h3></div>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td width="87%" valign="top"><table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#000000">
<tr>
<td width="10%"><div align="center"><span class="style1">Rank</span></div></td>
<td width="50%"><span class="style1">Nome</span></td>
<td width="15%"><div align="center"><span class="style1"><?=$skill?></span></div></td>
<? if($skill == "Level"){?><td width="25%"><div align="center"><span class="style1">Experience</span></div></td><? } ?>
</tr>
<? switch($skill){
case "Fist":
$id = 0;
break;
case "Club":
$id = 1;
break;
case "Sword":
$id = 2;
break;
case "Axe":
$id = 3;
break;
case "Distance":
$id = 4;
break;
case "Shield":
$id = 5;
break;
case "Fish":
$id = 6;
break;
}
if($skill == "Level") {
$total = mysql_query("SELECT * FROM players WHERE group_id < '".$group_id."' ORDER BY level");
$tr = mysql_num_rows($total);
$tp = $tr / $cfg['rank'];
$tp = ceil($tp);
$ant = $pg-1;
$pro = $pg+1;
$verifica = mysql_query("SELECT name,level,experience FROM players WHERE group_id < '".$group_id."' ORDER BY experience DESC LIMIT ".$ini.",".$cfg['rank']."");
if($pg == 1 or $pg == 0){
$i = 1;
}elseif($pg > 1){
$i = $ini+1;
}
while($dados = mysql_fetch_array($verifica)) {
echo ' <tr>
<td bgcolor="#FFFFFF"><center>'.$i.'</center></td>
<td bgcolor="#FFFFFF">'.$dados['name'].'</td>
<td bgcolor="#FFFFFF"><center>'.$dados['level'].'</center></td>
<td bgcolor="#FFFFFF"><center>'.number_format($dados['experience']).'</center></td>
</tr>';
$i++;
}
if($tr > $cfg['rank']){
echo '<tr bgcolor="#FFFFFF">
<td colspan=4><div align="right">';
if($pg > 1){
$anterior = '<a href="?skill='.$skill.'&pg='.$ant.'">Rank '.$ante.'</a>';
}
if($pg != 11){
if($pg < $tp){
$proxima = '<a href="?skill='.$skill.'&pg='.$pro.'">Rank '.$prox.'-'.$prox_.'</a>';
$tt = true;
}
}
echo $anterior;
if($tt == true) echo $asd;
echo $proxima;
echo '</div></td><tr>';
}
}
elseif($skill == "Magic") {
$total = mysql_query("SELECT * FROM players WHERE group_id < '".$group_id."' ORDER BY maglevel");
$tr = mysql_num_rows($total);
$tp = $tr / $cfg['rank'];
$tp = ceil($tp);
$ant = $pg-1;
$pro = $pg+1;
$verifica = mysql_query("SELECT name,maglevel FROM players WHERE group_id < '".$group_id."' ORDER BY maglevel DESC LIMIT ".$ini.",".$cfg['rank']."");
if($pg == 1 or $pg == 0){
$i = 1;
}elseif($pg > 1){
$i = $ini+1;
}
while($dados = mysql_fetch_array($verifica)) {
echo ' <tr>
<td bgcolor="#FFFFFF"><center>'.$i.'</center></td>
<td bgcolor="#FFFFFF">'.$dados['name'].'</td>
<td bgcolor="#FFFFFF"><center>'.$dados['maglevel'].'</center></td>
</tr>';
$i++;
}
if($tr > $cfg['rank']){
echo '<tr bgcolor="#FFFFFF">
<td colspan=3><div align="right">';
if($pg > 1){
$anterior = '<a href="?skill='.$skill.'&pg='.$ant.'">Rank '.$ante.'</a>';
}
if($pg != 11){
if($pg < $tp){
$proxima = '<a href="?skill='.$skill.'&pg='.$pro.'">Rank '.$prox.'-'.$prox_.'</a>';
$tt = true;
}
}
echo $anterior;
if($tt == true) echo $asd;
echo $proxima;
echo '</div></td><tr>';
}
}
else {
$total = mysql_query("SELECT name,value FROM players, player_skills WHERE group_id < '".$group_id."' AND players.id = player_skills.player_id AND player_skills.skillid = ".$id." ORDER BY value DESC");
$tr = mysql_num_rows($total);
$tp = $tr / $cfg['rank'];
$tp = ceil($tp);
$ant = $pg-1;
$pro = $pg+1;
$verifica = mysql_query("SELECT name,value FROM players, player_skills WHERE group_id < '".$group_id."' AND players.id = player_skills.player_id AND player_skills.skillid = ".$id." ORDER BY value DESC LIMIT ".$ini.",".$cfg['rank']."");
if($pg == 1 or $pg == 0){
$i = 1;
}elseif($pg > 1){
$i = $ini+1;
}
while($dados = mysql_fetch_array($verifica)) {
echo ' <tr>
<td bgcolor="#FFFFFF"><center>'.$i.'</center></td>
<td bgcolor="#FFFFFF">'.$dados['name'].'</td>
<td bgcolor="#FFFFFF"><center>'.$dados['value'].'</center></td>
</tr>';
$i++;
}
if($tr > $cfg['rank']){
echo '<tr bgcolor="#FFFFFF">
<td colspan=3><div align="right">';
if($pg > 1){
$anterior = '<a href="?skill='.$skill.'&pg='.$ant.'">Rank '.$ante.'</a>';
}
if($pg != 11){
if($pg < $tp){
$proxima = '<a href="?skill='.$skill.'&pg='.$pro.'">Rank '.$prox.'-'.$prox_.'</a>';
$tt = true;
}
}
echo $anterior;
if($tt == true) echo $asd;
echo $proxima;
echo '</div></td><tr>';
}
}
?>
</table>
<div align="right">
</div>
<table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#000000">
</table></td>
<td width="13%" valign="top"><table width="130" border="0" align="right" cellpadding="2" cellspacing="1" bgcolor="#000000">
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Level">Level</a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Magic">Magic Level </a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Fist">Fist Fighting </a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Club">Club Fighting </a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Sword">Sword Fighting </a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Axe">Axe Fighting </a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Distance">Distance Fighting</a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Shield">Shielding</a></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><div align="center"><a href="?topico=highscores&skill=Fish">Fishing</a></div></td>
</tr>
</table></td>
</tr>
</table>
<?
mysql_close();
?>
Screenshot
------
If you find any bug post here...
c ya!
---------
Ahhh lembrando que eu sou Tatu_Hunter.