|
楼主 |
发表于 2004-7-1 14:33:43
|
显示全部楼层
来自 中国–广东–深圳
大家看看的stats.sma文件中TOP15排行榜的这一段,我是从这得到启发如何编写程序的。
/* get top 15 */
getTop15() {
new pos, stats[8], body[8], name[32]
new state[4]
pos = copy(g_Buffer,2047,"<html><head><body><style type=^"text/css^">")
pos += copy(g_Buffer[pos],2047-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}")
pos += copy(g_Buffer[pos],2047-pos,"</style></head><body><table><tr class=^"header^"><td>#</td><td>Nick</td><td>Kills</td><td>Deaths</td><td>Hits</td><td>Shots</td><td>HS</td></tr>")
new imax = get_statsnum()
if (imax > 15) imax = 15
for(new a = 0; a < imax; ++a){
if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one")
get_stats(a,stats,body,name,31)
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"%s^"><td>%d.</td><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>",state,a+1,name,stats[0],stats[1],stats[5],stats[4],stats[2])
}
copy(g_Buffer[pos],2047-pos,"</table></body></html>")
} |
|