$$openfile awardlist.html$$
$$include menu.include$$
<body>
<title>CoD2 Awards</title>
<br>
<br>	
<table class=nameplate align=center>
<td width=298 height=50 background="general/nameplate.jpg"><div align="center">Awards</div></td>
</table>
<br>
<br>	
<table cellspacing=0 class=style2 width=1024px align=center valign=top>
$$awardprint=""$$
$$loop row as awarddef index as awarddefindex select * from awarddefinition$$
	$$updatestatus("Award: %%awarddef.name%%")$$
	$$pointsrecorded="0"$$
	$$loop row as awardpoints index as awardpointsindex select count(*) from view_awardpoints where awardindex='%%awarddef.awardindex%%'$$
		$$pointsrecorded=awardpoints.0$$
	$$endloop awardpoints$$
	$$if (pointsrecorded !EQUALS "0")$$
		$$if (awardprint EQUALS "")$$<tr valign=top align=left>$$endif$$
		$$if (awardprint EQUALS "XX")$$</tr>$$awardprint=""$$$$endif$$
		$$awardprint="%%awardprint%%X"$$
		<th valign=top align=left>
			<table border=0 cellspacing=0 class=style1 width=100%>
			<tr><th id=award height=30px colspan=2 align=center><b>$$awarddef.name$$</b></th></tr>
			<tr valign=top>
				<td align=center width=168px>$$if (awarddef.image !EQUALS "")$$<img src="awards/$$awarddef.image$$">
					$$else$$<img src="default/defaultaward.jpg">$$endif$$</td>
				<td>
					<table cellspacing=1 class=style1 width=100%>
						<tr>
				<th>#</th>
				<th>Player</th>
				<th>Score</th>
			</tr>	
						$$if (awarddef.weighted EQUALS "Y")$$
							$$selectcommand="select coalesce(cast(sum(awardpoints.score)as float)/cast(count(awardpoints.score)as float),'-9999999') as awardscore,name as playername,awardpoints.playerindex from awardpoints,player where awardindex='%%awarddef.awardindex%%' and player.playerindex=awardpoints.playerindex and player.dropped='N' group by awardpoints.playerindex order by awardscore desc limit %%MAXAWARDPLAYERS%%"$$
						$$else$$
							$$selectcommand="select sum(awardpoints.score) as awardscore,name as playername,awardpoints.playerindex from awardpoints,player where awardindex='%%awarddef.awardindex%%'  and player.playerindex=awardpoints.playerindex and player.dropped='N' group by awardpoints.playerindex order by awardscore desc limit %%MAXAWARDPLAYERS%%"$$
						$$endif$$
						$$loop row as awardpoints index as awardpointsindex %%selectcommand%%$$
						$$if (awardpointsindex EQUALS "1")$$
						$$MessageCentre("AWARD%%awarddef.id%%",awardpoints.playername,formatfloat("%.1f",awardpoints.awardscore))$$
						$$endif$$
						<tr>
							<th align=middle height=27px width=15px>$$awardpointsindex$$</th>
							<td width=180px><b><a href="player_$$hash(awardpoints.playername)$$.html">$$colouredtext2html(awardpoints.playername)$$</a></b></td>
							<td align=center width=60px>$$formatfloat("%.1f",awardpoints.awardscore)$$</font></td>
						</tr>
						$$endloop awardpoints$$
						<br>
						<br>
					</table>
				</td>
			</tr>
			</table>
		</th>
	$$endif$$
$$endloop awarddef$$
$$if (awardprint !EQUALS "")$$</tr>$$awardprint=""$$$$endif$$
</table>

</body>
$$closefile$$
