• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Modernacc] Highscore mlvl

Mjmackan

Mapper ~ Writer
Joined
Jul 18, 2009
Messages
1,488
Solutions
18
Reaction score
199
Location
Sweden
Someone that could give me an possible problem why this is happening? (Only magic level)


Also wonder how i could add vocation til the highscore board.

Reputation for help of course.


HTML:
<?php
require("config.php");
$ide = new IDE;
try {$ide->loadInjections("highscores");} catch(Exception $e) {error($e->getMessage()); }
echo form_open('highscores');
	$uri = $this->uri->segment(5) ? $this->uri->segment(5) : 0;

	if(count($config['worlds']) > 1) {
		echo "<b>World</b>&nbsp;&nbsp;";
		echo "<select name='world'>";
		foreach($config['worlds'] as $id=>$name) {
			if($_POST['world'] == $id)
			echo "<option selected='true' value='$id'>$name</option>";
			else
			echo "<option value='$id'>$name</option>";
		}
		echo "</select>";
	}
	
	echo "&nbsp;&nbsp;<b>Rank of</b>&nbsp;&nbsp;";
	echo "<select name='skill'>";
	echo "<option class='skill' ".set_select('skill', 1, true)." value='level'>Experience</option>";
	echo "<option class='skill' ".set_select('skill', 9)." value='magic'>Magic Level</option>";
	echo "<option class='skill' ".set_select('skill', 2)." value='1'>Fist fighting</option>";
	echo "<option class='skill' ".set_select('skill', 3)." value='2'>Club fighting</option>";
	echo "<option class='skill' ".set_select('skill', 4)." value='3'>Sword fighting</option>";
	echo "<option class='skill' ".set_select('skill', 5)." value='4'>Axe fighting</option>";
	echo "<option class='skill' ".set_select('skill', 6)." value='5'>Distance fighting</option>";
	echo "<option class='skill' ".set_select('skill', 7)." value='6'>Shielding</option>";
	echo "<option class='skill' ".set_select('skill', 8)." value='7'>Fishing</option>";
	echo "</select>";
	echo " <input type='submit' value='Show'>";

	echo "</form>";

	echo "<h2><center>Ranking of ". (is_numeric($type) ? $skills[$type] : $type) ." on ".$config['worlds'][$world]."</center></h2>";
	
	$i = 1 + $uri;
	echo "<table width='100%'>";
	if(is_numeric($type)) {
		
		echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='5%'><center><b>Skill</b></center></td></tr>";
		foreach($players as $player) {
			if(in_array($player['name'], $config['newchar_vocations'][0])) continue;
			echo '<tr><td width="5%" align="center">'.$i.'</center></td><td width="40%" align="center"><a href="'.WEBSITE.'/index.php/character/view/'.$player['name'].'" class="'. ($player['online'] ? 'green' : 'red') .'">'.$player['name'].'</a></td><td width="5%" align="center">'.$player['value'].'</td></tr>';
			$i++;
		}
	}else{
		switch($type) {
			case 'level':
			echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='10%'><center><b>Exp</b></center></td><td width='5%'><center><b>Level</b></center></td></tr>";
			foreach($players as $player) {
				if(in_array($player['name'], $config['newchar_vocations'][0])) continue;
				echo '<tr><td width="5%" align="center">'.$i.'</td><td width="40%" align="center"><a href="'.WEBSITE.'/index.php/character/view/'.$player['name'].'" class="'. ($player['online'] ? 'green' : 'red') .'">'.$player['name'].'</a></td><td width="10%" align="center">'.$player['experience'].'</td><td width="5%" align="center">'.$player['level'].'</td></tr>';
				$i++;
			}
			break;
			case 'magic':
			echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='5%'><center><b>Level</b></center></td></tr>";
			foreach($players as $player) {
				if(in_array($player['name'], $config['newchar_vocations'][0])) continue;
				echo '<tr><td width="5%" align="center">'.$i.'</td><td width="40%" align="center"><a href="'.WEBSITE.'/index.php/character/view/'.$player['name'].'" class="'. ($player['online'] ? 'green' : 'red') .'">'.$player['name'].'</a></td><td width="5%" align="center">'. $player['maglevel'] .'</td></tr>';
				$i++;	
			}
			break;
		}	
	}
	echo "</table>";
	echo $this->pagination->create_links();

HTML:
<?php
/*This controller will not use model for basic DB access for gathering information about stastitics, the database access will be made within thin controller!
There is no point of using model for such simple DB access.*/

class Highscores extends Controller {
	
	function __construct() {
    	parent::Controller();
    	$this->load->helper('url');
  	}
	
	public function index($world = 0, $skills = 'level', $page = 0) {
		global $config;
		$this->load->library('pagination');
		$this->load->helper("form");
		$this->load->model('highscore_model');
		
		$skills = isset($_POST['skill']) ? $_POST['skill'] : $skills;
		$world = isset($_POST['world']) ? $_POST['world'] : $world;

		$configs['base_url'] = WEBSITE.'/index.php/highscores/index/'.$world.'/'.$skills.'/';
		$configs['per_page'] = $config['highscore']['per_page'];
		$configs['full_tag_open'] = '<p>';
		$configs['full_tag_close'] = '</p>';
		$configs['uri_segment'] = 5;
		
		$skill = $this->highscore_model->getSkill($skills, $world, $page, $configs['per_page']);
		
		$data['type'] = $skill['skill'];
		$data['world'] = $world;
		$data['skills'] = array('None', 'Fist Fighting', 'Club Fighting', 'Sword Fighting', 'Axe Fighting', 'Distance Fighting', 'Shielding', 'Fishing');
		
		$data['players'] = $skill['data'];
		
		$configs['total_rows'] = $skill['total'] > $config['highscore']['total'] ? $config['highscore']['total'] : $skill['total'];
		
		$this->pagination->initialize($configs); 
		$this->load->view("highscores", $data);
	}
}

Also wonder how i could add vocation til the highscore board.

Reputation for help of course.
 
Last edited:
Back
Top