Thread: Highscores small bug.

Results 1 to 7 of 7
  1. #1 Highscores small bug. 
    HTML5, jQuery & CSS3 Master
    Jaiden Watling's Avatar
    Join Date
    Nov 2010
    Age
    29
    Posts
    888
    Thanks given
    305
    Thanks received
    92
    Rep Power
    0
    http://puu.sh/1N7lX

    Basically, if a user has more than 2147m as their max experience, it goes negative, so all i need is a small little if (xp >= [maxint]) { xp = [maxint];}

    But i have no idea how to write php

    Here is my functions.php

    Spoiler for functions.php:

    <?php


    include("mysql.php");


    function getLevelForXP($xp) {
    $lvl =1;
    if(!$xp || $xp==0) $xp = 1;


    while($xp > $output){
    $points = $points + floor($lvl + 300 * pow(2, ($lvl / 7)));
    $output = floor($points / 4);
    if($lvl > 99){
    return 99;
    break;
    } else if($xp > 13034430){
    return 99;
    break;
    } else if($xp < 83){
    return 1;
    break;
    } else if($output >= $xp){
    return $lvl;
    break;
    }
    $lvl++;
    }
    }
    function findType($type) {
    if($type == "" && $type != "PK") {
    return "Hitpoints";
    } else if($type == "0") {
    return "Hitpoints";
    } else if($type == "1") {
    return "Attack";
    } else if($type == "2") {
    return "Defence";
    } else if($type == "3") {
    return "Strength";
    } else if($type == "4") {
    return "Hitpoints";
    } else if($type == "5") {
    return "Range";
    } else if($type == "6") {
    return "Prayer";
    } else if($type == "7") {
    return "Magic";
    } else if($type == "8") {
    return "Cooking";
    } else if($type == "9") {
    return "Woodcutting";
    } else if($type == "10") {
    return "Fletching";
    } else if($type == "11") {
    return "Fishing";
    } else if($type == "12") {
    return "Firemaking";
    } else if($type == "13") {
    return "Crafting";
    } else if($type == "14") {
    return "Smithing";
    } else if($type == "15") {
    return "Mining";
    } else if($type == "16") {
    return "Herblore";
    } else if($type == "17") {
    return "Agility";
    } else if($type == "18") {
    return "Thieving";
    } else if($type == "19") {
    return "Slayer";
    } else if($type == "20") {
    return "Farming";
    } else if($type == "21") {
    return "Runecraft";
    } else if($type == "PK") {
    return "PK Rating";
    }

    }


    function fixName($name) {
    return strtolower($name);
    }


    function dots($num) {
    if($num) {
    $num = number_format($num);
    } else {
    $num = "0";
    }
    return $num;
    }
    function findRank($playerName,$skill) {
    include "mysql.php";
    $playerName = fixName($playerName);
    if(!$top_hiscore) { $top_hiscore = "101"; }
    if($skill != "0") {
    $i=1;
    $xptype = findType($skill)."xp";
    $query = mysql_query("SELECT * FROM skills ORDER BY $xptype DESC") or die(mysql_error());


    while($row = mysql_fetch_array($query)){
    if (!in_array(fixName($row["playerName"]), $banned)) {
    if(fixName($row["playerName"]) == $playerName) {
    if($i > $top_hiscore) {
    return "Not Ranked";
    } else {
    return $i;
    }
    }
    $i++;
    }
    }
    } else {
    $i=1;
    $query = mysql_query ("SELECT * FROM skillsoverall ORDER BY lvl DESC") or die(mysql_error());
    while($row = mysql_fetch_array($query)){
    if (!in_array(fixName($row["playerName"]), $banned)) {
    if(fixName($row["playerName"]) == $playerName) {
    if($i > $top_hiscore) {
    return "Not Ranked";
    } else {
    return $i;
    }
    }
    $i++;
    }
    }
    }
    }


    function BBCode($playerName) {
    include "mysql.php";
    if (in_array(fixName($playerName), $webbers)) {
    return $webbers_code.ucwords($playerName);
    } else if (in_array(fixName($playerName), $admins)) {
    return $admins_code.'<font color="#f7fe11">'.ucwords($playerName).'</font>';;
    } else if (in_array(fixName($playerName), $high_mods)) {
    return $high_mods_code.'<font color="gray">'.ucwords($playerName).'</font>';
    } else if (in_array(fixName($playerName), $mods)) {
    return $mods_code.'<font color="blue">'.ucwords($playerName).'</font>';
    } else if (in_array(fixName($playerName), $donators)) {
    return $donators_code.'<font color="green">'.ucwords($playerName).'</font>';
    }else if (in_array(fixName($playerName), $respected)) {
    return $respected_code.'<font color="red">'.ucwords($playerName).'</font>';
    } else {
    return ucwords($playerName);
    }
    }


    function showSig($playerName) {
    include "mysql.php";
    if($sig_support == "true") {
    $query = mysql_query("SELECT * FROM skills WHERE playerName = '".$playerName."' LIMIT 1") or die(mysql_error());
    $row = mysql_fetch_array($query);
    if(isset($playerName) && isset($row["playerName"]) && !in_array(fixName($row["playerName"]), $banned)) {
    echo "Use this image link to show your signature<br />";
    echo "<input type='text' size='100' value='".$website."/image.php?playerName=".$playerName."' class='button'><br /><br />";
    echo "<b>Demo:</b><br />";
    echo "<img src='".$website."/image.php?playerName=".$playerName."'>";
    } else {
    echo "The user dosent exist";
    }
    } else {
    echo "Signatures isent supported.";
    }
    }
    function Pkrating() {
    include "mysql.php";
    if(!$top_hiscore) { $top_hiscore = "101"; }
    echo '
    <table class="table_back">
    <tbody>
    <thead>
    <tr class="table_header">
    <th class="rankHead">Rank</th>
    <th class="nameHead">Name</th>


    <th class="scoreHead">Score</th>
    </tr>
    </thead>
    ';
    $count = mysql_result(mysql_query("SELECT COUNT(*) FROM skills"),0) or die(mysql_error());

    $from = (isset($_GET["from"]) && is_numeric($_GET["from"]) && $_GET["from"] < $count) ? $_GET["from"] : 0;
    $query = mysql_query ("SELECT * FROM skills ORDER BY Rating DESC limit $from, $ppls_page") or die(mysql_error());

    $i = $from;
    while($row = mysql_fetch_array($query)){
    $i++;
    if($i < $top_hiscore) {
    if($i & 1) {
    echo '<tr class="row row1">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.dots($row["Rating"]).'</td>
    </tr>
    ';
    } else {
    echo '<tr class="row row2">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.dots($row["Rating"]).'</td>
    </tr>
    ';
    }
    }
    }
    echo '</table>
    ';
    if($count >= $ppls_page) {
    echo '<table border="0" width="100%">
    <tr>
    <td align="center">
    ';
    if ($from > 0) {
    $back= $from - $ppls_page;
    echo '<a href="'.$website.'/'.$file.'?type=0&from='.$back.'"><b>Back</b></a> ';
    }
    $page = 1;


    for ($start = 0; $count > $start; $start = $start + $ppls_page) {
    if($from != $page * $ppls_page - $ppls_page) {
    if($start < $top_hiscore) {
    echo '<a href="'.$website.'/'.$file.'?type=0&from='.$start.'"><b>'.$page.'</b></a> ';
    }
    } else {
    echo $page.' ';
    }
    $page++;
    }


    if ($from < $count - $ppls_page || $from < $top_hiscore) {
    $next = $from + $ppls_page;
    if($next < $top_hiscore) {
    echo ' <a href="'.$website.'/'.$file.'?type=0&from='.$next.'"><b>Next</b></a>';
    }
    }
    echo "</td>
    </tr>
    </table>";
    }
    }
    function Roguerating() {
    include "mysql.php";
    if(!$top_hiscore) { $top_hiscore = "101"; }
    echo '
    <table class="table_back">
    <tbody>
    <thead>
    <tr class="table_header">
    <th class="rankHead">Rank</th>
    <th class="nameHead">Name</th>


    <th class="scoreHead">Score</th>
    </tr>
    </thead>
    ';
    $count = mysql_result(mysql_query("SELECT COUNT(*) FROM skills"),0) or die(mysql_error());

    $from = (isset($_GET["from"]) && is_numeric($_GET["from"]) && $_GET["from"] < $count) ? $_GET["from"] : 0;
    $query = mysql_query ("SELECT * FROM skills ORDER BY Score DESC limit $from, $ppls_page") or die(mysql_error());

    $i = $from;
    while($row = mysql_fetch_array($query)){
    $i++;
    if($i < $top_hiscore) {
    if($i & 1) {
    echo '<tr class="row row1">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.dots($row["Score"]).'</td>
    </tr>
    ';
    } else {
    echo '<tr class="row row2">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.dots($row["Score"]).'</td>
    </tr>
    ';
    }
    }
    }
    echo '</table>
    ';
    if($count >= $ppls_page) {
    echo '<table border="0" width="100%">
    <tr>
    <td align="center">
    ';
    if ($from > 0) {
    $back= $from - $ppls_page;
    echo '<a href="'.$website.'/'.$file.'?type=0&from='.$back.'"><b>Back</b></a> ';
    }
    $page = 1;


    for ($start = 0; $count > $start; $start = $start + $ppls_page) {
    if($from != $page * $ppls_page - $ppls_page) {
    if($start < $top_hiscore) {
    echo '<a href="'.$website.'/'.$file.'?type=0&from='.$start.'"><b>'.$page.'</b></a> ';
    }
    } else {
    echo $page.' ';
    }
    $page++;
    }


    if ($from < $count - $ppls_page || $from < $top_hiscore) {
    $next = $from + $ppls_page;
    if($next < $top_hiscore) {
    echo ' <a href="'.$website.'/'.$file.'?type=0&from='.$next.'"><b>Next</b></a>';
    }
    }
    echo "</td>
    </tr>
    </table>";
    }
    }
    function OverallHiscore() {
    include "mysql.php";
    if(!$top_hiscore) { $top_hiscore = "101"; }
    echo '<table border="0" width="100%">
    <table class="table_back">
    <tbody>
    <thead>
    <tr class="table_header">
    <th class="rankHead">Rank</th>
    <th class="nameHead">Name</th>
    <th class="levelHead">Level</th>
    <th class="xpHead">XP</th>
    </tr>


    </thead>
    ';
    $count = mysql_result(mysql_query("SELECT COUNT(*) FROM skillsoverall"),0) or die(mysql_error());

    $from = (isset($_GET["from"]) && is_numeric($_GET["from"]) && $_GET["from"] < $count) ? $_GET["from"] : 0;


    $query = mysql_query ("SELECT * FROM skillsoverall ORDER BY xp DESC limit $from, $ppls_page") or die(mysql_error());

    $i = $from;
    while($row = mysql_fetch_array($query)){
    $i++;
    if($i < $top_hiscore) {
    if($i & 1) {
    echo '<tr class="row row1">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.dots($row["lvl"]).'</td>
    <td class="alL">'.dots($row["xp"]).'</td>
    </tr>
    ';
    } else {
    echo '<tr class="row row2">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.dots($row["lvl"]).'</td>
    <td class="alL">'.dots($row["xp"]).'</td>
    </tr>
    ';


    }
    }
    }
    echo '</tbody>
    </table>
    ';
    if($count >= $ppls_page) {
    echo '<table border="0" width="100%">
    <tr>
    <td align="center">
    ';
    if ($from > 0) {
    $back= $from - $ppls_page;
    echo '<a href="'.$website.'/'.$file.'?type=0&from='.$back.'"><b>Back</b></a> ';
    }
    $page = 1;


    for ($start = 0; $count > $start; $start = $start + $ppls_page) {
    if($from != $page * $ppls_page - $ppls_page) {
    if($start < $top_hiscore) {
    echo '<a href="'.$website.'/'.$file.'?type=0&from='.$start.'"><b>'.$page.'</b></a> ';
    }
    } else {
    echo $page.' ';
    }
    $page++;
    }


    if ($from < $count - $ppls_page || $from < $top_hiscore) {
    $next = $from + $ppls_page;
    if($next < $top_hiscore) {
    echo ' <a href="'.$website.'/'.$file.'?type=0&from='.$next.'"><b>Next</b></a>';
    }
    }
    echo "</td>
    </tr>
    </table>";
    }
    }
    function showPlayers($type) {
    include "mysql.php";
    if(!$top_hiscore) { $top_hiscore = "101"; }
    echo '<div id="playerList_back" class="brown_box">


    <div id="scores_head" class="subsectionHeader" style="padding: 0px;">
    <img src="'.$website.'/assets/skill_icon_'.strtolower(findType($type)).'1.gif">' .ucwords(findType($type)).'


    HighScores
    </div>
    <table class="table_back">
    <tbody>
    <thead>
    <tr class="table_header">
    <th class="rankHead">Rank</th>
    <th class="nameHead">Name</th>
    <th class="levelHead">Level</th>
    <th class="xpHead">XP</th>
    </tr>
    </thead>';


    $xptype = findType($type)."xp";
    if ($xptype >= 1){
    $xptype = 2147000000;
    }
    $count = mysql_result(mysql_query("SELECT COUNT(*) FROM skills"),0) or die(mysql_error());
    $from = (isset($_GET["from"]) && is_numeric($_GET["from"]) && $_GET["from"] < $count) ? $_GET["from"] : 0;
    $query = mysql_query ("SELECT * FROM skills ORDER BY $xptype DESC limit $from, $ppls_page") or die(mysql_error());
    $i = $from;
    while($row = mysql_fetch_array($query)){
    $i++;
    if($i < $top_hiscore && !in_array($row["playerName"], $banned) && !in_array(ucwords($row["playerName"]), $banned)) {
    if($i & 1) {
    echo '<tr class="row row1">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.getLevelForXP($row[$xptype]).'</td>
    <td class="alL">'.dots($row[$xptype]).'</td>
    </tr>';
    } else {
    echo '<tr class="row row2">
    <td class="rankCol">'.$i.'</td>
    <td class="alL"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td>
    <td class="alL">'.getLevelForXP($row[$xptype]).'</td>
    <td class="alL">'.dots($row[$xptype]).'</td>
    </tr>';
    }
    }

    }
    echo '</tbody></table>
    ';
    if($count >= $ppls_page) {
    echo '<table border="0" width="100%">
    <tr>
    <td align="center">
    ';
    if ($from > 0) {
    $back= $from - $ppls_page;
    echo '<a href="'.$website.'/'.$file.'?type='.$_GET["type"].'&from='.$back.'"><b>Back</b></a> ';
    }
    $page = 1;
    for ($start = 0; $count > $start; $start = $start + $ppls_page) {
    if($from != $page * $ppls_page - $ppls_page) {
    if($start < $top_hiscore) {
    echo '<a href="'.$website.'/'.$file.'?type='.$_GET["type"].'&from='.$start.'"><b>'.$page.'</b></a> ';
    }
    } else {
    echo $page." ";
    }
    $page++;
    }


    if ($from < $count - $ppls_page || $from < $top_hiscore) {
    $next = $from + $ppls_page;
    if($next < $top_hiscore) {
    echo ' <a href="'.$website.'/'.$file.'?type='.$_GET["type"].'&from='.$next.'"><b>Next</b></a>';
    }
    }
    echo "</td>
    </tr>
    </table>";
    }
    }
    function showPlayer($name) {
    include "mysql.php";
    $query = mysql_query("SELECT * FROM skills WHERE playerName LIKE '".fixName($name)."' LIMIT 1") or die(mysql_error());

    $row = mysql_fetch_array($query);
    $overall["lvl"] = getLevelForXP($row["Attackxp"]) + getLevelForXP($row["Defencexp"]) + getLevelForXP($row["Strengthxp"]) + getLevelForXP($row["Hitpointsxp"]) + getLevelForXP($row["Rangexp"]) + getLevelForXP($row["Prayerxp"]) + getLevelForXP($row["Magicxp"]) + getLevelForXP($row["Cookingxp"]) + getLevelForXP($row["Woodcuttingxp"]) + getLevelForXP($row["Fletchingxp"]) + getLevelForXP($row["Fishingxp"]) + getLevelForXP($row["Firemakingxp"]) + getLevelForXP($row["Craftingxp"]) + getLevelForXP($row["Smithingxp"]) + getLevelForXP($row["Miningxp"]) + getLevelForXP($row["Herblorexp"]) + getLevelForXP($row["Agilityxp"]) + getLevelForXP($row["Thievingxp"]) + getLevelForXP($row["Slayerxp"]) + getLevelForXP($row["Farmingxp"]) + getLevelForXP($row["Runecraftxp"]);
    $overall["xp"] = $row["Attackxp"] + $row["Defencexp"] + $row["Strengthxp"] + $row["Hitpointsxp"] + $row["Rangexp"] + $row["Prayerxp"] + $row["Magicxp"] + $row["Cookingxp"] + $row["Woodcuttingxp"] + $row["Fletchingxp"] + $row["Fishingxp"] + $row["Firemakingxp"] + $row["Craftingxp"] + $row["Smithingxp"] + $row["Miningxp"] + $row["Herblorexp"] + $row["Agilityxp"] + $row["Thievingxp"] + $row["Slayerxp"] + $row["Farmingxp"] + $row["Runecraftxp"];
    echo '


    <div class="brown_background">
    <div id="hiscores_background" class="inner_brown_background">
    <div class="center_container">
    <div id="player_header" class="brown_box">
    <div id="player_sub" class="subsectionHeader">
    Personal scores for <div class="player_name"><a href="'.$website.'/'.$pers.'?name='.$row["playerName"].'" target="_self">'.BBCode($row["playerName"]).'</a></td></div>
    </div>
    </div>
    <div id="PlayerSkill_back" class="brown_box">
    <div id="scores_head" class="subsectionHeader" style="padding: 0px">
    Skills
    </div>
    <table class="table_back" style="margin-bottom:5px" id="mini_player">
    <tbody>
    <thead>
    <tr class="table_header">


    <th class="imageHead_P"></th>
    <th class="skillsHead_P">Skills</th>
    <th class="rankHead_P">Rank</th>
    <th class="levelHead_P">Level</th>
    <th class="xpHead_P">XP</th>
    </tr>
    </thead>


    <tr class="row rowp1">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_overall1.gif">
    </td>


    <td class="alL">
    <a href="'.$website.'/'.$file.'?type=0" target="_self">Overall</a>
    </td>


    <td class="alL">'.findRank($_GET["name"],"0").'</td>
    <td class="alL">'.dots($overall["lvl"]).'</td>
    <td class="alL">'.dots($overall["xp"]).'</td>
    </tr>




    <tr class="row rowp2">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_attack1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=1" target="_self">


    Attack
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"1").'</td>
    <td class="alL">'.getLevelForXP($row["Attackxp"]).'</td>
    <td class="alL">'.dots($row["Attackxp"]).'</td>
    </tr>
    <tr class="row rowp3">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_defence1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=2" target="_self">


    Defence
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"2").'</td>
    <td class="alL">'.getLevelForXP($row["Defencexp"]).'</td>
    <td class="alL">'.dots($row["Defencexp"]).'</td>
    </tr>
    <tr class="row rowp4">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_strength1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=3" target="_self">


    Strength
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"3").'</td>
    <td class="alL">'.getLevelForXP($row["Strengthxp"]).'</td>
    <td class="alL">'.dots($row["Strengthxp"]).'</td>
    </tr>
    <tr class="row rowp5">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_hitpoints1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=4" target="_self">


    Hitpoints
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"4").'</td>
    <td class="alL">'.getLevelForXP($row["Hitpointsxp"]).'</td>
    <td class="alL">'.dots($row["Hitpointsxp"]).'</td>
    </tr>
    <tr class="row rowp6">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_range1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=5" target="_self">


    Ranged
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"5").'</td>
    <td class="alL">'.getLevelForXP($row["Rangexp"]).'</td>
    <td class="alL">'.dots($row["Rangexp"]).'</td>
    </tr>
    <tr class="row rowp7">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_prayer1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=6" target="_self">


    Prayer
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"6").'</td>
    <td class="alL">'.getLevelForXP($row["Prayerxp"]).'</td>
    <td class="alL">'.dots($row["Prayerxp"]).'</td>
    </tr>
    <tr class="row rowp8">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_magic1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=7" target="_self">


    Magic
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"7").'</td>
    <td class="alL">'.getLevelForXP($row["Magicxp"]).'</td>
    <td class="alL">'.dots($row["Magicxp"]).'</td>
    </tr>
    <tr class="row rowp9">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_cooking1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=8" target="_self">


    Cooking
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"8").'</td>
    <td class="alL">'.getLevelForXP($row["Cookingxp"]).'</td>
    <td class="alL">'.dots($row["Cookingxp"]).'</td>
    </tr>
    <tr class="row rowp10">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_woodcutting1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=9" target="_self">


    Woodcutting
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"9").'</td>
    <td class="alL">'.getLevelForXP($row["Woodcuttingxp"]).'</td>
    <td class="alL">'.dots($row["Woodcuttingxp"]).'</td>
    </tr>
    <tr class="row rowp11">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_fletching1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=10" target="_self">


    Fletching
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"10").'</td>
    <td class="alL">'.getLevelForXP($row["Fletchingxp"]).'</td>
    <td class="alL">'.dots($row["Fletchingxp"]).'</td>
    </tr>
    <tr class="row rowp12">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_fishing1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=11" target="_self">


    Fishing
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"11").'</td>
    <td class="alL">'.getLevelForXP($row["Fishingxp"]).'</td>
    <td class="alL">'.dots($row["Fishingxp"]).'</td>
    </tr>
    <tr class="row rowp13">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_firemaking1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=12" target="_self">


    Firemaking
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"12").'</td>
    <td class="alL">'.getLevelForXP($row["Firemakingxp"]).'</td>
    <td class="alL">'.dots($row["Firemakingxp"]).'</td>
    </tr>
    <tr class="row rowp14">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_crafting1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=13" target="_self">


    Crafting
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"13").'</td>
    <td class="alL">'.getLevelForXP($row["Craftingxp"]).'</td>
    <td class="alL">'.dots($row["Craftingxp"]).'</td>
    </tr>
    <tr class="row rowp15">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_smithing1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=14" target="_self">


    Smithing
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"14").'</td>
    <td class="alL">'.getLevelForXP($row["Smithingxp"]).'</td>
    <td class="alL">'.dots($row["Smithingxp"]).'</td>
    </tr>
    <tr class="row rowp16">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_mining1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=15" target="_self">


    Mining
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"15").'</td>
    <td class="alL">'.getLevelForXP($row["Miningxp"]).'</td>
    <td class="alL">'.dots($row["Miningxp"]).'</td>
    </tr>
    <tr class="row rowp17">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_herblore1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=16" target="_self">


    Herblore
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"16").'</td>
    <td class="alL">'.getLevelForXP($row["Herblorexp"]).'</td>
    <td class="alL">'.dots($row["Herblorexp"]).'</td>
    </tr>
    <tr class="row rowp18">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_agility1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=17" target="_self">


    Agility
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"17").'</td>
    <td class="alL">'.getLevelForXP($row["Agilityxp"]).'</td>
    <td class="alL">'.dots($row["Agilityxp"]).'</td>
    </tr>
    <tr class="row rowp19">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_thieving1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=18" target="_self">


    Thieving
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"18").'</td>
    <td class="alL">'.getLevelForXP($row["Thievingxp"]).'</td>
    <td class="alL">'.dots($row["Thievingxp"]).'</td>
    </tr>
    <tr class="row rowp20">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_slayer1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=19" target="_self">


    Slayer
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"19").'</td>
    <td class="alL">'.getLevelForXP($row["Slayerxp"]).'</td>
    <td class="alL">'.dots($row["Slayerxp"]).'</td>
    </tr>
    <tr class="row rowp21">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_farming1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=20" target="_self">


    Farming
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"20").'</td>
    <td class="alL">'.getLevelForXP($row["Farmingxp"]).'</td>
    <td class="alL">'.dots($row["Farmingxp"]).'</td>
    </tr>
    <tr class="row rowp22">
    <td align="center">
    <img src="'.$website.'/assets/skill_icon_runecraft1.gif">
    </td>
    <td class="alL">
    <a href="'.$website.'/'.$file2.'?type=21" target="_self">


    Runecrafting
    </a>
    </td>
    <td class="alL">'.findRank($_GET["name"],"21").'</td>
    <td class="alL">'.getLevelForXP($row["Runecraftxp"]).'</td>
    <td class="alL">'.dots($row["Runecraftxp"]).'</td>
    </tr>
    </table>
    </div>
    ';
    }
    ?>

    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Apr 2012
    Posts
    5
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    When you mean goes negative, can you explain?

    Like, does it start negating EXP, or go -500K -> So makes it way backwards?
    Reply With Quote  
     

  3. #3  
    HTML5, jQuery & CSS3 Master
    Jaiden Watling's Avatar
    Join Date
    Nov 2010
    Age
    29
    Posts
    888
    Thanks given
    305
    Thanks received
    92
    Rep Power
    0
    Quote Originally Posted by Pthnmj View Post
    When you mean goes negative, can you explain?

    Like, does it start negating EXP, or go -500K -> So makes it way backwards?

    Basically, once it reaches the maxint it goes to -1 and then keeps decreasing from there. and as depicted in the picture, causes the person with the highest score to be lowest on the highscores.

    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jul 2012
    Posts
    361
    Thanks given
    185
    Thanks received
    9
    Rep Power
    25
    I have this problem also!
    Reply With Quote  
     

  5. #5  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    It's because you're using the type integer which has a maximum value of 2.147.. and a minimum of -2.147.., change the type to that of a long.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Jul 2012
    Posts
    361
    Thanks given
    185
    Thanks received
    9
    Rep Power
    25
    Quote Originally Posted by Jason View Post
    It's because you're using the type integer which has a maximum value of 2.147.. and a minimum of -2.147.., change the type to that of a long.
    Oh, and would this work
    Code:
    	public static long[] playerXP = new long[25];
    	public static long total(Client clientToSave) {
    		for(int i=0; i < 21; i++) {
    			playerXP[i] = clientToSave.playerXP[i];
    			}
    				long k = (playerXP[0]) + (playerXP[1]) + (playerXP[2]) + (playerXP[3]) + (playerXP[4]) + (playerXP[5]) + (playerXP[6]) + (playerXP[7]) + (playerXP[8]) + (playerXP[9]) + (playerXP[10]) + (playerXP[11]) + (playerXP[12]) + (playerXP[13]) + (playerXP[14]) + (playerXP[15]) + (playerXP[16]) + (playerXP[17]) + (playerXP[18]) + (playerXP[19]) + (playerXP[20]);
    			if(k < 0) {
    				return k;
    			} else {
    				return k;
    			}
    	}
    edit fixed
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Jul 2012
    Posts
    361
    Thanks given
    185
    Thanks received
    9
    Rep Power
    25
    Edit: foxed
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 1
    Last Post: 07-19-2010, 09:48 PM
  2. Small configuration for highscores
    By xx k03d xx in forum Help
    Replies: 0
    Last Post: 02-11-2010, 11:30 AM
  3. Small
    By Jakey in forum Suggestions
    Replies: 14
    Last Post: 04-22-2009, 05:46 AM
  4. How small we really are
    By Kevve in forum Videos
    Replies: 1
    Last Post: 10-19-2008, 10:01 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •