Jump to content
MakeWebGames

Recommended Posts

Posted
function get_rank($stat, $mykey)
{
global $ir,$userid,$c;
$q=mysql_query("SELECT count(*) FROM userstats us LEFT JOIN users u ON us.userid=u.userid WHERE us.$mykey > $stat AND us.userid != $userid AND u.user_level != 0", $c) ;
return mysql_result($q,0,0)+1;
}
function get_gamerank($level, $housevalue, $stats)
{
$tp=($level*$level) * 3000 + ($housevalue) + (($stats['strength']+$stats['agility']+$stats['guard']+$stats['labour']+$stats['IQ']) * 10);
if ( $tp < 100000 ) { return "#1 First Newbie"; }
else if ( $tp < 400000 ) { return "#2 Newbie"; }
else if ( $tp < 1600000 ) { return "#3 Beginner"; }
else if ( $tp < 6400000 ) { return "#4 Not Experienced"; }
else if ( $tp < 25600000 ) { return "#5 Rookie"; }
else if ( $tp < 102400000 ) { return "#6 Average"; }
else if ( $tp < 409600000 ) { return "#7 Good"; }
else if ( $tp < 819200000 ) { return "#8 Very Good"; }
else if ( $tp < 3276800000 ) { return "#9 Greater Than Average"; }
else if ( $tp < 13107200000 ) { return "#10 Experienced"; }
else if ( $tp < 52428800000 ) { return "#11 Highly Experienced"; }
else if ( $tp < 209715200000 ) { return "#12 Honoured"; }
else if ( $tp < 838860800000 ) { return "#13 Highly Hounoured"; }
else if ( $tp < 3355443200000 ) { return "#14 Respect King"; }
else if ( $tp < 6655886400000 ) { return "#15 True Champion"; }
}

 

Now i want this so the only thing that effect your rank is your level - how sould the code look

im guessing summit like

 


function get_rank($stat, $mykey)
{
global $ir,$userid,$c;
$q=mysql_query("SELECT count(*) FROM userstats us LEFT JOIN users u ON us.userid=u.userid WHERE us.$mykey > $stat AND us.userid != $userid AND u.user_level != 0", $c) ;
return mysql_result($q,0,0)+1;
}
function get_gamerank($level)
{
$tp=($level);
if ( $tp < 5 ) { return "#1 First Newbie"; }
else if ( $tp < 10 ) { return "#2 Newbie"; }
else if ( $tp < 15 ) { return "#3 Beginner"; }
else if ( $tp < 6400000 ) { return "#4 Not Experienced"; }
else if ( $tp < 25600000 ) { return "#5 Rookie"; }
else if ( $tp < 102400000 ) { return "#6 Average"; }
else if ( $tp < 409600000 ) { return "#7 Good"; }
else if ( $tp < 819200000 ) { return "#8 Very Good"; }
else if ( $tp < 3276800000 ) { return "#9 Greater Than Average"; }
else if ( $tp < 13107200000 ) { return "#10 Experienced"; }
else if ( $tp < 52428800000 ) { return "#11 Highly Experienced"; }
else if ( $tp < 209715200000 ) { return "#12 Honoured"; }
else if ( $tp < 838860800000 ) { return "#13 Highly Hounoured"; }
else if ( $tp < 3355443200000 ) { return "#14 Respect King"; }
else if ( $tp < 6655886400000 ) { return "#15 True Champion"; }
}

but change the values as they are a lil high to reach level wise.

  • 2 weeks later...
Posted

Re: Game Ranks Mod

 

//
//  Get Game Rank
//  @Purpose - Get the rank name of the user from their level
//  @Pram - integer
//  @Return - string
//
get_game_rank($level) {

   // You will need to finish this array with the additional ranks. :)
   $ranks = array("#1 First Newbie","#2 First Newbie","#3 Beginner","#4 Not Experienced","#5 Rookie",); 

   // If the users level is more than is in the array return the string.
   // or it will return the rank as normal.
   return ($level > count($ranks)) ? "#99 WINNER" : $ranks[$level];

}

 

I commented it to give some help :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...