Canjucks Posted April 25, 2021 Share Posted April 25, 2021 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"; break; default: $order = '(US_money + US_bank)'; $title = "Top 10 Richest Players"; break; case 'strength': $order = 'US_strength'; $title = "Top 10 in Strength"; break; } $select = $this->db->selectAll(" SELECT * FROM userStats INNER JOIN users ON (US_id = U_id) WHERE 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 ); $i++; } $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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.