Jump to content

Leaderboard help


Recommended Posts

So I am working on my leader board and going nuts with adding different things so players can keep competitive. I have hit a stumbling as much as it looks good it still needs to work lol. So I have created my case tried to do a else if for it and yeah that's where it goes wrong with the correct order. 

switch (@$this->methodData->top10) {
                case 'rank': 
                    $order = 'US_exp'; 
                    $title = "Top 10 Players"; 
                    $order = '(US_money + US_bank)'; 
                    $title = "Top 10 Richest Players"; 
                case 'strength':
                    $order = 'US_strength';
                    $title = "Top 10 in Strength";
            $select = $this->db->selectAll("
                    INNER JOIN users ON (US_id = U_id) 
                    U_userLevel = 1 AND 
                    U_status != 0
                ORDER BY ".$order." DESC LIMIT 0, 10
            $i = 1;
            $users = array();
            foreach ($select as $row) {
                $u = new User($row['U_id']);

                if ($type == 'rank') {
                    $rank = $u->getRank()->R_name;
                } else if ($type == 'money') {
                    $rank = $u->getMoneyRank()->MR_desc;
                 else if ($type == 'strength') {
                    $rank = $u->getStrengthRank()->MR_desc;
                $users[] = array(
                    "number" => $i, 
                    "user" => $u->user, 
                    "id" => $row['U_id'], 
                    "rank" => $rank
            $this->html .= $this->page->buildElement('leaderboard', array(
                "title" => $title, 
                "users" => $users

So, my issue is at the for each where I get each rank position. For instance I know that getStrengthRank is incorrect so what would I use? 

Out of this, I thought "rank" => $rank would give me the stat on my tpl but shows up blank. How would I get it to work?

UPDATE: I worked out the issue I had with get strength so that part is all good. I'm still unsure what has happened to Rank

Fixed it!

Link to comment
Share on other sites

Join the conversation

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

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...