搜索
查看: 1736|回复: 0

top30html.amxx 排行榜 HTML

[复制链接]
发表于 2006-6-26 23:04:34 | 显示全部楼层 |阅读模式 来自 日本
#include <amxmodx>
#include <amxmisc>
#include <csstats>

//#define DEBUG

new g_Buffer[8188]

public plugin_init() {
        register_plugin("Top30 Generator","1.2","Nobukz")
        register_event("SendAudio","cmdTop30","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
        //set_task(3600.0,"cmdTop30",1,"",0,"b")
#if defined DEBUG
        register_clcmd("say /top30html","cmdTop30",0,"- write HTML top 30 players")
#endif
}

public cmdTop30(id) {
        new filename[128]
        getTop30()
        format(filename,127,"addons/amxmodx/custom/amxx_top30.html")
        if(file_exists(filename))
                delete_file(filename)
        write_file(filename,g_Buffer,-1)
#if defined DEBUG
        client_print(0, print_chat,"[TEST] HTML wrote.")
#endif
        return PLUGIN_CONTINUE
}

getTop30() {
        new pos, stats[8], body[8], name[32]
        new state[4]
        new curtime[48]
        get_time("%m/%d/%Y - %H:%M:%S",curtime,48)
#if defined DEBUG
        client_print(0, print_chat,"[TEST] Update: %s",curtime)
#endif
        pos = copy(g_Buffer,4094,"<html><head><style type=^"text/css^">")
        pos += copy(g_Buffer[pos],4094-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFFFFF;background-color:#000000;margin-left:8px;margin-top:40px}.header{background-color:#0000FF;}.one{background-color:#000066;}.two{background-color:#006600;}</style></head><body>")
        pos += copy(g_Buffer[pos],4094-pos,"<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size=^"4^"> Server TOP 30</font></p>")
        pos += format(g_Buffer[pos],4094-pos,"<p>Last Update: %s</p>",curtime)
        pos += copy(g_Buffer[pos],4094-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 > 30) imax = 30
        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],4094-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],4094-pos,"</table></body></html>")
}



这是把排名转为HTML的插件代码1.0的时候能用。但是在1.71上无法使用,我又不会编辑希望高手帮忙把它修改一下吧。谢谢了!
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表