<table cellspacing=1 border=0 class=style4>
<tr>
<th height=35px>#</th>
<th>Gametype</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 gametype index as gametypeindex select count(gametype) as roundcount,sum(duration) as duration,gametype,id,realname,image from view_rounds,gametype where view_rounds.gametype=gametype.idx group by gametype order by roundcount desc limit %%MAXMAINPAGEGAMETYPES%%$$
$$kills="0"$$
$$teamkills="0"$$
$$suicides="0"$$
$$totalplayers="0"$$
$$averageplayers="0"$$
$$loop stats as stats index as statsindex select max(roundidx) as lastround from view_rounds where gametype='%%gametype.gametype%%'$$
$$lastround=stats.lastround$$
$$endloop$$
$$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 gametype='%%gametype.gametype%%')$$
$$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 gametype='%%gametype.gametype%%')$$
$$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 gametype='%%gametype.gametype%%')$$
$$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 gametype='%%gametype.gametype%%')$$
$$totalplayers=stats.totalplayers$$
$$endloop stats$$
$$loop stats as stats index as statsindex select %%totalplayers%%.0/%%gametype.roundcount%%.0 as averageplayers from rounds limit 1$$
$$averageplayers=stats.averageplayers$$
$$endloop stats$$

<tr align=center>
<th width=15px align=center>$$gametypeindex$$</th>
<td>
$$if (gametype.image !EQUALS "")$$<img src="gametypes/$$gametype.image$$" width=200><br><b>$$gametype.realname$$</b>
$$else$$<img src="default/defaultgametype.jpg" width=200 height=151><br><b>$$gametype.realname$$</b><br>$$endif$$
</td>
<td>$$gametype.roundcount$$</td>
<td>$$formatfloat("%.1f",averageplayers)$$</td>
<td>$$totalplayers$$</td>
<td>$$kills$$</td>
<td>$$suicides$$</td>
<td>$$formatduration("%H:%M",gametype.duration)$$</td>
</tr>
$$endloop gametype$$
</table>
<br>
<br>
<br>

