搜索
查看: 2066|回复: 1

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

[复制链接]
发表于 2007-1-16 23:40:36 | 显示全部楼层 |阅读模式 来自 中国–广西–柳州
这个插件确实牛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[33][4]
new g_Buffer[2048]
new g_userPosition[33]
new g_userState[33]
new g_userPlayers[33][32]
new g_bodyParts[8][] = {"全身","头部","胸部","腹部","左臂","右臂","左腿","右腿"}
new g_cbodyParts[8][] = {"全身","头部","胸部","腹部","左臂","右臂","左腿","右腿"}
new bool:g_specMode[33]
new g_teamScore[2]
new g_menuchose[3][] = {"显示统计","显示排名","显示命中率"}

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[2]
read_data( 1, team, 1 )
g_teamScore[ (team[0]=='C') ? 1 : 0 ] = read_data(2)
}

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

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

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

public showRank(id)
if ( SpecRankInfo && g_specMode[id] ){
new a = read_data(2)
if ( is_user_connected( a ) ){
//new name[32], data[8]
//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[32],wpn[32], stats[8],body[8],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[0])
format(wpn,31," -- %s",wpn)
else
wpn[0] = 0
get_user_name(a,name,31)
pos += format(g_Buffer[pos],2047-pos,"%s -- 命中 %d 次 / 伤害 %d %s^n",name,stats[5],stats[6],wpn)
}
}
return found
}

/* build list of victims */
getVictims(id) {
new name[32],wpn[32], stats[8],body[8],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[1])
format(wpn,31," -- %s",wpn)
else
wpn[0] = 0
get_user_name(a,name,31)
pos += format(g_Buffer[pos],2047-pos,"%s -- 命中 %d 次 / 伤害 %d %s^n",name,stats[5],stats[6],wpn)
}
}
return found
}

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

/* get top 15 */
getTop15(){
new pos=0, stats[8], body[8], name[32]
#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[pos],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[pos],2047-pos,"%2d. %-28.27s %6d %6d %6d %6d %6d^n",a+1,name,stats[0],stats[1],stats[5],stats[4],stats[2])
}
#if !defined NO_STEAM
format(g_Buffer[pos],2047-pos,"</pre></body></html>")
#endif
}

/* build list of hits for say hp */
getMyHits(id,killed) {
new name[32], stats[8], body[8]
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[a])
pos += format(g_Buffer[pos],2047-pos," %s: %d ",g_bodyParts[a],body[a])
}
}

//- 列命中部位
getMyHitlist(id,killed) {
new name[32], stats[8], body[8]
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[a])
pos += format(g_Buffer[pos],2047-pos,"%s: %d^n",g_bodyParts[a],body[a])
}
}

//- 列受伤部位
getMyHurtlist(id,killed) {
new stats[8], body[8], 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[a]){
pos += format(g_Buffer[pos],2047-pos,"%s: %d^n",g_bodyParts[a],body[a])
temp += body[a]
}
}
if ( temp == 0 )
pos += format(g_Buffer[pos],2047-pos,"无^n")
}

public eCSDeathMsg() {
new killer = read_data(1)
new victim = read_data(2)
if ( killer == victim ) return
new vorigin[3], korigin[3]
get_user_origin(victim,vorigin)
get_user_origin(killer,korigin)
g_Killers[victim][0] = killer
g_Killers[victim][1] = get_user_health(killer)
g_Killers[victim][2] = get_user_armor(killer)
g_Killers[victim][3] = 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[32], stats[8], body[8], wpn[33], mstats[8], mbody[8]
get_user_name(killer,name,31)
get_user_astats(victim,killer,stats,body,wpn,31)
if ( !get_user_vstats(victim,killer,mstats,mbody) )
mstats[5] = mstats[6] = 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[victim][1], g_Killers[victim][2],float(g_Killers[victim][3]) * 0.0254, wpn, stats[5],stats[6], mstats[5],mstats[6],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[32], kmsg[256], wpnname[32]
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[7],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] = 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[32], 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[32], pnum, stats[8],bodyhits[8], len = 0
get_players( players , pnum )
g_Buffer[0] = 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[0] > kills ){
who = players
kills = stats[0]
hs = stats[2]
}
}
if ( is_user_connected(who) ) {
new name[32]
get_user_name( who, name, 31 )
len += format(g_Buffer[len] , 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[6] > damage ){
who = players
hits = stats[5]
damage = stats[6]
}
}
if ( is_user_connected(who) ) {
new name[32]
get_user_name( who, name, 31 )
len += format(g_Buffer[len] , 1024 - len ,
"%s 伤害最多^n伤害总计 %d / 有效中弹数 %d^n", name , damage , hits )
}
}
if ( ShowMoney ){
new who = 0, temp = 0, money = 0
new name[32]
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[len] , 1024 - len , "%s 金钱最多 -- $: %d^n",name, get_user_money(who) )
}
}
if ( EndTeamScore )
format(g_Buffer[len] , 1024 - len , "恐怖分子 %d -- %d 反恐精英^n", g_teamScore[0] , g_teamScore[1] )
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[id][0]) {
new name[32], stats[8], body[8], wpn[33], mstats[8], mbody[8]
get_user_name(g_Killers[id][0],name,31)
get_user_astats(id,g_Killers[id][0],stats,body,wpn,31)
client_print(id,print_chat,"%s 从 %.2f 米处用 %s 杀死了你", name,float(g_Killers[id][3]) * 0.0254 ,wpn )
client_print(id,print_chat,"他击中你 %d 次共造成伤害 %d 并且还剩余 %d 的生命值和 %d 的护甲",
stats[5],stats[6], g_Killers[id][1],g_Killers[id][2] )
if ( get_user_vstats(id,g_Killers[id][0],mstats,mbody) ) {
client_print(id,print_chat,"你击中他 %d 次共计伤害值 %d",mstats[5], mstats[6] )
getMyHits(id,g_Killers[id][0])
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[32], stats[8], body[8]
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[pos],2047-pos,"%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n^n",
"杀人数",stats[0],"死亡数",stats[1],"伤害值",stats[6],"命中数",stats[5],"开枪数",stats[4])
pos += format(g_Buffer[pos],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[pos],2047-pos,"%-12.11s %6d %6d %6d %6d %6d^n",
name[7],stats[4],stats[5],stats[6],stats[0],stats[1])
}
}
get_user_name(id,name,31)
#if !defined NO_STEAM
format(g_Buffer[pos],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[32]
new stats[8],bodyhits[8],bodysum,pos = 0
get_user_stats(id,stats,bodyhits)
for( new x=1; x<8; x++ )
bodysum += bodyhits[x]
new float:bodyratio[8]
for( new x=1; x<8; x++ )
bodyratio[x] = getratio( bodyhits,x,bodysum )
if ( stats[1]==0 )
bodyratio[0] = 0
else
bodyratio[0] = 100.0 * ( float (stats[0]) / float (stats[1]) )
#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[pos],2047-pos,"身体各部位命中率 :^n^n")
for ( new i = 1; i<8; ++i )
pos += format(g_Buffer[pos],2047-pos,"%s : %.2f%%%%^n",g_cbodyParts,bodyratio)
pos += format(g_Buffer[pos],2047-pos,"杀人/死亡 : %.2f^n",bodyratio[0])
#if !defined NO_STEAM
format(g_Buffer[pos],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[32], stats[8], body[8]
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[pos],2047-pos,"%s的排名是 %d 共有玩家 %d^n^n",(id==dest)?"你的":"他的", rank_pos,get_statsnum())
pos += format(g_Buffer[pos],2047-pos,"%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n^n",
"杀人数",stats[0],"死亡数",stats[1],"伤害值",stats[6],"命中数",stats[5],"开枪数",stats[4])
pos += format(g_Buffer[pos],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[1],body[1],g_cbodyParts[2],body[2],g_cbodyParts[3],body[3], g_cbodyParts[4],body[4],
g_cbodyParts[5],body[5],g_cbodyParts[6],body[6],g_cbodyParts[7],body[7])
#if !defined NO_STEAM
format(g_Buffer[pos],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[32], inum
get_players(players,inum)
for(new i = 0; i < inum; ++i)
displayStats(players,players)
}
else if ( EndTop15 ) {
new players[32], 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[id]=0)
return PLUGIN_CONTINUE
}

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

showStatsMenu(id,pos){
if (pos < 0) return PLUGIN_HANDLED
new menu_body[512], inum, k = 0, start = pos * 7
get_players(g_userPlayers[id],inum)
if (start >= inum) start = pos = g_userPosition[id] = 0
new len = format(menu_body,511,"\y数据统计\R%d/%d^n\w^n",pos + 1,((inum/7)+((inum%7)?1:0)))
new name[32], 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[id][a],name,31)
keys |= (1<<k)
len += format(menu_body[len],511-len,"%d. %s^n\w",++k,name)
}
len += format(menu_body[len],511-len,"^n8. %s^n\w",g_menuchose[g_userState[id]] )
if (end != inum){
format(menu_body[len],511-len,"^n9. 下一页^n0. %s" , pos ? "返回" : "退出" )
keys |= (1<<8)
}
else format(menu_body[len],511-len,"^n0. %s" , pos ? "返回" : "退出" )
show_menu(id,keys,menu_body)
return PLUGIN_HANDLED
}
 楼主| 发表于 2007-1-29 02:57:58 | 显示全部楼层 来自 中国–广西–柳州–柳北区

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

郁闷,这个问题难道太难了?:(
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

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