homework 发表于 2010-12-20 11:20:00

【以解决】高集成的imessage插件

本帖最后由 homework 于 2011-8-27 09:45 编辑

用心静如水汉化的AMXX1.8.2 感觉很不错 里面做的修改很正点
遗憾的就是他的AMXX1.8.2包里面很多插件没有相应的源码
在此求下 他里面修改过的 imessage.amxx的源码,麻烦如水兄
或者 有此源码的朋友共享下,不胜感激!

还有一个他在statsx里面加了一段每局结束时最佳杀人统计
样式我没截到图大概是这样的:
在屏幕中间偏下的位置每局结束时候显示:
                     本局最佳杀手
         -------------------------------
                  XXXXX 共杀敌 XXX人
求知道源码的共享下,感谢!!!!代码找到了不知道怎么加到statsx里面去public eEndRound(){
        if (g_iRoundEndTriggered) return PLUGIN_CONTINUE
        g_iRoundEndTriggered=1
        Round_Control=0
        new i,maxkillcount
        maxkillcount=0
        new RoundEndMsg,ipos
        new playerslist,playerscount
        ipos=0
        ipos+=format(RoundEndMsg,512-ipos,"本局最佳杀手")
       
        get_players(playerslist,playerscount)//GetPlayers
        for(i=0;i<playerscount;i++){
                if(playerkilled]&&playerkilled]>maxkillcount) maxkillcount=playerkilled]
        }
        if(maxkillcount){
                new playername,playeradded=0
                ipos+=format(RoundEndMsg,512-ipos,"^n(杀%d人)^n __________________________^n",maxkillcount)
                for(i=0;i<playerscount;i++){
                        if(playerkilled]==maxkillcount){//WeiGet this players
                                get_user_name(playerslist,playername,32)
                                ipos+=format(RoundEndMsg,512-ipos,"%s^n",playername)
                                ++playeradded
                                if(playeradded>=3){
                                        ipos+=format(RoundEndMsg,512-ipos,"......^n")
                                        break;
                                }
                        }
                }
        }else{
                ipos+=format(RoundEndMsg,512-ipos,"^n__________________________^n大家太客气了,都没有杀敌^n")
        }
        set_hudmessage( 49, 179, 113, -1.0, 0.38, 2, 0.02, 5.0, 0.01, 0.01, 3 )
        show_hudmessage(0,RoundEndMsg)
        return PLUGIN_CONTINUE
}插件效果图片如下:








zhangsheng 发表于 2010-12-20 12:43:34

显示在线OP和VIP?

homework 发表于 2010-12-20 13:19:23

本帖最后由 homework 于 2010-12-21 12:18 编辑

显示在线OP和VIP?
zhangsheng 发表于 2010-12-20 12:43 http://www.dt-club.net/forum/images/common/back.gif

恩,他一起集成在imessage.amxx里面的,还自定义了2条消息

我没源码,找到了OP VIP在线显示 不知道怎么加进去

他的statsx.amxx里面还加了 每局结束显示当局最佳杀手显示
如图:

诚恳的希望 如水 兄能把您汉化AMXX1.8.2里面的statsx和imessage 2个插件的
源码共享一下,谢谢了。。。

为方便大家使用,把4楼zhangsheng大大的附件源码贴出来,附件里面有2个源码文件一个是imessage.sma,主要功能自己看源码就明白了,第二个附件的源码在五楼Best_Killer.sma/* AMX Mod X
*   Info. Messages 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.
*/

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

#define MAX_MESSAGES100
#define X_POS         -1.0
#define Y_POS         0.12
#define HOLD_TIME   12.0

new g_Values
new g_Messages
new g_MessagesNum,g_subMsgNum
new g_Current,g_subCurrent

public plugin_init() {
        register_plugin("Info. Messages",AMXX_VERSION_STR,"AMXX Dev Team")
        register_dictionary("imessage.txt")
        register_dictionary("common.txt")
        register_srvcmd("amx_imessage","setMessage")
        register_cvar("amx_freq_imessage","10")
        new lastinfo
        get_localinfo("lastinfomsg",lastinfo,7)
        g_Current = str_to_num(lastinfo)
        g_subCurrent = 0
        g_subMsgNum=3
        set_localinfo("lastinfomsg","")
}

public infoMessage() {
        if(g_Current==0) g_subCurrent=0
        if (g_Current >= g_MessagesNum)
        {
                g_subCurrent++;
                if(g_subCurrent>=g_subMsgNum){
                        g_Current = 0
                }
                //在这里我们增加一个现实在线OP的模块
                new opmsg,playerslist,playerscount,i,pos,opcount
                get_players(playerslist,playerscount,"c")//Skip Bot
                opcount=0;
                if(g_subCurrent==1){
                        opmsg="【当前在线执行OP】^n—————————————^n"
                        pos=strlen(opmsg)
                        for(i=0;i<playerscount;i++){
                                if(access(playerslist,ADMIN_IMMUNITY)){
                                        new username
                                        get_user_name(playerslist,username,32)
                                        opcount++
                                        pos+=format(opmsg,511-pos,"%s^n",username)
                                }
                        }
                        if(opcount==0) opmsg="【目前无OP在线】"
                }
                if(g_subCurrent==2){
                        opmsg="【当前在线超级VIP】^n—————————————^n"
                        pos=strlen(opmsg)
                        for(i=0;i<playerscount;i++){
                                if(access(playerslist,ADMIN_RESERVATION)&&(!access(playerslist,ADMIN_IMMUNITY))){
                                        new username
                                        get_user_name(playerslist,username,32)
                                        opcount++
                                        pos+=format(opmsg,511-pos,"%s^n",username)
                                }
                        }
                        if(opcount==0) opmsg="【目前无超级VIP在线】"//We Do not display NO VIP
                }
                if(g_subCurrent==3){
                        new name,stats,bodyhits
                        opmsg="【排行榜前5名】^n—————————————"
                        pos=strlen(opmsg)
                        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(opmsg,511-pos,"^n%d. %s",a+1,name)
                        }
                }
               
                set_hudmessage(255,144,255,X_POS,Y_POS,2,0.1,HOLD_TIME,0.1,0.1,-1)
                show_hudmessage(0,opmsg)
                new Float:freq_im = get_cvar_float("amx_freq_imessage")               
                if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
        }
        else {
                set_hudmessage(random_num(20,200), random_num(20,200), random_num(20,200),
                X_POS, Y_POS, 2, 0.1, HOLD_TIME , 0.1, 0.1, -1)
                show_hudmessage(0,g_Messages)
                client_print(0,print_console,g_Messages)
                ++g_Current
                new Float:freq_im = get_cvar_float("amx_freq_imessage")
                if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
        }
}

public setMessage() {
        if (g_MessagesNum >= MAX_MESSAGES) {
                server_print("%L",LANG_SERVER,"INF_REACH")
                return PLUGIN_HANDLED
        }
        remove_task(12345)
        read_argv(1,g_Messages,380)
        new hostname
        get_cvar_string("hostname",hostname,63)
        replace(g_Messages,380,"%hostname%",hostname)
        while(replace(g_Messages,380,"\n","^n")){}
        new mycol
        read_argv(2,mycol,11) // RRRGGGBBB
        g_Values = str_to_num(mycol)
        mycol = 0
        g_Values = str_to_num(mycol)
        mycol = 0
        g_Values = str_to_num(mycol)
        g_MessagesNum++
        new Float:freq_im = get_cvar_float("amx_freq_imessage")
        if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
        return PLUGIN_HANDLED
}

public plugin_end() {
        new lastinfo
        num_to_str(g_Current,lastinfo,7)
        set_localinfo("lastinfomsg",lastinfo)
}

zhangsheng 发表于 2010-12-20 16:03:05

自己去试,本人已经不搞服务器了

homework 发表于 2010-12-21 12:11:22

本帖最后由 homework 于 2010-12-21 12:20 编辑

自己去试,本人已经不搞服务器了
zhangsheng 发表于 2010-12-20 16:03 http://www.dt-club.net/forum/images/common/back.gif
谢谢zhangsheng同志
你发的附件已经实现每局最后显示最佳杀手的效果
如图
我想修改下,修改内容如下:
1显示最佳杀手不用打印式的显示,一局结束就直接把整体所有信息显示出来,应该在哪里修改
2想修改下显示最佳杀手的字体颜色为白色,应该修改哪个地方
谢谢指教。建议:如果能把此插件集成到statsx.sma里面去就完美了,呵呵。附上源码:#include <amxmodx>
#include <cstrike>

new g_playerkilled;
new g_maxplayers = 32;

public plugin_init()
{
        register_plugin("Best Killer", "1.0", "Rulzy");
        register_event("DeathMsg","eDeathMsg", "a", "1>0");
        register_event("HLTV", "eNewRound", "a", "1=0", "2=0");
        register_logevent("eEndRound", 2, "0=World triggered", "1=Round_End");
        g_maxplayers = get_maxplayers();
}

public client_connect(id)
{
        g_playerkilled = 0;
}

public eNewRound()
{
        for(new i=1; i<=g_maxplayers; i++)
                g_playerkilled = 0;
}

public eDeathMsg()
{
        new killer=read_data(1);
        if(!is_user_connected(killer)) return PLUGIN_CONTINUE;
        new victim=read_data(2);
        if(!is_user_connected(victim)) return PLUGIN_CONTINUE;
        if(get_user_team(killer)==get_user_team(victim)) return PLUGIN_CONTINUE; //TK
        g_playerkilled++;
        return PLUGIN_CONTINUE;
}

public eEndRound()
{
        new msg, maxkillcount = 0, maxkillplayercount = 0;
        new ipos=format(msg, 512,"本局最佳杀手");
        new maxkillplayerlist;
        for(new i=1; i<=g_maxplayers; i++)
        {
                if(!is_user_connected(i)) continue;
                if(g_playerkilled>maxkillcount)
                {
                        maxkillcount = g_playerkilled;
                        maxkillplayercount = 1;
                        maxkillplayerlist = i;
                        }else if(g_playerkilled==maxkillcount){
                        maxkillplayercount++;
                        maxkillplayerlist = i;
                }
        }
        if(maxkillcount>0)
        {
                new name;
                ipos+=format(msg,512-ipos,"^n(杀%d人)^n————————————————^n", maxkillcount);
                if(maxkillplayercount<=3)
                {
                        for(new i=0; i<maxkillplayercount; i++)
                        {
                                get_user_name(maxkillplayerlist, name, 31);
                                ipos+=format(msg, 512-ipos, "%s^n", name);
                        }
                        }else{
                        for(new i=0; i<2; i++)
                        {
                                get_user_name(maxkillplayerlist, name, 31);
                                ipos+=format(msg, 512-ipos, "%s^n", name);
                        }
                        ipos+=format(msg,512-ipos,"......^n")
                }
                }else{
                ipos+=format(msg,512-ipos,"^n————————————————^n无伤亡^n")
        }
        set_hudmessage(80, 180, 101, -1.0, 0.6, 2, 0.02, 4.0, 0.02, 5.0, 2);
        show_hudmessage(0, msg);
}

zhangsheng 发表于 2010-12-21 12:15:02

set_hudmessage(颜色, 颜色, 颜色, -1.0, 0.6, 效果2改为0就不打字了, 0.02, 4.0, 0.02, 5.0, 2);

linpf 发表于 2010-12-21 13:56:11

好东西.......

linpf 发表于 2010-12-21 13:57:53

.....................

linpf 发表于 2010-12-21 13:58:44

,,,,,,,,,,,,,,,,,,,,,,

q352332201 发表于 2011-1-10 02:36:57

{:2_31:}支持一下!!!
页: [1] 2 3
查看完整版本: 【以解决】高集成的imessage插件