Ow, I overlooked that.soehest wrote:Oh the none part is correct to me as wellXymph wrote:What isn't correct? That it says '<none>' for a player that has no server rank? Seems rather logical to me.soehest wrote:Just noticed this:
[...snipped image...]
guess that can't be correctI was thinking that there are users sharing the same rank, how is that possible? Am i missing out on something as usual
![]()

Obtaining the rank number is done in an efficient but simplified way, not by sorting and counting down the entire players list but by merely counting how many players have an Avg. value that's less than that of the player you need the rank for. See this code:
Code: Select all
function getRank($login) {
$query = 'SELECT avg FROM rs_rank
WHERE playerID=' . $this->aseco->getPlayerId($login);
$res = mysql_query($query);
if (mysql_num_rows($res) > 0) {
$row = mysql_fetch_array($res);
$query2 = 'SELECT * FROM rs_rank WHERE avg>0 and avg<' . $row['avg'];
$res2 = mysql_query($query2);
$query3 = 'SELECT * FROM rs_rank';
$res3 = mysql_query($query3);
$message = formatText('{1}/{2} Avg: {3}',
mysql_num_rows($res2)+1,
mysql_num_rows($res3),
sprintf("%4.1F", $row['avg']/10000));
mysql_free_result($res2);
mysql_free_result($res3);
} else {
$message = 'None';
}
mysql_free_result($res);
return $message;
} // end getRank
Btw, this is less likely to happen when you have more tracks on your server, and thus a smaller chance that players have the same Avg's.