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

[0.3.6-0.4] Top fragers and top guilds with one database query

Nice!
Works great for me, but I have one thing.
Could someone make a script so members of the best guild would have special outfit? When ever their guild is on the top they would be able to wear the special outfit.
I'm sure that many people would need it and you would get some reputation for it :D
 
Warning: include(frags.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\index.php on line 262

Warning: include() [function.include]: Failed opening 'frags.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\index.php on line 262

how do i fix it?
Looks like you dont have the frags.php file.. maybe you have it miss spelled?
 
Dude, when I removed Frags (RED) with an Skull. All Frags removed too from Guilds and Top Frags.

Its possible to repair it?
 
Its obvious when I see guys posting such shit, or selling worse one like AndersPro does.
Here are light, not requiring any extra events nor database fields Gesior AAC modules.

frags.php
Code:
<?php
$main_content .= '<div style="text-align: center; font-weight: bold;">Top 30 frags on ' . $config['server']['serverName'] . '</div>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
	<tr bgcolor="' . $config['site']['vdarkborder'] . '">
		<td class="white" style="text-align: center; font-weight: bold;">Name</td>
		<td class="white" style="text-align: center; font-weight: bold;">Frags</td>
	</tr>';

$i = 0;
foreach($SQL->query('SELECT `p`.`name` AS `name`, COUNT(`p`.`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`
WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
	GROUP BY `name`
	ORDER BY `frags` DESC, `name` ASC
	LIMIT 0,30;') as $player)
{
	$i++;
	$main_content .= '<tr bgcolor="' . (is_int($i / 2) ? $config['site']['lightborder'] : $config['site']['darkborder']) . '">
		<td><a rel="nofollow" href="?subtopic=characters&amp;name=' . urlencode($player['name']) . '">' . $player['name'] . '</a></td>
		<td style="text-align: center;">' . $player['frags'] . '</td>
	</tr>';
}

$main_content .= '</table>';
?>

and top guilds, which you should place in latestnews.php- anywhere you wish:
Code:
$main_content .= '<div class="NewsHeadline">
	<div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
		<table border="0">
			<tr>
				<td style="text-align: center; font-weight: bold;">
					<font color="white">Most powerfull guilds</font>
				</td>
			</tr>
		</table>
	</div>
</div>
<table border="0" cellspacing="3" cellpadding="4" width="100%">
	<tr>';

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, 4;') as $guild)
	$main_content .= '		<td style="width: 25%; text-align: center;">
			<a rel="nofollow" href="?subtopic=guilds&amp;action=show&amp;guild=' . $guild['id'] . '"><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/><br />' . $guild['name'] . '</a><br />' . $guild['frags'] . ' kills
		</td>';

$main_content .= '	</tr>
</table>';


Demo of guilds: WypasOTS ? News.
Have fun.

Could anyknow help me to edit this script from top 5 players to top 5 guilds for me. With the script elf created? :)

<div class="header">Support List</div>
<?php
$TopPlayers = $SQL->query("SELECT `name`, `experience`, `level` FROM `players` ORDER BY `experience` DESC LIMIT 5")->fetchAll();
$Counter = 1;
?>
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<?php foreach($TopPlayers as $Player): ?>
<tr>
<td width="10%"><?php echo $Counter; $Counter++; ?>.</td>
<td><a href="index.php?subtopic=characters&amp;name=<?php echo urlencode($Player['name']); ?>"><?php echo $Player['name']; ?></a></td>
<td align="right" width="25%"><?php echo $Player['level']; ?> level</td>
</tr>
<?php endforeach; ?>
</table>
</div>
 
when i click on a guild i get this:

The Following Errors Have Occurred:

Invalid guild name format.
 
don't work for me :/

Code:
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\latestnews.php on line 30
 
I know this is a old thread, but i need a working "Most Powerfull Guilds"
I tried this one. but it just shows the bar with "Most Powerfull Guilds" It doesn't show any guild on it.
On my server there is currently 1 Guild with fraggs.
Is it supposed to be 3 guild and then it will show in page?

I use the required TFS 0.4
I use uniform server.
and i use gesior 2012 for tfs 0.4
(i'm not asking help for >>TFS 0.4<< Im asking help with gesior most powerfull guilds)

Hope someone can helpe me with this script.
 
It's anyway to pass this to Znote AAC? Would be great , i am pretty sure more people really need this
 
It's anyway to pass this to Znote AAC? Would be great , i am pretty sure more people really need this
No prob, elf got some awesome queries there. :)

(each script is an own page, just modify it if you want to have it on your news section etc).

Top fraggers:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';

	// Cache the results
	$cache = new Cache('engine/cache/topMurders');
	if ($cache->hasExpired()) {
		$killers = mysql_select_multi("SELECT `p`.`name` AS `name`, COUNT(`p`.`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` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0,30;");
		
		$cache->setContent($killers);
		$cache->save();
	} else {
		$killers = $cache->load();
	}

if (!empty($killers) || $killers !== false) {
?>

<table id="onlinelistTable" class="table table-striped table-hover">
	<tr class="yellow">
		<th>Name:</th>
		<th>Frags:</th>
	</tr>
	<?php foreach ($killers as $killer) { ?>
	<tr>
		<td><?php echo $killer['name']; ?></td>
		<td><?php echo $killer['frags']; ?></td>
	</tr>
	<?php } ?>
</table>

<?php
} else echo '<h1>No frags yet.</h1>';
 include 'layout/overall/footer.php'; ?>

Top guilds:
PHP:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; 

    // Cache the results 
    $cache = new Cache('engine/cache/topGuilds'); 
    if ($cache->hasExpired()) { 
        $guilds = mysql_select_multi("SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, 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, 4;"); 
         
        $cache->setContent($guilds); 
        $cache->save(); 
    } else { 
        $guilds = $cache->load(); 
    } 

if (!empty($guilds) || $guilds !== false) { 
?> 

<table id="onlinelistTable" class="table table-striped table-hover"> 
    <tr class="yellow"> 
        <th>Name:</th> 
        <th>Frags:</th> 
    </tr> 
    <?php foreach ($guilds as $guild) { 

    $url = url("guilds.php?name=". $guild['name']);
    echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">'; ?> 
        <td><?php echo $guild['name']; ?></td>
        <td><?php echo $guild['frags']; ?></td> 
    </tr> 
    <?php } ?> 
</table> 

<?php 
} else echo '<h1>No frags yet.</h1>'; 
 include 'layout/overall/footer.php'; ?>
 
Last edited:
Back
Top