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

AAC how to add pages highscores

bpm91

Advanced OT User
Joined
May 23, 2019
Messages
1,046
Solutions
7
Reaction score
180
Location
Brazil
YouTube
caruniawikibr
I would like to know how to make it appear, for example, up to the top 300-
that can fit up to 50 people on each page, for example?
My code works for up to 100 people on a single page.
1724351311980.webp
1724351392984.webp

PHP:
<?php
/**
 * Highscores
 *
 * @package   MyAAC
 * @author    Gesior <[EMAIL][email protected][/EMAIL]>
 * @author    Slawkens <[EMAIL][email protected][/EMAIL]>
 * [USER=62815]@Copyright[/USER] 2019 MyAAC
 * [USER=70192]@link[/USER]      [URL='https://my-aac.org']MyAAC – MyAAC is website for your OTS (https://my-aac.org)[/URL]
 */
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Highscores';

if($config['account_country'] && $config['highscores_country_box'])
    require SYSTEM . 'countries.conf.php';

$list = isset($_GET['list']) ? $_GET['list'] : '';
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
$vocation = isset($_GET['vocation']) ? $_GET['vocation'] : NULL;

if(!is_numeric($_page) || $_page < 0 || $_page > PHP_INT_MAX) {
    $_page = 0;
}

$add_sql = '';
$config_vocations = $config['vocations'];
if($config['highscores_vocation_box'] && isset($vocation))
{
    foreach($config['vocations'] as $id => $name) {
        if(strtolower($name) == $vocation) {
            $add_vocs = array($id);

            $i = $id + $config['vocations_amount'];
            while(isset($config['vocations'][$i])) {
                $add_vocs[] = $i;
                $i += $config['vocations_amount'];
            }

            $add_sql = 'AND vocation IN (' . implode(', ', $add_vocs) . ')';
            break;
        }
    }
}

define('SKILL_FRAGS', -1);
define('SKILL_BALANCE', -2);

$skill = POT::SKILL__LEVEL;
if(is_numeric($list))
{
    $list = (int) $list;
    if($list >= POT::SKILL_FIRST && $list <= POT::SKILL__LAST)
        $skill = $list;
}
else
{
    switch($list)
    {
        case 'fist':
            $skill = POT::SKILL_FIST;
            break;

        case 'club':
            $skill = POT::SKILL_CLUB;
            break;

        case 'sword':
            $skill = POT::SKILL_SWORD;
            break;

        case 'axe':
            $skill = POT::SKILL_AXE;
            break;

        case 'distance':
            $skill = POT::SKILL_DIST;
            break;

        case 'shield':
            $skill = POT::SKILL_SHIELD;
            break;

        case 'fishing':
            $skill = POT::SKILL_FISH;
            break;

        case 'level':
        case 'experience':
            $skill = POT::SKILL_LEVEL;
            break;

        case 'magic':
            $skill = POT::SKILL__MAGLEVEL;
            break;

        case 'frags':
            if($config['highscores_frags'] && $config['otserv_version'] == TFS_03)
                $skill = SKILL_FRAGS;
            break;

        case 'balance':
            if($config['highscores_balance'])
                $skill = SKILL_BALANCE;
            break;
    }
}

$promotion = '';
if($db->hasColumn('players', 'promotion'))
    $promotion = ',promotion';

$online = '';
if($db->hasColumn('players', 'online'))
    $online = ',online';

$deleted = 'deleted';
if($db->hasColumn('players', 'deletion'))
    $deleted = 'deletion';

$outfit_addons = false;
$outfit = '';
if($config['highscores_outfit']) {
    $outfit = ', lookbody, lookfeet, lookhead, looklegs, looktype';
    if($db->hasColumn('players', 'lookaddons')) {
        $outfit .= ', lookaddons';
        $outfit_addons = false;
    }
}

$offset = $_page * $config['highscores_length'];
if($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
    if($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
        $skill_ids = array(
            POT::SKILL_FIST => 'skill_fist',
            POT::SKILL_CLUB => 'skill_club',
            POT::SKILL_SWORD => 'skill_sword',
            POT::SKILL_AXE => 'skill_axe',
            POT::SKILL_DIST => 'skill_dist',
            POT::SKILL_SHIELD => 'skill_shielding',
            POT::SKILL_FISH => 'skill_fishing',
        );

        $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
    }
    else
        $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . $outfit . ' FROM accounts,players,player_skills WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_skills.player_id AND player_skills.skillid = '.$skill.' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
}
else if($skill == SKILL_FRAGS && $config['otserv_version'] == TFS_03) // frags
{
    $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . $outfit . ',COUNT(player_killers.player_id) as value' .
            ' FROM accounts, players, player_killers ' .
            ' WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
            ' GROUP BY player_id' .
            ' ORDER BY value DESC' .
            ' LIMIT 101 OFFSET '.$offset)->fetchAll();
}
else if($skill == SKILL_BALANCE) // balance
{
    $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,balance as value,vocation' . $promotion . $outfit . ' FROM accounts,players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND accounts.id = players.account_id ORDER BY value DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
}
else
{
    if($skill == POT::SKILL__MAGLEVEL) {
        $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
    }
    else { // level
        $skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . $outfit . ' FROM accounts, players WHERE players.id NOT IN (' . implode(', ', $config['highscores_ids_hidden']) . ') AND players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset)->fetchAll();
        $list = 'experience';
    }
}
?>
 
The problem is that, for example, if I have 50 players, and choose 10, the first 10 appear but the next pages of the other 40 do not appear in a 10 format.
were you not talking about that you've bought many things / fixes, custom things and so on? recommending to get a programmer to get things in order, and that you were not able to share few fixes because you bought it? if im not wrong you were talking about a custom website made from scratch..... why are u asking for a solution here, if you've got something "unique" lol
if im not mistaken it's you the guy who asks for help and once you get it, you don't even share the solution. till someone remarks it to you.
Post automatically merged:

The problem is that, for example, if I have 50 players, and choose 10, the first 10 appear but the next pages of the other 40 do not appear in a 10 format.
get a programmer then.
 
Yes, I bought a website from scratch. I paid something around 800-900 usdt. because I trusted him, but unfortunately he gave me the incomplete website. Is this a problem for you? If you don't want to help, don't post. just that. I didn't know that I am obliged to account for the things I do here. I thought it was a doubt forum.
 
Back
Top