wwww23 发表于 2007-1-16 23:40:36

nwb13的stats,请哪个高手指点或修改,万分感激.

这个插件确实牛B,只是有些地方修改一下更完美,希望哪位兄弟帮忙指点或修改一下,万分感谢。
第一:希望在死后直接显示/hp的内容,免去玩家打/hp,好像amxx1.76cc就可以直接显示
第二:每局结束后显示最多杀人最多金钱时间太短,我试着设置个秒数,可是一局完了一下子刷新把显示的刷掉了,希望显示到下一局开局三至四秒。

源码://- 本插件是在stats的基础上由阿牛修改出来的,如果你在此代码上再作修改,请保留这行文字
//- 如果你看到有乱码,那是因为插件里做了两次汉化,分别是UTF-8 和非UTF-8 两种编码
//- 本插件是在stats的基础上由阿牛修改出来的,如果你在此代码上再作修改,请保留这行文字
//- 如果你看到有乱码,那是因为插件里做了两次汉化,分别是UTF-8 和非UTF-8 两种编码
/* AMX Mod script.
*
* (c) 2003, OLO
* This file is provided as is (no warranties).
*
* Plugin works with Stats Settings Plugin. Just run both of them.
* By amx_statscfg command (from Stats Settings Plugin)
* you will be able to set all settings and save them to a file.
*
* Example of usage for some options:
* amx_ststacfg on ShowAttackers
* amx_ststacfg on SayHP
*
* Accept able are also parts of name:
* amx_statscfg off say
* amx_statscfg on show
*/

#include <amxmod>
#include <amxmisc>
#include <csstats>

// You can also manualy enable these options by setting them to 1
// For example:
// public ShowAttackers = 1
// However amx_statscfg command is recommended

public ShowAttackers // shows attackers
public ShowVictims // shows victims
public ShowKiller // shows killer
public EndPlayer // displays player stats at the end of map
public EndTop15 // displays top15 at the end of map
public KillerClip //- 显示杀人者的武器和子弹数量
public SpecRankInfo // displays rank info when spectating

public ShowHitAndHurt //-显示命中部位和受伤部位
public ShowSpecStatus //-显示观看对象的资料
public ShowRatio //-显示观看对象的命中率
public ShowMoney //-显示观看者的钱
public ShowIp //-显示观看者的IP地址
public SayRatio //-是否同意说/ratio看自己的命中率
public EndRoundTop5 //-每局结束的时候显示TOP5

public SayHP // displays information about user killer
public SayStatsAll // displays players stats and rank
public SayTop15 // displays first 15. players
public SayRank // displays user position in rank
public SayStatsMe // displays user stats

public EndTeamScore // displays at the end of round team score
public EndMostKills // displays at the end of who made most kills
public EndMostDamage // displays at the end of who made most damage

new g_Killers
new g_Buffer
new g_userPosition
new g_userState
new g_userPlayers
new g_bodyParts[] = {"全身","头部","胸部","腹部","左臂","右臂","左腿","右腿"}
new g_cbodyParts[] = {"全身","头部","胸部","腹部","左臂","右臂","左腿","右腿"}
new bool:g_specMode
new g_teamScore
new g_menuchose[] = {"显示统计","显示排名","显示命中率"}

new g_disabledMsg[] = "服务器关闭了这个功能"

public plugin_init() {
register_plugin("Stats","1.3","default源码-阿牛修改")
register_event("CS_DeathMsg","eCSDeathMsg","a")
register_event("ResetHUD","eResetHud","b")
register_event("SendAudio","eRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
register_event("30","eInterMission","a")
register_clcmd("say /hp","cmdKiller",0,"- displays info. about your killer")
register_clcmd("say /statsme","cmdStatsMe",0,"- displays your stats")
register_clcmd("say /stats","cmdStats",0,"- displays others stats")
register_clcmd("say /top15","cmdTop15",0,"- displays top 15 players")
register_clcmd("say /rank","cmdRank",0,"- displays your server stats")
register_clcmd("say /ratio","cmdratio",0,"- displays your ratio")
register_menucmd(register_menuid("数据统计"),1023,"actionStatsMenu")
register_event("TextMsg","setSpecMode","bd","2&ec_Mod")
register_event("StatusValue","showRank","bd","1=2")
register_event( "TeamScore", "eTeamScore", "a" )
}

public plugin_cfg(){
new g_addStast[] = "amx_statscfg add ^"%s^" %s"
server_cmd(g_addStast,"显示攻击者","ShowAttackers")
server_cmd(g_addStast,"显示受害者","ShowVictims")
server_cmd(g_addStast,"显示杀人者","ShowKiller")
server_cmd(g_addStast,"结束时显示数据统计","EndPlayer")
server_cmd(g_addStast,"结束时显示TOP15","EndTop15")
server_cmd(g_addStast,"杀人者的武器和子弹","KillerClip")
server_cmd(g_addStast,"Say /hp 功能","SayHP")
server_cmd(g_addStast,"Say /stats 功能","SayStatsAll")
server_cmd(g_addStast,"Say /top15 功能","SayTop15")
server_cmd(g_addStast,"Say /rank 功能","SayRank")
server_cmd(g_addStast,"Say /ratio 功能","SayRatio")
server_cmd(g_addStast,"Say /statsme 功能","SayStatsMe")
server_cmd(g_addStast,"观看者模式的信息","SpecRankInfo")
server_cmd(g_addStast,"队伍比分","EndTeamScore")
server_cmd(g_addStast,"杀人最多者","EndMostKills")
server_cmd(g_addStast,"伤害最大者","EndMostDamage")
server_cmd(g_addStast,"命中和受伤部位","ShowHitAndHurt")
server_cmd(g_addStast,"玩家状态","ShowSpecStatus")
server_cmd(g_addStast,"玩家命中率","ShowRatio")
server_cmd(g_addStast,"玩家的金钱","ShowMoney")
server_cmd(g_addStast,"每局结束时显示TOP5","EndRoundTop5")
server_cmd(g_addStast,"显示玩家的IP","ShowIp")
}

public eTeamScore(){
new team
read_data( 1, team, 1 )
g_teamScore[ (team=='C') ? 1 : 0 ] = read_data(2)
}

public setSpecMode(id) {
new arg
read_data( 2 , arg , 11 )
g_specMode[ id ] = ( arg == '4' ) //- 设置为第一人称视角
}

Float:getratio( temp,x,all ) {
if( all == 0 ) return ( 0.0 );
return ( 100.0 * float( temp ) / float( all ) );
}

//-列观看的资料
getspecstatus(id) {
new pos,stats,bodyhits,bodysum
if ( ShowSpecStatus ){
new name
get_user_name(id,name,31)
new health = get_user_health(id)
new armor = get_user_armor(id)
new data
new rank = get_user_stats(id,data,data)
pos += format(g_Buffer,2047-pos,"名字 : %s^n血 : %d^n甲 : %d^n排名 : %d^n",name,health,armor,rank )
}
if ( ShowMoney ){
new money = get_user_money(id)
pos += format(g_Buffer,2047-pos,"金钱 : $ %d^n",money )
}
if ( ShowRatio ){
get_user_stats(id,stats,bodyhits)
for( new x=1; x<8; ++x )
bodysum += bodyhits
new float:bodyratio
for( new x=1; x<8; ++x )
bodyratio = getratio( bodyhits, x, bodysum )
if ( stats==0 )
bodyratio = 0
else
bodyratio = ( float (stats) / float (stats) )
pos += format(g_Buffer,2047-pos,"命中率 :^n")
for ( new i = 1; i<8; ++i )
pos += format(g_Buffer,2047-pos,"->%s : %.2f%%%%^n",g_bodyParts,bodyratio)
pos += format(g_Buffer,2047-pos,"杀人/死亡 : %.2f^n",bodyratio)
}
if ( ShowIp ){
new ipaddress
get_user_ip(id,ipaddress,16,1)
pos += format(g_Buffer,2047-pos,"IP :%s^n",ipaddress)
}
}
//-列前5名
gettop5(){
new pos = 0,name,stats,bodyhits
pos += format(g_Buffer,2047-pos,"目前的前5名 :")
new imax = get_statsnum()
if (imax > 5) imax = 5
for(new a = 0; a < imax; ++a){
get_stats(a, stats, bodyhits, name, 31)
pos += format(g_Buffer,2047-pos,"^n%d. %s",a+1,name )
}
}

public showRank(id)
if ( SpecRankInfo && g_specMode ){
new a = read_data(2)
if ( is_user_connected( a ) ){
//new name, data
//get_user_name( a ,name,31)
//new pos = get_user_stats( a ,data,data)
//set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.01, 3.0, 1)
//show_hudmessage(id,"%s's rank is %d of %d",name,pos,get_statsnum())
getspecstatus(a)
if ( ShowRatio ){
set_hudmessage( 80, 180, 50, 0.03, 0.31, 0, 6.0, 10.0, 0.1, 0.2, 2)
//set_hudmessage(random_num(0,255),random_num(0,255),random_num(0,255), 0.03, 0.31, 0, 6.0, 10.0, 0.1, 0.2, 2)
}else{
set_hudmessage( 85, 62, 210, 0.03, 0.50, 0, 6.0, 10.0, 0.1, 0.2, 2)
//set_hudmessage(random_num(0,255),random_num(0,255),random_num(0,255), 0.03, 0.50, 0, 6.0, 10.0, 0.1, 0.2, 2)
}
show_hudmessage(id,g_Buffer)
}
}

/* build list of attackers */
getAttackers(id) {
new name,wpn, stats,body,found=0
new pos = copy(g_Buffer,2047,"攻击者 :^n")
new amax = get_maxplayers()
for(new a = 1; a <= amax; ++a){
if(get_user_astats(id,a,stats,body,wpn,31)){
found = 1
if (stats)
format(wpn,31," -- %s",wpn)
else
wpn = 0
get_user_name(a,name,31)
pos += format(g_Buffer,2047-pos,"%s -- 命中 %d 次 / 伤害 %d %s^n",name,stats,stats,wpn)
}
}
return found
}

/* build list of victims */
getVictims(id) {
new name,wpn, stats,body,found=0
new pos = copy(g_Buffer,2047,"受害者 :^n")
new amax = get_maxplayers()
for(new a = 1; a <= amax; ++a){
if(get_user_vstats(id,a,stats,body,wpn,31)){
found = 1
if (stats)
format(wpn,31," -- %s",wpn)
else
wpn = 0
get_user_name(a,name,31)
pos += format(g_Buffer,2047-pos,"%s -- 命中 %d 次 / 伤害 %d %s^n",name,stats,stats,wpn)
}
}
return found
}

/* build list of hita for AV List */
getHits(id,killer) {
new stats, body, pos = 0
g_Buffer = 0
get_user_astats(id,killer,stats,body)
for(new a = 1; a < 8; ++a)
if(body)
pos += format(g_Buffer,2047-pos,"%s: %d^n",g_bodyParts,body)
}

/* get top 15 */
getTop15(){
new pos=0, stats, body, name
#if !defined NO_STEAM
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
#endif
pos += format(g_Buffer,2047-pos," # %-28.27s %6s %6s %6s %6s %6s^n",
"名字", "杀人数" , "死亡数" , "命中", "开火", "爆头" )
new imax = get_statsnum()
if (imax > 15) imax = 15
for(new a = 0; a < imax; ++a){
get_stats(a,stats,body,name,31)
pos += format(g_Buffer,2047-pos,"%2d. %-28.27s %6d %6d %6d %6d %6d^n",a+1,name,stats,stats,stats,stats,stats)
}
#if !defined NO_STEAM
format(g_Buffer,2047-pos,"</pre></body></html>")
#endif
}

/* build list of hits for say hp */
getMyHits(id,killed) {
new name, stats, body
get_user_name(killed,name,31)
new pos = format(g_Buffer,2047,"你打中了 %s 的:",name)
get_user_vstats(id,killed,stats,body)
for(new a = 1; a < 8; ++a){
if(body)
pos += format(g_Buffer,2047-pos," %s: %d ",g_bodyParts,body)
}
}

//- 列命中部位
getMyHitlist(id,killed) {
new name, stats, body
get_user_name(killed,name,31)
new pos = format(g_Buffer,2047,"击中 %s 的 :^n",name)
get_user_vstats(id,killed,stats,body)
for(new a = 1; a < 8; ++a){
if(body)
pos += format(g_Buffer,2047-pos,"%s: %d^n",g_bodyParts,body)
}
}

//- 列受伤部位
getMyHurtlist(id,killed) {
new stats, body, temp=0
new pos = format(g_Buffer,2047,"受伤部位 :^n")
get_user_vstats(id,killed,stats,body)
for(new a = 1; a < 8; ++a){
if(body){
pos += format(g_Buffer,2047-pos,"%s: %d^n",g_bodyParts,body)
temp += body
}
}
if ( temp == 0 )
pos += format(g_Buffer,2047-pos,"无^n")
}

public eCSDeathMsg() {
new killer = read_data(1)
new victim = read_data(2)
if ( killer == victim ) return
new vorigin, korigin
get_user_origin(victim,vorigin)
get_user_origin(killer,korigin)
g_Killers = killer
g_Killers = get_user_health(killer)
g_Killers = get_user_armor(killer)
g_Killers = get_distance(vorigin,korigin)
if ( ShowHitAndHurt ){
getMyHitlist(killer,victim)
set_hudmessage(35,192,173,0.03,0.25,0, 6.0, 12.0, 1.0, 2.0, 3)
show_hudmessage(killer,g_Buffer)
getMyHurtlist(victim,killer)
set_hudmessage(163,82,65,0.03,0.48,0, 6.0, 12.0, 1.0, 2.0, 4)
show_hudmessage(killer,g_Buffer)
}
if ( ShowKiller ){
new name, stats, body, wpn, mstats, mbody
get_user_name(killer,name,31)
get_user_astats(victim,killer,stats,body,wpn,31)
if ( !get_user_vstats(victim,killer,mstats,mbody) )
mstats = mstats = 0
set_hudmessage(220,80,0,0.06,0.1,0, 6.0, 12.0, 1.0, 2.0, 1)
getHits(victim,killer)
show_hudmessage(victim,"%s (血 : %d /甲 : %d )^n从 %.2f 米远处用 %s 杀死了你.^n他击中你 %d 次,造成伤害 %d .^n你击中他 %d 次,造成伤害 %d .^n他击中你的部位 :^n%s",
name, g_Killers, g_Killers,float(g_Killers) * 0.0254, wpn, stats,stats, mstats,mstats,g_Buffer )
}
if ( ShowVictims && getVictims(victim) ){
set_hudmessage(0,80,220,0.55,0.60,0, 6.0, 12.0, 1.0, 2.0, 4)
show_hudmessage(victim,g_Buffer)
}
if ( ShowAttackers && getAttackers(victim)){
set_hudmessage(220,80,0,0.55,0.35,0, 6.0, 12.0, 1.0, 2.0, 3)
show_hudmessage(victim,g_Buffer)
}
if ( KillerClip ){
new name, kmsg, wpnname
new clip, ammo, wpnid = get_user_weapon(killer,clip,ammo)
get_user_name(killer,name,31)
get_weaponname(wpnid,wpnname,31)
--clip
if ( clip<0 ) clip=0
format(kmsg,255,"%s 用 %s 杀死了你^n弹夹里还有子弹 %d 发,子弹剩余 %d 发",name,wpnname,clip,ammo)
set_hudmessage(255,255,255,0.02,0.81,0, 6.0, 10.0, 1.0, 2.0, 5)
show_hudmessage(victim,kmsg)
}
}

public eResetHud( id )
g_Killers[ id ] = 0

public eRoundEnd()
set_task( 0.3 , "eRoundEndTask" )

public eRoundEndTask() {
if ( EndRoundTop5 ){
gettop5()
set_hudmessage(203,191,48,-1.0, 0.13, 0, 3.0, 5.0, 0.1, 0.2, 5)
show_hudmessage( 0 ,g_Buffer)
}
if ( ShowVictims || ShowAttackers ) {
new players, pnum
get_players( players , pnum, "a" )
for(new i = 0; i < pnum; ++i ) {
if ( ShowVictims &&getVictims( players[ i ] )){
set_hudmessage(0,80,220,0.55,0.60,0, 6.0, 12.0, 1.0, 2.0, 4)
show_hudmessage( players[ i ] ,g_Buffer)
}
if ( ShowAttackers && getAttackers( players[ i ] ) ){
set_hudmessage(220,80,0,0.55,0.35,0, 6.0, 12.0, 1.0, 2.0, 3)
show_hudmessage( players[ i ] ,g_Buffer)
}
}
}
if ( EndMostKills || EndTeamScore || EndMostDamage ){
new players, pnum, stats,bodyhits, len = 0
get_players( players , pnum )
g_Buffer = 0
if ( EndMostKills ){
new kills = 0, who = 0, hs = 0
for(new i = 0; i < pnum; ++i){
get_user_rstats( players,stats, bodyhits )
if ( stats > kills ){
who = players
kills = stats
hs = stats
}
}
if ( is_user_connected(who) ) {
new name
get_user_name( who, name, 31 )
len += format(g_Buffer , 1024 - len ,
"%s 杀人最多^n共杀人 %d 个 / 其中爆头 %d 个^n", name , kills , hs )
}
}
if ( EndMostDamage ){
new damage = 0, who = 0, hits = 0
for(new i = 0; i < pnum; ++i){
get_user_rstats( players,stats, bodyhits )
if ( stats > damage ){
who = players
hits = stats
damage = stats
}
}
if ( is_user_connected(who) ) {
new name
get_user_name( who, name, 31 )
len += format(g_Buffer , 1024 - len ,
"%s 伤害最多^n伤害总计 %d / 有效中弹数 %d^n", name , damage , hits )
}
}
if ( ShowMoney ){
new who = 0, temp = 0, money = 0
new name
for(new i = 0; i < pnum; ++i){
money = get_user_money(players)
if ( money > temp ){
who = players
temp = get_user_money(players)
}
}
if ( is_user_connected(who) ) {
get_user_name( who,name,31 )
len += format(g_Buffer , 1024 - len , "%s 金钱最多 -- $: %d^n",name, get_user_money(who) )
}
}
if ( EndTeamScore )
format(g_Buffer , 1024 - len , "恐怖分子 %d -- %d 反恐精英^n", g_teamScore , g_teamScore )
set_hudmessage(100,200,0,0.02,0.65,2, 0.01, 5.0, 0.01, 0.01, 2 )
show_hudmessage( 0 , g_Buffer )
}
}

public cmdKiller(id) {
if ( !SayHP ){
client_print(id,print_chat, g_disabledMsg )
return PLUGIN_HANDLED
}
if (g_Killers) {
new name, stats, body, wpn, mstats, mbody
get_user_name(g_Killers,name,31)
get_user_astats(id,g_Killers,stats,body,wpn,31)
client_print(id,print_chat,"%s 从 %.2f 米处用 %s 杀死了你", name,float(g_Killers) * 0.0254 ,wpn )
client_print(id,print_chat,"他击中你 %d 次共造成伤害 %d 并且还剩余 %d 的生命值和 %d 的护甲",
stats,stats, g_Killers,g_Killers )
if ( get_user_vstats(id,g_Killers,mstats,mbody) ) {
client_print(id,print_chat,"你击中他 %d 次共计伤害值 %d",mstats, mstats )
getMyHits(id,g_Killers)
client_print(id,print_chat,g_Buffer)
}
else client_print(id,print_chat,"你没有对他造成伤害.")
}
else {
client_print(id,print_chat,"没有杀死你的人")
}
return PLUGIN_CONTINUE
}

public cmdStatsMe(id){
if ( !SayStatsMe ){
client_print(id,print_chat, g_disabledMsg )
return PLUGIN_HANDLED
}
displayStats(id,id)
return PLUGIN_CONTINUE
}

public displayStats(id,dest) {
new pos=0, name, stats, body
get_user_wstats(id,0,stats,body)
#if !defined NO_STEAM
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
#endif
pos += format(g_Buffer,2047-pos,"%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n^n",
"杀人数",stats,"死亡数",stats,"伤害值",stats,"命中数",stats,"开枪数",stats)
pos += format(g_Buffer,2047-pos, "%-12.11s %6s %6s %6s %6s %6s^n",
"武器","开火","命中","伤害值","杀人","死亡")
for(new a = 1; a < 31; ++a) {
if (get_user_wstats(id,a,stats,body)){
get_weaponname(a,name,31)
pos += format(g_Buffer,2047-pos,"%-12.11s %6d %6d %6d %6d %6d^n",
name,stats,stats,stats,stats,stats)
}
}
get_user_name(id,name,31)
#if !defined NO_STEAM
format(g_Buffer,2047-pos,"</pre></body></html>")
#endif
show_motd(dest,g_Buffer,name)
return PLUGIN_CONTINUE
}

//列自己的命中率
public cmdratio(id){
if ( !SayRatio ){
client_print(id,print_chat, g_disabledMsg )
return PLUGIN_HANDLED
}
displayratio(id,id)
return PLUGIN_CONTINUE
}

public displayratio(id,dest) {
new name
new stats,bodyhits,bodysum,pos = 0
get_user_stats(id,stats,bodyhits)
for( new x=1; x<8; x++ )
bodysum += bodyhits
new float:bodyratio
for( new x=1; x<8; x++ )
bodyratio = getratio( bodyhits,x,bodysum )
if ( stats==0 )
bodyratio = 0
else
bodyratio = 100.0 * ( float (stats) / float (stats) )
#if !defined NO_STEAM
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
#endif
pos += format(g_Buffer,2047-pos,"身体各部位命中率 :^n^n")
for ( new i = 1; i<8; ++i )
pos += format(g_Buffer,2047-pos,"%s : %.2f%%%%^n",g_cbodyParts,bodyratio)
pos += format(g_Buffer,2047-pos,"杀人/死亡 : %.2f^n",bodyratio)
#if !defined NO_STEAM
format(g_Buffer,2047-pos,"</pre></body></html>")
#endif
get_user_name(id,name,31)
show_motd(dest,g_Buffer,name)
return PLUGIN_CONTINUE
}

public cmdRank(id){
if ( !SayRank ){
client_print(id,print_chat, g_disabledMsg )
return PLUGIN_HANDLED
}
displayRank(id,id)
return PLUGIN_CONTINUE
}

displayRank(id,dest) {
new pos=0, name, stats, body
new rank_pos = get_user_stats(id,stats,body)
#if !defined NO_STEAM
pos = format(g_Buffer,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><pre><body>")
#endif
pos += format(g_Buffer,2047-pos,"%s的排名是 %d 共有玩家 %d^n^n",(id==dest)?"你的":"他的", rank_pos,get_statsnum())
pos += format(g_Buffer,2047-pos,"%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n^n",
"杀人数",stats,"死亡数",stats,"伤害值",stats,"命中数",stats,"开枪数",stats)
pos += format(g_Buffer,2047-pos,"%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d",
"命中部位",g_cbodyParts,body,g_cbodyParts,body,g_cbodyParts,body, g_cbodyParts,body,
g_cbodyParts,body,g_cbodyParts,body,g_cbodyParts,body)
#if !defined NO_STEAM
format(g_Buffer,2047-pos,"</pre></body></html>")
#endif
get_user_name(id,name,31)
show_motd(dest,g_Buffer,name)
}

public cmdTop15(id) {
if ( !SayTop15 ){
client_print(id,print_chat, g_disabledMsg )
return PLUGIN_HANDLED
}
getTop15()
show_motd(id,g_Buffer,"前15名")
return PLUGIN_CONTINUE
}

public endGameStats(){
if ( EndPlayer ){
new players, inum
get_players(players,inum)
for(new i = 0; i < inum; ++i)
displayStats(players,players)
}
else if ( EndTop15 ) {
new players, inum
get_players(players,inum)
getTop15()
for(new i = 0; i < inum; ++i)
show_motd(players,g_Buffer,"前15名")
}
}

public eInterMission()
set_task(1.0,"endGameStats")

public cmdStats(id){
if ( !SayStatsAll ){
client_print(id,print_chat, g_disabledMsg )
return PLUGIN_HANDLED
}
showStatsMenu(id,g_userPosition=0)
return PLUGIN_CONTINUE
}

public actionStatsMenu(id,key){
switch(key){
case 7: {
//g_userState = 1 - g_userState
g_userState += 1
if (g_userState > 2 )
g_userState = 0
showStatsMenu(id,g_userPosition)
}
case 8: showStatsMenu(id,++g_userPosition)
case 9: showStatsMenu(id,--g_userPosition)
default:{
new option = g_userPosition * 7 + key
new index = g_userPlayers
if (is_user_connected(index)){
if (g_userState == 1)
displayRank(index,id)
else{
if (g_userState == 0)
displayStats(index,id)
else
displayratio(index,id)
}
}
showStatsMenu(id,g_userPosition)
}
}
return PLUGIN_HANDLED
}

showStatsMenu(id,pos){
if (pos < 0) return PLUGIN_HANDLED
new menu_body, inum, k = 0, start = pos * 7
get_players(g_userPlayers,inum)
if (start >= inum) start = pos = g_userPosition = 0
new len = format(menu_body,511,"\y数据统计\R%d/%d^n\w^n",pos + 1,((inum/7)+((inum%7)?1:0)))
new name, end = start + 7, keys = (1<<9)|(1<<7)
if (end > inum) end = inum
for(new a = start; a < end; ++a){
get_user_name(g_userPlayers,name,31)
keys |= (1<<k)
len += format(menu_body,511-len,"%d. %s^n\w",++k,name)
}
len += format(menu_body,511-len,"^n8. %s^n\w",g_menuchose] )
if (end != inum){
format(menu_body,511-len,"^n9. 下一页^n0. %s" , pos ? "返回" : "退出" )
keys |= (1<<8)
}
else format(menu_body,511-len,"^n0. %s" , pos ? "返回" : "退出" )
show_menu(id,keys,menu_body)
return PLUGIN_HANDLED
}

wwww23 发表于 2007-1-29 02:57:58

回复: nwb13的stats,请哪个高手指点或修改,万分感激.

郁闷,这个问题难道太难了?:(
页: [1]
查看完整版本: nwb13的stats,请哪个高手指点或修改,万分感激.