• 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 Top Quests Gesior 2012

Kahras

Member
Joined
Aug 6, 2012
Messages
101
Reaction score
7
Location
Warsaw
Hi, I'm trying to convert this script to Gesior 2012:

PHP:
<?PHP

$cache_sec = 50;
$q = array(6132,0 => 12900,1 => 12424,2 => 11117,3 => 9000,4 => 8560,5 => 62201,6 => 5159,7 => 5116,8 => 2196,9 => 7697,10 => 90241,11 => 91141,12 => 90231,13 => 91631,14 => 8266,15 => 8865,16 => 8872,17 => 6433,18 => 2297,19 => 78846,20 => 62203,21 => 10122,22 => 10553,23 => 5147,24 => 91131,25 => 91431,26 => 56282,27 => 2493,28 => 56281,29 => 90232,30 => 6132,31 => 5737,32 => 5739,33); // list of quests, number => storage-id,


    $main_content .= '
    <table border="0" cellpadding="4" cellspacing="1" width="100%">
        <tr align="center" style="height: 28px; background-image: url(\'http://www.evo24.boo.pl/cantebia/images/news/newsheadline_background.png\');">
            <td colspan="4" style="text-align: center; font-weight: bold;"><strong><font color="white">Top 30 Questmakers on '.$config['server']['serverName'].'</font></strong></td>
        </tr>';
    
    $i = 1;
    foreach($q as $k => $id)
        $s .= $id.(isset($q[$k+1])?', ':'');
    
    $p = $SQL->query('SELECT player_id, count(*) as c FROM player_storage WHERE `key` IN ('.$s.') AND value=1 GROUP BY player_id ORDER BY COUNT(*) DESC LIMIT 0, 30');
    if(mysql_num_rows($p) != 0)
    {
        while($pl = mysql_fetch_array($p))
        {
            $a = $SQL->query('SELECT name FROM players WHERE id='.$pl['player_id'].' AND group_id < 4');
            if(mysql_num_rows($a) != 0)
            {
                $a = mysql_fetch_array($a);
                $main_content .= '
                <tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']) . '" class="'.(is_int($i/2)?'Even':'Odd').'" width="30px">
                    <td align="center"  width="5%"><b>'.$i.'.</b></td>
                    <td><a href="?subtopic=characters&amp;name='.htmlspecialchars($a['name']).'">'.$a['name'].'</a></td>
                    <td width="45%">
                        <img src="http://2.imgland.net/isEkI1U.png" style="width: '.round((($pl['c']*200)/count($q)), 0).'px; height: 9px; padding: 0px; border: 0px; margin: 0px;">

                        &nbsp;
                    </td>
                    <td align="center">
                        <b>'.$pl['c'].'/33</b>
                    </td>
                </tr>';

            }
            $i++;
        }
    }
    else
        $main_content .= '<tr class="Even"><td>No one has done any quest.</td></tr>';
    
    $main_content .= '</table>';
?>

i have problem with mysql_fetch_array

Fatal error: Uncaught Error: Call to undefined function mysql_num_rows() in C:\xampp1\htdocs\pages\quest.php:18 Stack trace: #0 C:\xampp1\htdocs\system\load.page.php(7): include() #1 C:\xampp1\htdocs\index.php(37): include_once('C:\\xampp1\\htdoc...') #2 {main} thrown in C:\xampp1\htdocs\pages\quest.php on line 18

Anyone know how to fix it?
 
Something like this - not tested:
PHP:
<?php

$cache_sec = 50;
$q = array(6132,0 => 12900,1 => 12424,2 => 11117,3 => 9000,4 => 8560,5 => 62201,6 => 5159,7 => 5116,8 => 2196,9 => 7697,10 => 90241,11 => 91141,12 => 90231,13 => 91631,14 => 8266,15 => 8865,16 => 8872,17 => 6433,18 => 2297,19 => 78846,20 => 62203,21 => 10122,22 => 10553,23 => 5147,24 => 91131,25 => 91431,26 => 56282,27 => 2493,28 => 56281,29 => 90232,30 => 6132,31 => 5737,32 => 5739,33); // list of quests, number => storage-id,


    $main_content .= '
    <table border="0" cellpadding="4" cellspacing="1" width="100%">
        <tr align="center" style="height: 28px; background-image: url(\'http://www.evo24.boo.pl/cantebia/images/news/newsheadline_background.png\');">
            <td colspan="4" style="text-align: center; font-weight: bold;"><strong><font color="white">Top 30 Questmakers on '.$config['server']['serverName'].'</font></strong></td>
        </tr>';
    
    $i = 1;
    foreach($q as $k => $id)
        $s .= $id.(isset($q[$k+1])?', ':'');
    
    $p = $SQL->query('SELECT player_id, count(*) as c FROM player_storage WHERE `key` IN ('.$s.') AND value=1 GROUP BY player_id ORDER BY COUNT(*) DESC LIMIT 0, 30')->fetchAll();
    if(count($p) > 0)
    {
        foreach($p as $pl)
        {
            $a = $SQL->query('SELECT name FROM players WHERE id='.$pl['player_id'].' AND group_id < 4')->fetch();
            if($a !== false)
            {
                $main_content .= '
                <tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']) . '" class="'.(is_int($i/2)?'Even':'Odd').'" width="30px">
                    <td align="center"  width="5%"><b>'.$i.'.</b></td>
                    <td><a href="?subtopic=characters&amp;name='.htmlspecialchars($a['name']).'">'.$a['name'].'</a></td>
                    <td width="45%">
                        <img src="http://2.imgland.net/isEkI1U.png" style="width: '.round((($pl['c']*200)/count($q)), 0).'px; height: 9px; padding: 0px; border: 0px; margin: 0px;">

                        &nbsp;
                    </td>
                    <td align="center">
                        <b>'.$pl['c'].'/33</b>
                    </td>
                </tr>';

            }
            $i++;
        }
    }
    else
        $main_content .= '<tr class="Even"><td>No one has done any quest.</td></tr>';
    
    $main_content .= '</table>';
 
Something like this - not tested:
PHP:
<?php

$cache_sec = 50;
$q = array(6132,0 => 12900,1 => 12424,2 => 11117,3 => 9000,4 => 8560,5 => 62201,6 => 5159,7 => 5116,8 => 2196,9 => 7697,10 => 90241,11 => 91141,12 => 90231,13 => 91631,14 => 8266,15 => 8865,16 => 8872,17 => 6433,18 => 2297,19 => 78846,20 => 62203,21 => 10122,22 => 10553,23 => 5147,24 => 91131,25 => 91431,26 => 56282,27 => 2493,28 => 56281,29 => 90232,30 => 6132,31 => 5737,32 => 5739,33); // list of quests, number => storage-id,


    $main_content .= '
    <table border="0" cellpadding="4" cellspacing="1" width="100%">
        <tr align="center" style="height: 28px; background-image: url(\'http://www.evo24.boo.pl/cantebia/images/news/newsheadline_background.png\');">
            <td colspan="4" style="text-align: center; font-weight: bold;"><strong><font color="white">Top 30 Questmakers on '.$config['server']['serverName'].'</font></strong></td>
        </tr>';
   
    $i = 1;
    foreach($q as $k => $id)
        $s .= $id.(isset($q[$k+1])?', ':'');
   
    $p = $SQL->query('SELECT player_id, count(*) as c FROM player_storage WHERE `key` IN ('.$s.') AND value=1 GROUP BY player_id ORDER BY COUNT(*) DESC LIMIT 0, 30')->fetchAll();
    if(count($p) > 0)
    {
        foreach($p as $pl)
        {
            $a = $SQL->query('SELECT name FROM players WHERE id='.$pl['player_id'].' AND group_id < 4')->fetch();
            if($a !== false)
            {
                $main_content .= '
                <tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']) . '" class="'.(is_int($i/2)?'Even':'Odd').'" width="30px">
                    <td align="center"  width="5%"><b>'.$i.'.</b></td>
                    <td><a href="?subtopic=characters&amp;name='.htmlspecialchars($a['name']).'">'.$a['name'].'</a></td>
                    <td width="45%">
                        <img src="http://2.imgland.net/isEkI1U.png" style="width: '.round((($pl['c']*200)/count($q)), 0).'px; height: 9px; padding: 0px; border: 0px; margin: 0px;">

                        &nbsp;
                    </td>
                    <td align="center">
                        <b>'.$pl['c'].'/33</b>
                    </td>
                </tr>';

            }
            $i++;
        }
    }
    else
        $main_content .= '<tr class="Even"><td>No one has done any quest.</td></tr>';
   
    $main_content .= '</table>';
thank you !!!
 
Back
Top