query("SELECT `code`,`name` FROM hlstats_Weapons WHERE game='$game'");
	while ($rowdata = $db->fetch_row($result)) 
	{ 
		$code = $rowdata[0];
		$fname[$code] = htmlspecialchars($rowdata[1]);
	}
	
	$tblWeapons = new Table(
		array(
			new TableColumn(
				'weapon',
				'Weapon',
				'width=15&type=weaponimg&align=center&link=' . urlencode("mode=weaponinfo&weapon=%k&game=$game"),
				$fname
			),
			new TableColumn(
				'modifier',
				'Points Modifier',
				'width=10&align=right'
			),
			new TableColumn(
				'kills',
				'Kills',
				'width=11&align=right'
			),
			new TableColumn(
				'kpercent',
				'Percentage of Kills',
				'width=18&sort=no&type=bargraph'
			),
			new TableColumn(
				'kpercent',
				'%',
				'width=5&sort=no&align=right&append=' . urlencode('%')
			),
			new TableColumn(
				'headshots',
				'Headshots',
				'width=8&align=right'
			),
			new TableColumn(
				'hpercent',
				'Percentage of Headshots',
				'width=18&sort=no&type=bargraph'
			),
			new TableColumn(
				'hpercent',
				'%',
				'width=5&sort=no&align=right&append=' . urlencode('%')
			),
			new TableColumn(
				'hpk',
				'Hpk',
				'width=5&align=right'
			)
		),
		'weapon',
		'kills',
		'weapon',
		true,
		9999,
		'weap_page',
		'weap_sort',
		'weap_sortorder',
		'tabweapons',
		'desc',
		true
	);
	
	$result = $db->query("
		SELECT
			hlstats_Events_Frags.weapon,
			IFNULL(hlstats_Weapons.modifier, 1.00) AS modifier,
			COUNT(hlstats_Events_Frags.weapon) AS kills,
			ROUND(COUNT(hlstats_Events_Frags.weapon) / $realkills * 100, 2) AS kpercent,
			SUM(hlstats_Events_Frags.headshot=1) as headshots,
			ROUND(SUM(hlstats_Events_Frags.headshot=1) / IF(COUNT(hlstats_Events_Frags.weapon) = 0, 1, COUNT(hlstats_Events_Frags.weapon)), 2) AS hpk,
			ROUND(SUM(hlstats_Events_Frags.headshot=1) / $realheadshots * 100, 2) AS hpercent
		FROM
			hlstats_Events_Frags
		LEFT JOIN hlstats_Weapons ON
			hlstats_Weapons.code = hlstats_Events_Frags.weapon
		LEFT JOIN hlstats_Players ON
			hlstats_Players.playerId=hlstats_Events_Frags.killerId
		WHERE
			clan=$clan
		AND
			hlstats_Weapons.game='$game'
		GROUP BY
			hlstats_Events_Frags.weapon
		ORDER BY
			$tblWeapons->sort $tblWeapons->sortorder,
			$tblWeapons->sort2 $tblWeapons->sortorder
	");
	printSectionTitle('Weapon Usage *');
	$tblWeapons->draw($result, $db->num_rows($result), 95);
?>
	
query("
		SELECT
			hlstats_Events_Statsme.weapon AS smweapon,
			SUM(hlstats_Events_Statsme.kills) AS smkills,
			SUM(hlstats_Events_Statsme.hits) AS smhits,
			SUM(hlstats_Events_Statsme.shots) AS smshots,
			SUM(hlstats_Events_Statsme.headshots) AS smheadshots,
			SUM(hlstats_Events_Statsme.deaths) AS smdeaths,
			SUM(hlstats_Events_Statsme.damage) AS smdamage,
			ROUND((SUM(hlstats_Events_Statsme.damage) / (IF( SUM(hlstats_Events_Statsme.hits)=0, 1, SUM(hlstats_Events_Statsme.hits) ))), 1) as smdhr,
			SUM(hlstats_Events_Statsme.kills) / IF((SUM(hlstats_Events_Statsme.deaths)=0), 1, (SUM(hlstats_Events_Statsme.deaths))) as smkdr,
      ROUND((SUM(hlstats_Events_Statsme.hits) / SUM(hlstats_Events_Statsme.shots) * 100), 1) as smaccuracy,
			ROUND(( (IF(SUM(hlstats_Events_Statsme.kills)=0, 0, SUM(hlstats_Events_Statsme.shots))) / (IF( SUM(hlstats_Events_Statsme.kills)=0, 1, SUM(hlstats_Events_Statsme.kills) ))), 1) as smspk
		FROM
			hlstats_Events_Statsme
		LEFT JOIN hlstats_Players ON
			hlstats_Players.playerId=hlstats_Events_Statsme.playerId
		WHERE
			clan=$clan
		GROUP BY
			hlstats_Events_Statsme.weapon
    HAVING
      SUM(hlstats_Events_Statsme.shots)>0
		ORDER BY
			$tblWeaponstats->sort $tblWeaponstats->sortorder,
			$tblWeaponstats->sort2 $tblWeaponstats->sortorder
	");
    
if ($db->num_rows($result) != 0)
{
	printSectionTitle('Weapon Stats *');
	$tblWeaponstats->draw($result, $db->num_rows($result), 95);
?>
	
 0				
		ORDER BY
			$tblWeaponstats2->sort $tblWeaponstats2->sortorder,
			$tblWeaponstats2->sort2 $tblWeaponstats2->sortorder
	";
  $result = $db->query($query);    	
if ($db->num_rows($result) != 0)
{
	printSectionTitle('Weapon Targets *');
	if ($g_options['show_weapon_target_flash'] == 1)
	{
?>
	
| Targets | 
| Show total target statistics |