<table cellspacing=1 border=0 class=style4>
<tr>
<th height=35px>#</th>
<th>Map</th>
<th width=60px>Rounds<br>Played</th>
<th width=60px>Average<br>Players</th>
<th width=60px>Total<br>Players</th>
<th width=80px>Kills</th>
<th width=60px>Suicides</th>
<th width=80px>Time<br>Played</th>
</tr>
$$loop row as map index as mapindex select count(mapname) as roundcount,sum(duration) as duration,mapname,id,realname,image from view_rounds,map where view_rounds.mapname=map.idx group by mapname order by roundcount desc limit %%MAXMAINPAGEMAPS%%$$
$$kills="0"$$
$$teamkills="0"$$
$$suicides="0"$$
$$totalplayers="0"$$
$$averageplayers="0"$$
$$loop stats as stats index as statsindex select count(*) as killcount from killdata where killtype='KILL' and roundindex in (select roundidx from view_rounds where mapname='%%map.mapname%%')$$
$$kills=stats.killcount$$
$$endloop stats$$
$$loop stats as stats index as statsindex select count(*) as killcount from killdata where killtype='TEAMKILL' and roundindex in (select roundidx from view_rounds where mapname='%%map.mapname%%')$$
$$teamkills=stats.killcount$$
$$endloop stats$$
$$loop stats as stats index as statsindex select count(*) as killcount from killdata where killtype='SUICIDE' and roundindex in (select roundidx from view_rounds where mapname='%%map.mapname%%')$$
$$suicides=stats.killcount$$
$$endloop stats$$
$$loop stats as stats index as statsindex select count(*) as totalplayers from playerinround where roundindex in (select roundidx from view_rounds where mapname='%%map.mapname%%')$$
$$totalplayers=stats.totalplayers$$
$$endloop stats$$
$$loop stats as stats index as statsindex select %%totalplayers%%.0/%%map.roundcount%%.0 as averageplayers from rounds limit 1$$
$$averageplayers=stats.averageplayers$$
$$endloop stats$$
<tr align=center>
<th width=15px align=center>$$mapindex$$</th>
<td width=150px align=center>
$$if (map.image !EQUALS "")$$<img src="maps/$$map.image$$" width=200 height=113><br><a href="map_$$map.id$$.html"><b>$$map.realname$$</b></a>
$$else$$<img src="default/defaultmap.jpg" width=200 height=113><br><a href="map_$$map.id$$.html"><b>$$map.realname$$</b></a>$$endif$$
</td>
<td>$$map.roundcount$$</td>
<td>$$formatfloat("%.1f",averageplayers)$$</td>
<td>$$totalplayers$$</td>
<td>$$kills$$</td>
<td>$$suicides$$</td>
<td>$$formatduration("%H:%M",map.duration)$$</td>
</tr>
$$endloop maps$$
</table>
<br>
<br>
<br>

