搜索
查看: 7118|回复: 21

[AMXX 带源码] 求助.关于stats.amxx这个插件的问题

[复制链接]
发表于 2009-1-7 20:45:19 | 显示全部楼层 |阅读模式 来自 中国–广西–防城港
附件为源码.我今天试了这个插件.觉得它的top15排名比较漂亮.可是用了之后发现没有玩家say:/me这个功能.平时用的statsx.amxx就有.不知道有没有高手能帮助在源码上加入玩家say:/me这个功能.怎么加.加在哪里.请高人说明.谢谢!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2009-1-7 21:13:12 | 显示全部楼层 来自 中国–广东–韶关
管理员直接在服务器修改也行
控制台输入amx_statscfgmenu        显示统计配置菜单  
开启/me
回复

使用道具 举报

 楼主| 发表于 2009-1-8 00:02:22 | 显示全部楼层 来自 中国–广西–防城港
本帖最后由 shote 于 2009-1-8 00:06 编辑
管理员直接在服务器修改也行
控制台输入amx_statscfgmenu        显示统计配置菜单  
开启/me
8874323 发表于 2009-1-7 21:13

我打OP密码上去。也用管理员帐号进去了。。可以我在控制台打这个指令。它说我无权执行这个指令。。还有别的办法吗?

直接在服务器修改在哪个文件修改?
谢谢。。
回复

使用道具 举报

发表于 2009-1-8 10:33:35 | 显示全部楼层 来自 中国–广东–韶关
cstrike\addons\amxmodx\config\stats.ini添加上
SayMe                    ;Say /me
就行了
回复

使用道具 举报

 楼主| 发表于 2009-1-8 11:14:55 | 显示全部楼层 来自 中国–广西–防城港
cstrike\addons\amxmodx\config\stats.ini添加上
SayMe                    ;Say /me
就行了
8874323 发表于 2009-1-8 10:33

晕。。你应该没有看过源码。。这个我会。。stats.ini这个文件里面是有sayme的。我这个问题应该是插件上没有这个功能。帮我看看插件。。看能不能加上去。。
回复

使用道具 举报

 楼主| 发表于 2009-1-8 11:24:35 | 显示全部楼层 来自 中国–广西–防城港
这个插件是有这个功能的。我装在服务器上没有了sayme这个功能应该是少了什么文件没加上去。有懂的朋友麻烦帮看看。。
回复

使用道具 举报

 楼主| 发表于 2009-1-8 11:26:18 | 显示全部楼层 来自 中国–广西–防城港
/* AMX Mod X
*   CS Stats Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*
*  Modifications by: zhangsheng
*
*  Chinese version by: zhangsheng
*/

#include <amxmodx>
#include <amxmisc>
#include <csstats>
#include <cstrike>

// 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 KillerHpAp         // displays killer hp&ap to victim console and screen
public SpecRankInfo       // displays rank info when spectating

public ShowSpecStatus          // show specstatus
public ShowRatio          // show ratio
public ShowMoney          // show money
public ShowIp                  // show ip
public EndRoundTop5          // end round 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_userszszState[33]
new g_userPlayers[33][32]
new g_bodyParts[8][] = {"全身","头部","胸部","腹部","左臂","右臂","左腿","右腿"}
new bool:g_specMode[33]
new g_teamScore[2]

new g_disabledMsg[] = "服务器禁止了这个参数"

public plugin_init() {
        register_plugin("CS Stats","0.16","AMXX Dev Team")
        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,"- 显示杀你的人的状态")
        register_clcmd("say /statsme","cmdStatsMe",0,"- 显示你的统计")
        register_clcmd("say /stats","cmdStats",0,"- 显示其他人的数据统计")
        register_clcmd("say /top15","cmdTop15",0,"- 显示排名榜前15名")
        register_clcmd("say /rank","cmdRank",0,"- 显示你在这个服务器上的排名情况")
        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,"Show Attackers","ShowAttackers")
        server_cmd(g_addStast,"Show Victims","ShowVictims")
        server_cmd(g_addStast,"Show killer","ShowKiller")
        server_cmd(g_addStast,"Stats at the end of map","EndPlayer")  
        server_cmd(g_addStast,"Top15 at the end of map","EndTop15")  
        server_cmd(g_addStast,"Show killer hp&ap","KillerHpAp")
        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 /statsme","SayStatsMe")
        server_cmd(g_addStast,"Spec. Rank Info","SpecRankInfo")
        server_cmd(g_addStast,"Team Score","EndTeamScore")
        server_cmd(g_addStast,"Most Kills","EndMostKills")
        server_cmd(g_addStast,"Most Damage","EndMostDamage")  
        server_cmd(g_addStast,"Spec. status","ShowSpecStatus")
        server_cmd(g_addStast,"Spec. hit body ratio","ShowRatio")
        server_cmd(g_addStast,"display player's money","ShowMoney")
        server_cmd(g_addStast,"display top5 on endround","EndRoundTop5")
        server_cmd(g_addStast,"displayer player's ip","ShowIp")
}

public client_color(id,msg[]){
        new playerslist[32],playerscount//,i
        get_players(playerslist,playerscount,"c")
        if(id==0){
                message_begin(MSG_ALL, get_user_msgid("SayText"), {0,0,0},id)
                write_byte(id)
                write_string(msg)
                message_end()
               
        }
        else{
                message_begin(MSG_ONE, get_user_msgid("SayText"), {0,0,0}, id)
                write_byte(id)
                write_string(msg)
                message_end()
        }
}

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] == '2' )
}

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

/*ShowSpecStatus*/
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 = cs_get_user_money(id)
                pos += format(g_Buffer[pos],2047-pos,"金钱: $ %d^n",money )
        }
        if ( ShowRatio ){
                get_user_stats(id,stats,bodyhits)
                for( new i=1; i<8; ++i )
                        bodysum += bodyhits[i]
                new Float:bodyratio[8]
                for( new i=1; i<8; ++i )
                        bodyratio[i] = getratio( bodyhits, i, bodysum )
                if ( stats[1] == 0 )
                        bodyratio[0] = 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[i],bodyratio[i])
                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)
        }
}

/*EndRoundTop5*/
gettop5(){
        new pos = 0,name[32],stats[8],bodyhits[8]
        pos += format(g_Buffer[pos],2047-pos,"排行榜前5名:^n————————————————")
        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的名次是 %d人中排第 %d",name,get_statsnum(),pos)
                getspecstatus(a)
                if ( ShowRatio ){
                        set_hudmessage( 150, 50, 255, 0.03, 0.31, 0, 6.0, 10.0, 0.1, 0.2, 9)
                        //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( 150, 50, 255, 0.03, 0.50, 0, 6.0, 10.0, 0.1, 0.2, 9)
                        //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,"Attackers:^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)){
回复

使用道具 举报

 楼主| 发表于 2009-1-8 11:27:54 | 显示全部楼层 来自 中国–广西–防城港
楼上为插件的前部份源码。
回复

使用道具 举报

发表于 2009-1-8 11:28:32 | 显示全部楼层 来自 中国–广东–韶关
晕。。你应该没有看过源码。。这个我会。。stats.ini这个文件里面是有sayme的。我这个问题应该是插件上没有这个功能。帮我看看插件。。看能不能加上去。。 ...
shote 发表于 2009-1-8 11:14

还是用我的吧

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
回复

使用道具 举报

 楼主| 发表于 2009-1-8 11:57:11 | 显示全部楼层 来自 中国–广西–防城港
发源码的给我看看喂。。在scripting文件夹里面应该有的。
回复

使用道具 举报

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

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