$$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 max(roundidx) as lastround from view_rounds where mapname='%%map.mapname%%'$$ $$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 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$$ $$endloop maps$$
# Map Rounds
Played
Kills Team
Kills
Suicides Average
Players
Total
Players
Last
Round
Time
Played
$$mapindex$$ $$if (map.image !EQUALS "")$$
$$endif$$$$map.realname$$
$$map.roundcount$$ $$kills$$ $$teamkills$$ $$suicides$$ $$formatfloat("%.1f",averageplayers)$$ $$totalplayers$$ [$$formatinteger("%05d",lastround)$$] $$formatduration("%H:%M:%S",map.duration)$$