• 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!

[Modernaac] Help with highscores

Mjmackan

Mapper ~ Writer
Joined
Jul 18, 2009
Messages
1,488
Solutions
18
Reaction score
199
Location
Sweden
Hello i am looking for someone that could make an pretty easy change to the highscore file in modernaac.
The only thing i am looking for is highscore with reborns, the reborn storage is 1021 and the one with highest reborn/storage should definitely be highest at highscores.

Rep for help is obvious!
 
Sorry for not posting it in first post, however thanks!

\system\application\models\highscore_model.php
LUA:
<?php 
class Highscore_model extends Model {
	
	function getSkill($skillid, $worldid, $limit = 0, $offset = 0) {
		global $config;
		$this->load->database();
		
		$binds = array($worldid, $config['players_group_id_block']);
		if(is_numeric($skillid) && in_array($skillid, array(1,2,3,4,5,6,7))) {
			$query = 'SELECT p.name, p.online, s.value, p.level, p.vocation, p.promotion 
				  	  FROM players p
				  	  INNER JOIN player_skills s on (s.player_id = p.id)
				  	  WHERE p.world_id = ? AND p.deleted = 0 AND p.group_id < ? AND s.skillid = ?
					  ORDER BY s.value DESC';
			$binds[] = (int) ( $skillid - 1 );
		}else {
			$skillid = in_array($skillid, array('level', 'magic')) ? $skillid : 'level';
			switch($skillid) {
				case 'magic':
					$query = 'SELECT name, online, maglevel, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY maglevel DESC, manaspent DESC';
				break;
				case 'level':
				default:
					$query = 'SELECT name, online, level, experience, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY experience DESC';
			}			
		}
		
		$total = $this->db->query($query, $binds);
								   
		if($limit > 0 && is_numeric($limit) && !$offset)
			$query .= " LIMIT ".$limit;
		
		if($limit >= 0 and $offset > 0 and is_numeric($offset))
			$query .= " LIMIT ".$limit.",".$offset;
			
		$data = $this->db->query($query, $binds);

		return array('skill' => $skillid, 'data' => $data->result_array(), 'total' => $total->num_rows);
	}		
}
?>

\system\application\views\highscores.php
LUA:
<?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', 8, true)." value='level'>Experience</option>";
	echo "<option class='skill' ".set_select('skill', 7)." value='magic'>Magic Level</option>";
	echo "<option class='skill' ".set_select('skill', 0)." value='1'>Fist fighting</option>";
	echo "<option class='skill' ".set_select('skill', 1)." value='2'>Club fighting</option>";
	echo "<option class='skill' ".set_select('skill', 2)." value='3'>Sword fighting</option>";
	echo "<option class='skill' ".set_select('skill', 3)." value='4'>Axe fighting</option>";
	echo "<option class='skill' ".set_select('skill', 4)." value='5'>Distance fighting</option>";
	echo "<option class='skill' ".set_select('skill', 5)." value='6'>Shielding</option>";
	echo "<option class='skill' ".set_select('skill', 6)." value='7'>Fishing</option>";
	echo "</select>";
	echo " <input type='submit' value='View Skill'>";

	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();
 
tell me if these work for you

highscore_model.php
Code:
<?php 
class Highscore_model extends Model {
 
	function getSkill($skillid, $worldid, $limit = 0, $offset = 0) {
		global $config;
		$this->load->database();
 
		$binds = array($worldid, $config['players_group_id_block']);
		if(is_numeric($skillid) && in_array($skillid, array(1,2,3,4,5,6,7))) {
			$query = 'SELECT p.name, p.online, s.value, p.level, p.vocation, p.promotion 
				  	  FROM players p
				  	  INNER JOIN player_skills s on (s.player_id = p.id)
				  	  WHERE p.world_id = ? AND p.deleted = 0 AND p.group_id < ? AND s.skillid = ?
					  ORDER BY s.value DESC';
			$binds[] = (int) ( $skillid - 1 );
		}else {
			$skillid = in_array($skillid, array('level', 'magic', 'reborn')) ? $skillid : 'level';
			switch($skillid) {
				case 'magic':
					$query = 'SELECT name, online, maglevel, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY maglevel DESC, manaspent DESC';
				break;
				case 'level':
				default:
					$query = 'SELECT name, online, level, experience, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY experience DESC';
				case 'reborn':
				default:
					$query = 'SELECT p.name AS name, p.online AS online, value 
						FROM player_storage
						LEFT JOIN players p ON player_storage.player_id = p.id
						WHERE player_storage.key = 1021
							AND p.world_id = ? 
							AND p.deleted = 0 
							AND p.group_id < ? 
							AND p.name != "Account Manager"
						ORDER BY value DESC';						  						  
			}			
		}
 
		$total = $this->db->query($query, $binds);
 
		if($limit > 0 && is_numeric($limit) && !$offset)
			$query .= " LIMIT ".$limit;
 
		if($limit >= 0 and $offset > 0 and is_numeric($offset))
			$query .= " LIMIT ".$limit.",".$offset;
 
		$data = $this->db->query($query, $binds);
 
		return array('skill' => $skillid, 'data' => $data->result_array(), 'total' => $total->num_rows);
	}		
}
?>

highscores.php
Code:
<?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', 8, true)." value='level'>Experience</option>";
    echo "<option class='skill' ".set_select('skill', 7)." value='magic'>Magic Level</option>";
    echo "<option class='skill' ".set_select('skill', 0)." value='1'>Fist fighting</option>";
    echo "<option class='skill' ".set_select('skill', 1)." value='2'>Club fighting</option>";
    echo "<option class='skill' ".set_select('skill', 2)." value='3'>Sword fighting</option>";
    echo "<option class='skill' ".set_select('skill', 3)." value='4'>Axe fighting</option>";
    echo "<option class='skill' ".set_select('skill', 4)." value='5'>Distance fighting</option>";
    echo "<option class='skill' ".set_select('skill', 5)." value='6'>Shielding</option>";
    echo "<option class='skill' ".set_select('skill', 6)." value='7'>Fishing</option>";
    echo "<option class='skill' ".set_select('skill', 9)." value='reborn'>Reborn</option>";
    echo "</select>";
    echo " <input type='submit' value='View Skill'>";
 
    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;
            case 'reborn':
            echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='5%'><center><b>Score</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['value'] .'</td></tr>';
                $i++;    
            }
            break;                        
        }    
    }
    echo "</table>";
    echo $this->pagination->create_links();
 
Get these errors when i enter experience: (Edit: Otherwise it works just fine)
PHP:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: experience

Filename: views/highscores.php

Line Number: 55

A PHP Error was encountered

Severity: Notice

Message: Undefined index: level

Filename: views/highscores.php

Line Number: 55

If you are going to continue to trying to fix this for me i would like to have reborns at same line as levels shows but the one with most reborns are at the top of the list. If its to hard to fix that could you maybe make so reborns are the first one showing up instead of levels?
Thanks in advance, i really appreciate it.
 
highscores.php
Code:
<?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)." value='level'>Experience</option>";
    echo "<option class='skill' ".set_select('skill', 2)." value='magic'>Magic Level</option>";
    echo "<option class='skill' ".set_select('skill', 3)." value='1'>Fist fighting</option>";
    echo "<option class='skill' ".set_select('skill', 4)." value='2'>Club fighting</option>";
    echo "<option class='skill' ".set_select('skill', 5)." value='3'>Sword fighting</option>";
    echo "<option class='skill' ".set_select('skill', 6)." value='4'>Axe fighting</option>";
    echo "<option class='skill' ".set_select('skill', 7)." value='5'>Distance fighting</option>";
    echo "<option class='skill' ".set_select('skill', 8)." value='6'>Shielding</option>";
    echo "<option class='skill' ".set_select('skill', 9)." value='7'>Fishing</option>";
    echo "<option class='skill' ".set_select('skill', 10, true)." value='reborn'>Reborn</option>";
    echo "</select>";
    echo " <input type='submit' value='View Skill'>";
 
    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;
            case 'reborn':
            echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='5%'><center><b>Score</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['value'] .'</td></tr>';
                $i++;    
            }
            break;                        
        }    
    }
    echo "</table>";
    echo $this->pagination->create_links();
 
highscores.php
Code:
<?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>**";
        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 "**<b>Rank of</b>**";
    echo "<select name='skill'>";
    echo "<option class='skill' ".set_select('skill', 1)." value='level'>Experience</option>";
    echo "<option class='skill' ".set_select('skill', 2)." value='magic'>Magic Level</option>";
    echo "<option class='skill' ".set_select('skill', 3)." value='1'>Fist fighting</option>";
    echo "<option class='skill' ".set_select('skill', 4)." value='2'>Club fighting</option>";
    echo "<option class='skill' ".set_select('skill', 5)." value='3'>Sword fighting</option>";
    echo "<option class='skill' ".set_select('skill', 6)." value='4'>Axe fighting</option>";
    echo "<option class='skill' ".set_select('skill', 7)." value='5'>Distance fighting</option>";
    echo "<option class='skill' ".set_select('skill', 8)." value='6'>Shielding</option>";
    echo "<option class='skill' ".set_select('skill', 9)." value='7'>Fishing</option>";
    echo "<option class='skill' ".set_select('skill', 10, true)." value='reborn'>Reborn</option>";
    echo "</select>";
    echo " <input type='submit' value='View Skill'>";
 
    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;
            case 'reborn':
            echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='5%'><center><b>Score</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['value'] .'</td></tr>';
                $i++;    
            }
            break;                        
        }    
    }
    echo "</table>";
    echo $this->pagination->create_links();
Now it shows reborns highscore when you click at highscores but its doesn't show how many reborns and i still got same php errors as before.
 
break ;_;

highscore_model.php
Code:
<?php 
class Highscore_model extends Model {
 
	function getSkill($skillid, $worldid, $limit = 0, $offset = 0) {
		global $config;
		$this->load->database();
 
		$binds = array($worldid, $config['players_group_id_block']);
		if(is_numeric($skillid) && in_array($skillid, array(1,2,3,4,5,6,7))) {
			$query = 'SELECT p.name, p.online, s.value, p.level, p.vocation, p.promotion 
				  	  FROM players p
				  	  INNER JOIN player_skills s on (s.player_id = p.id)
				  	  WHERE p.world_id = ? AND p.deleted = 0 AND p.group_id < ? AND s.skillid = ?
					  ORDER BY s.value DESC';
			$binds[] = (int) ( $skillid - 1 );
		}else {
			$skillid = in_array($skillid, array('level', 'magic', 'reborn')) ? $skillid : 'reborn';
			switch($skillid) {
				case 'magic':
					$query = 'SELECT name, online, maglevel, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY maglevel DESC, manaspent DESC';
				break;
				case 'level':
				default:
					$query = 'SELECT name, online, level, experience, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY experience DESC';
				break;
				case 'reborn':
				default:
					$query = 'SELECT p.name AS name, p.online AS online, value 
						FROM player_storage
						LEFT JOIN players p ON player_storage.player_id = p.id
						WHERE player_storage.key = 1021
							AND p.world_id = ? 
							AND p.deleted = 0 
							AND p.group_id < ? 
							AND p.name != "Account Manager"
						ORDER BY value DESC';						  						  
				break;
			}			
		}
 
		$total = $this->db->query($query, $binds);
 
		if($limit > 0 && is_numeric($limit) && !$offset)
			$query .= " LIMIT ".$limit;
 
		if($limit >= 0 and $offset > 0 and is_numeric($offset))
			$query .= " LIMIT ".$limit.",".$offset;
 
		$data = $this->db->query($query, $binds);
 
		return array('skill' => $skillid, 'data' => $data->result_array(), 'total' => $total->num_rows);
	}		
}
?>
isnt storage = 1021 ?
 
break ;_;

highscore_model.php
Code:
<?php 
class Highscore_model extends Model {
 
	function getSkill($skillid, $worldid, $limit = 0, $offset = 0) {
		global $config;
		$this->load->database();
 
		$binds = array($worldid, $config['players_group_id_block']);
		if(is_numeric($skillid) && in_array($skillid, array(1,2,3,4,5,6,7))) {
			$query = 'SELECT p.name, p.online, s.value, p.level, p.vocation, p.promotion 
				  	  FROM players p
				  	  INNER JOIN player_skills s on (s.player_id = p.id)
				  	  WHERE p.world_id = ? AND p.deleted = 0 AND p.group_id < ? AND s.skillid = ?
					  ORDER BY s.value DESC';
			$binds[] = (int) ( $skillid - 1 );
		}else {
			$skillid = in_array($skillid, array('level', 'magic', 'reborn')) ? $skillid : 'reborn';
			switch($skillid) {
				case 'magic':
					$query = 'SELECT name, online, maglevel, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY maglevel DESC, manaspent DESC';
				break;
				case 'level':
				default:
					$query = 'SELECT name, online, level, experience, vocation, promotion, world_id
					  	  FROM players
					  	  WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
						  ORDER BY experience DESC';
				break;
				case 'reborn':
				default:
					$query = 'SELECT p.name AS name, p.online AS online, value 
						FROM player_storage
						LEFT JOIN players p ON player_storage.player_id = p.id
						WHERE player_storage.key = 1021
							AND p.world_id = ? 
							AND p.deleted = 0 
							AND p.group_id < ? 
							AND p.name != "Account Manager"
						ORDER BY value DESC';						  						  
				break;
			}			
		}
 
		$total = $this->db->query($query, $binds);
 
		if($limit > 0 && is_numeric($limit) && !$offset)
			$query .= " LIMIT ".$limit;
 
		if($limit >= 0 and $offset > 0 and is_numeric($offset))
			$query .= " LIMIT ".$limit.",".$offset;
 
		$data = $this->db->query($query, $binds);
 
		return array('skill' => $skillid, 'data' => $data->result_array(), 'total' => $total->num_rows);
	}		
}
?>
isnt storage = 1021 ?
Yes it is storage 1021 but it didn't show anything at all.
Now it works though do you think you could change so the level shows at the same line as reborn but the highest reborn should be at top not highest level, understand me? heh :)
 
you mean
LwuWi.png

;_; ?
 
highscores.php
Code:
<?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>**";
        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 "**<b>Rank of</b>**";
    echo "<select name='skill'>";
    echo "<option class='skill' ".set_select('skill', 1, true)." value='rebirth'>Rebirths</option>";
    echo "<option class='skill' ".set_select('skill', 2)." value='magic'>Magic Level</option>";
    echo "<option class='skill' ".set_select('skill', 3)." value='1'>Fist fighting</option>";
    echo "<option class='skill' ".set_select('skill', 4)." value='2'>Club fighting</option>";
    echo "<option class='skill' ".set_select('skill', 5)." value='3'>Sword fighting</option>";
    echo "<option class='skill' ".set_select('skill', 6)." value='4'>Axe fighting</option>";
    echo "<option class='skill' ".set_select('skill', 7)." value='5'>Distance fighting</option>";
    echo "<option class='skill' ".set_select('skill', 8)." value='6'>Shielding</option>";
    echo "<option class='skill' ".set_select('skill', 9)." value='7'>Fishing</option>";
    echo "</select>";
    echo " <input type='submit' value='View Skill'>";
 
    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 'rebirth':
            echo "<tr><td width='5%'><b><center>*</center></b></td><td width='40%'><center><b>Name</b></center></td><td width='10%'><center><b>Rebirths</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['value'] < 1 ? 'None' : $player['value']).'</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();

highscore_model.php
Code:
<?php 
class Highscore_model extends Model {
 
    function getSkill($skillid, $worldid, $limit = 0, $offset = 0) {
        global $config;
        $this->load->database();
        $binds = array($worldid, $config['players_group_id_block']);
        if(is_numeric($skillid) && in_array($skillid, array(1,2,3,4,5,6,7))) {
            $query = 'SELECT p.name, p.online, s.value, p.level, p.vocation, p.promotion 
                        FROM players p
                        INNER JOIN player_skills s on (s.player_id = p.id)
                        WHERE p.world_id = ? AND p.deleted = 0 AND p.group_id < ? AND s.skillid = ?
                      ORDER BY s.value DESC';
            $binds[] = (int) ( $skillid - 1 );
        }else {
            $skillid = in_array($skillid, array('rebirth', 'magic')) ? $skillid : 'rebirth';
            switch($skillid) {
                case 'rebirth':
                default:
                    $query = 'SELECT p.name, p.online, p.level, p.vocation, p.promotion, p.world_id, value
                        FROM player_storage
                        LEFT JOIN players p ON (player_storage.player_id = p.id)
                        WHERE player_storage.key = 1021
                            AND p.world_id = ? 
                            AND p.deleted = 0 
                            AND p.group_id < ? 
                            AND p.name != "Account Manager"
                        ORDER BY value DESC';                                                    
                break;        
                case 'magic':
                    $query = 'SELECT name, online, maglevel, vocation, promotion, world_id
                            FROM players
                            WHERE world_id = ? AND deleted = 0 AND group_id < ? AND name != "Account Manager"
                          ORDER BY maglevel DESC, manaspent DESC';
                break;
            }            
        }
 
        $total = $this->db->query($query, $binds);
 
        if($limit > 0 && is_numeric($limit) && !$offset)
            $query .= " LIMIT ".$limit;
 
        if($limit >= 0 and $offset > 0 and is_numeric($offset))
            $query .= " LIMIT ".$limit.",".$offset;
 
        $data = $this->db->query($query, $binds);
 
        return array('skill' => $skillid, 'data' => $data->result_array(), 'total' => $total->num_rows);
    }        
}
?>

add @ login.lua

LUA:
if getPlayerStorageValue(cid, 1021) < 0 then
   doPlayerSetStorageValue(cid, 1021, 0)
end
 
Last edited:
It only shows players which has reborned now, heh i want all players to be there even them without reborns.

Why should i use that in Login, have done it but it shouldn't make any difference?
 
It only shows players which has reborned now, heh i want all players to be there even them without reborns.

Why should i use that in Login, have done it but it shouldn't make any difference?
players that dont have the storage do not appear in the query

SQL:
SELECT p.name, p.online, p.level, p.vocation, p.promotion, p.world_id, value
FROM player_storage
LEFT JOIN players p ON (player_storage.player_id = p.id)
WHERE player_storage.key = 1021
    AND p.world_id = ? 
    AND p.deleted = 0 
    AND p.group_id < ? 
    AND p.name != "Account Manager"
ORDER BY value DESC

go
\system\application\controllers\character.php
find
PHP:
$SQL = POT::getInstance()->getDBHandle();
add below:
PHP:
$SQL->query("INSERT INTO player_storage (`player_id`, `key`, `value`) VALUES (".$player->getId().", 1021, 0);");

\system\application\controllers\account.php
find
PHP:
$SQL = POT::getInstance()->getDBHandle();
add below:
PHP:
$SQL->query("INSERT INTO player_storage (`player_id`, `key`, `value`) VALUES (".$player->getId().", 1021, 0);");

edit the login.lua, for already created players:

LUA:
if getPlayerStorageValue(cid, 1021) < 0 then
   doPlayerSetStorageValue(cid, 1021, 0)
end
in next serversave if they had logged in, they will appear at highscores
 
Last edited:
Can't you possible add storage 1021, 0 to the samples? or make so storage 4032, 1 = 0 reborns and add that storage (4032, 1) to samples?
 
I want the players shown already as they register.


Edit: Haha my fault, sorry for wasting your time. However rep'ed you yesterday, thanks!'


didn't read: edit the login.lua, for already created players:
 
Last edited:
Do this then
\system\application\controllers\character.php
find
PHP:
$SQL = POT::getInstance()->getDBHandle();
add below:
PHP:
$SQL->query("INSERT INTO player_storage (`player_id`, `key`, `value`) VALUES (".$player->getId().", 1021, 0);");

\system\application\controllers\account.php
find
PHP:
$SQL = POT::getInstance()->getDBHandle();
add below:
PHP:
$SQL->query("INSERT INTO player_storage (`player_id`, `key`, `value`) VALUES (".$player->getId().", 1021, 0);");

For already created players that do not appear in the highscores, try
login.lua
LUA:
if getPlayerStorageValue(cid, 1021) < 0 then
doPlayerSetStorageValue(cid, 1021, 0)
end
 
Back
Top