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

[Gesior AAC] Top Guilds.

Kekox

Well-Known Member
Joined
Apr 4, 2009
Messages
1,264
Reaction score
60
Location
Venezuela
Well this script is based on elf's code, you can see here: http://otland.net/f118/0-3-6-0-4-top-fragers-top-guilds-one-database-query-68893/

I made it as a complete section to gesior aac.
If you are going to use it, please respect credits.

Here an example: Link
topguilds.php
PHP:
<?PHP
    $main_content .= '<div style="text-align: center; font-weight: bold;"><h2>Top 15 guilds on ' . $config['server']['serverName'] . '</h2></div>
<center><table border="0" cellspacing="1" cellpadding="4" width="80%">
    <tr bgcolor="'.$config['site']['vdarkborder'].'">
        <td width="10%"><b><font color=white><center>Pos</font></center></b></td>
        <td width="20%"><b><font color=white><center>Logo</center></b></font></td>
        <td width="30%"><b><font color=white><center>Guild Name</center></b></font></td>
        <td width="20%"><b><font color=white><center>Kills</center></b></font></td>
    </tr>';
$i = 0;
foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
    `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
    FROM `killers` k
    LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
    LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
    LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
    LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
   WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
    GROUP BY `name`
    ORDER BY `frags` DESC, `name` ASC
    LIMIT 0, 15;') as $guild)
{
    $i++;
    $main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']). '">
        <td>            
            <center>'.$i.'</center>
        </td>
        <td>            
            <center><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/></center>
        </td>
        <td>
            <center><a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '">' . $guild['name'] . '</a></center>
        </td>
        <td>
            <center>' . $guild['frags'] . ' kills</center>
        </td>
    </tr>';
}
$main_content .= '</table><br />';
$main_content .= '<div style="text-align: right; font-size: 10;">Based on <a href=http://otland.net/members/elf>Elf\'s</a> code. System  made by <a href=http://otland.net/members/kekox>Kekox.</a></div>';
?>
 
Last edited by a moderator:
o_O

How it works? For eg. One guild have 200 kills, but in this guild have 01 players, and he (alone) have 300 kills.. idk what happens!
 
The guild which has the player alone with 300 kills will be first because this guild have more kills.

@Heber
Thank you :) I made my own shop system, and addons for it.. its pretty cool. :)
 
Warning: Invalid argument supplied for foreach() in D:\xampp\htdocs\pages\topguild.php on line 21


Gesior 2012, Version: 1.0.1....
TFS 0.3.7 Crying Damson

Any ideas?


- - - Updated - - -

OPPS here's Line 21... Although its from the main posts script...
Code:
    LIMIT 0, 15;') as $guild)


But here is the WHOLE for function... Although its from the main posts script...
Code:
foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
    `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
    FROM `killers` k
    LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
    LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
    LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
    LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
   WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
    GROUP BY `name`
    ORDER BY `frags` DESC, `name` ASC
    LIMIT 0, 15;') as $guild)
 
Warning: Invalid argument supplied for foreach() in D:\xampp\htdocs\pages\topguild.php on line 21


Gesior 2012, Version: 1.0.1....
TFS 0.3.7 Crying Damson

Any ideas?


- - - Updated - - -

OPPS here's Line 21... Although its from the main posts script...
Code:
    LIMIT 0, 15;') as $guild)


But here is the WHOLE for function... Although its from the main posts script...
Code:
foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
    `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
    FROM `killers` k
    LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
    LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
    LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
    LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
   WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
    GROUP BY `name`
    ORDER BY `frags` DESC, `name` ASC
    LIMIT 0, 15;') as $guild)


I have the same problem... what's wrong?
 
Warning: Invalid argument supplied for foreach() in D:\xampp\htdocs\pages\topguild.php on line 21

Gesior 2012, Version: 1.0.1....
TFS 0.3.7 Crying Damson

Any ideas?


- - - Updated - - -

OPPS here's Line 21... Although its from the main posts script...
Code:
    LIMIT 0, 15;') as $guild)


But here is the WHOLE for function... Although its from the main posts script...
Code:
foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
    `g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
    FROM `killers` k
    LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
    LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
    LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
    LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
   WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
    GROUP BY `name`
    ORDER BY `frags` DESC, `name` ASC
    LIMIT 0, 15;') as $guild)


Bumping this since I have the same problem. I got the error at the bottom:
Code:
Warning: Invalid argument supplied for foreach() in D:\xampp\htdocs\pages\topguild.php on line 21


Does anyone know the solution for it? It would really be appreciated!
 

Similar threads

Back
Top