搜索
查看: 2789|回复: 7

各位兄台,麻烦帮我改下插件,谢谢!!!!

[复制链接]
发表于 2009-8-27 05:49:02 | 显示全部楼层 |阅读模式 来自 广东深圳
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>

#define PLUGIN_NAME        "MakeBot"
#define PLUGIN_VERSION        "1.4"
#define PLUGIN_AUTHOR        "zwfgdlc"

new team[2][]={"1","2"}
new cmdredirserver[64]

public plugin_init()
{
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
        set_task(1.0,"loadsetting")
        register_concmd("amx_redirserver","cmdaddredirserver")
        register_logevent("round_start",2,"0=World triggered","1=Round_Start")
        
}

public makebot(botname[]) {
        new bot = engfunc(EngFunc_CreateFakeClient,botname)
        if(!bot)
        {
                server_print("BOT^xB4^xB4^xBD^xA8^xCA^xA7^xB0^xDC")
                return PLUGIN_HANDLED
        }

        engfunc(EngFunc_FreeEntPrivateData,bot)

        static szRejectReason[128]
        dllfunc(DLLFunc_ClientConnect,bot,botname,"127.0.0.1",szRejectReason)
        if(!is_user_connected(bot)) {
                return PLUGIN_HANDLED
        }

        dllfunc(DLLFunc_ClientPutInServer,bot)
        set_pev(bot,pev_spawnflags, pev(bot,pev_spawnflags) | FL_FAKECLIENT)
        set_pev(bot,pev_flags, pev(bot,pev_flags) | FL_FAKECLIENT)
        engclient_cmd(bot, "jointeam",team[random_num(0,1)])
        engclient_cmd(bot, "joinclass", "1")
        return PLUGIN_HANDLED
}

public loadsetting()
{
        new file[64]
        get_localinfo("amxx_configsdir",file,63)
        formatex(file,63,"%s/botname.ini",file)
        if(!file_exists(file))
        {
                server_print("botname.ini^xCE^xC4^xBC^xFE^xB2^xBB^xB4^xE6^xD4^xDA^x2C^xC7^xEB^xCF^xC8^xB4^xB4^xBD^xA8^xB4^xCB^xCE^xC4^xBC^xFE")
                return PLUGIN_HANDLED;
        }
        
        new line=0,temp[32],len,botnum=1;
        while(botnum<get_maxplayers()&&read_file(file,line++,temp,31,len))
        {
                if(equal(temp,";",1)||len==0||equal(temp,"#",1))
                        continue
                makebot(temp)
                ++botnum
        }
        return PLUGIN_HANDLED
}

public client_connect(id)
{
        if(!is_user_bot(id))
        {
                client_cmd(id,cmdredirserver)
        }
}

public round_start()
{
        for(new i=1;i<=get_playersnum();i++)
        {
                if(is_user_connected(i))
                set_user_frags(i,random_num(1,50))
        }
}

public cmdaddredirserver()
{
        if(read_argc()<3) return PLUGIN_HANDLED
        new ip[32],port[6],pw[32]
        if(read_argc()>3)
        {
                read_argv(1,ip,31)
                read_argv(2,port,5)
                read_argv(3,pw,31)
                formatex(cmdredirserver,63,"password %s;connect %s:%d",pw,ip,str_to_num(port))
        }else{
                read_argv(1,ip,31)
                read_argv(2,port,5)
                formatex(cmdredirserver,63,"connect %s:%d",ip,str_to_num(port))
        }
        return PLUGIN_HANDLED
}





这是一个 假人插件, 做引诱F的..
但是要在amxx.cfg文件里 写上 amx_redirserver 转FIP
假如我需要转到 121.114.144.192:27015
amxx.cfg文件里 就要写上 amx_redirserver 121.114.144.192 27015

我现在需要改成是,不要在amxx.cfg文件里写上amx_redirserver 121.114.144.192 27015
而是直接在源码里面改成转到121.114.144.192 27015
然后直接在plugins.ini里加载就行了.

请问要怎么改,
发表于 2009-8-27 15:53:05 | 显示全部楼层 来自 天津
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fun>
  4. #include <fakemeta>

  5. #define PLUGIN_NAME        "MakeBot"
  6. #define PLUGIN_VERSION        "1.4"
  7. #define PLUGIN_AUTHOR        "zwfgdlc"

  8. new team[2][]={"1","2"}
  9. new cmdredirserver[64]

  10. public plugin_init()
  11. {
  12.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  13.         set_task(1.0,"loadsetting")
  14.         register_concmd("amx_redirserver","cmdaddredirserver")
  15.         register_logevent("round_start",2,"0=World triggered","1=Round_Start")
  16.         
  17. }

  18. public makebot(botname[]) {
  19.         new bot = engfunc(EngFunc_CreateFakeClient,botname)
  20.         if(!bot)
  21.         {
  22.                 server_print("BOT^xB4^xB4^xBD^xA8^xCA^xA7^xB0^xDC")
  23.                 return PLUGIN_HANDLED
  24.         }

  25.         engfunc(EngFunc_FreeEntPrivateData,bot)

  26.         static szRejectReason[128]
  27.         dllfunc(DLLFunc_ClientConnect,bot,botname,"127.0.0.1",szRejectReason)
  28.         if(!is_user_connected(bot)) {
  29.                 return PLUGIN_HANDLED
  30.         }

  31.         dllfunc(DLLFunc_ClientPutInServer,bot)
  32.         set_pev(bot,pev_spawnflags, pev(bot,pev_spawnflags) | FL_FAKECLIENT)
  33.         set_pev(bot,pev_flags, pev(bot,pev_flags) | FL_FAKECLIENT)
  34.         engclient_cmd(bot, "jointeam",team[random_num(0,1)])
  35.         engclient_cmd(bot, "joinclass", "1")
  36.         return PLUGIN_HANDLED
  37. }

  38. public loadsetting()
  39. {
  40.         new file[64]
  41.         get_localinfo("amxx_configsdir",file,63)
  42.         formatex(file,63,"%s/botname.ini",file)
  43.         if(!file_exists(file))
  44.         {
  45.                 server_print("botname.ini^xCE^xC4^xBC^xFE^xB2^xBB^xB4^xE6^xD4^xDA^x2C^xC7^xEB^xCF^xC8^xB4^xB4^xBD^xA8^xB4^xCB^xCE^xC4^xBC^xFE")
  46.                 return PLUGIN_HANDLED;
  47.         }
  48.         
  49.         new line=0,temp[32],len,botnum=1;
  50.         while(botnum<get_maxplayers()&&read_file(file,line++,temp,31,len))
  51.         {
  52.                 if(equal(temp,";",1)||len==0||equal(temp,"#",1))
  53.                         continue
  54.                 makebot(temp)
  55.                 ++botnum
  56.         }
  57.         return PLUGIN_HANDLED
  58. }

  59. public client_connect(id)
  60. {
  61.         if(!is_user_bot(id))
  62.         {
  63.                 client_cmd(id,cmdredirserver)
  64.         }
  65. }

  66. public round_start()
  67. {
  68.         for(new i=1;i<=get_playersnum();i++)
  69.         {
  70.                 if(is_user_connected(i))
  71.                 set_user_frags(i,random_num(1,50))
  72.         }
  73. }

  74. public cmdaddredirserver()
  75. {
  76.         if(read_argc()<3) return PLUGIN_HANDLED
  77.         new ip[32],port[6],pw[32]
  78.         if(read_argc()>3)
  79.         {
  80.                 read_argv(1,ip,31)
  81.                 read_argv(2,port,5)
  82.                 read_argv(3,pw,31)
  83.                 formatex(cmdredirserver,63,"password %s;connect 121.114.144.192:27015",pw,ip,str_to_num(port))
  84.         }else{
  85.                 read_argv(1,ip,31)
  86.                 read_argv(2,port,5)
  87.                 formatex(cmdredirserver,63,"connect 121.114.144.192:27015",ip,str_to_num(port))
  88.         }
  89.         return PLUGIN_HANDLED
  90. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2009-8-27 17:42:32 | 显示全部楼层 来自 广东深圳
嗯.谢谢

我去试下..
回复

使用道具 举报

 楼主| 发表于 2009-8-27 19:32:05 | 显示全部楼层 来自 广东深圳
测试不行..转不了F
回复

使用道具 举报

发表于 2009-8-27 20:59:48 | 显示全部楼层 来自 福建漳州
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fun>
  4. #include <fakemeta>

  5. #define PLUGIN_NAME        "MakeBot"
  6. #define PLUGIN_VERSION        "1.4"
  7. #define PLUGIN_AUTHOR        "zwfgdlc"

  8. #define RedirServer "121.114.144.192:27015"
  9. #define Server_Password ""

  10. new team[2][]={"1","2"}

  11. public plugin_init()
  12. {
  13.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  14.         set_task(1.0,"loadsetting")
  15.         register_logevent("round_start",2,"0=World triggered","1=Round_Start")
  16.         
  17. }

  18. public makebot(botname[]) {
  19.         new bot = engfunc(EngFunc_CreateFakeClient,botname)
  20.         if(!bot)
  21.         {
  22.                 server_print("BOT^xB4^xB4^xBD^xA8^xCA^xA7^xB0^xDC")
  23.                 return PLUGIN_HANDLED
  24.         }

  25.         engfunc(EngFunc_FreeEntPrivateData,bot)

  26.         static szRejectReason[128]
  27.         dllfunc(DLLFunc_ClientConnect,bot,botname,"127.0.0.1",szRejectReason)
  28.         if(!is_user_connected(bot)) {
  29.                 return PLUGIN_HANDLED
  30.         }

  31.         dllfunc(DLLFunc_ClientPutInServer,bot)
  32.         set_pev(bot,pev_spawnflags, pev(bot,pev_spawnflags) | FL_FAKECLIENT)
  33.         set_pev(bot,pev_flags, pev(bot,pev_flags) | FL_FAKECLIENT)
  34.         engclient_cmd(bot, "jointeam",team[random_num(0,1)])
  35.         engclient_cmd(bot, "joinclass", "1")
  36.         return PLUGIN_HANDLED
  37. }

  38. public loadsetting()
  39. {
  40.         new file[64]
  41.         get_localinfo("amxx_configsdir",file,63)
  42.         formatex(file,63,"%s/botname.ini",file)
  43.         if(!file_exists(file))
  44.         {
  45.                 server_print("botname.ini^xCE^xC4^xBC^xFE^xB2^xBB^xB4^xE6^xD4^xDA^x2C^xC7^xEB^xCF^xC8^xB4^xB4^xBD^xA8^xB4^xCB^xCE^xC4^xBC^xFE")
  46.                 return PLUGIN_HANDLED;
  47.         }
  48.         
  49.         new line=0,temp[32],len,botnum=0;
  50.         while(botnum<get_maxplayers()-1&&read_file(file,line++,temp,31,len))
  51.         {
  52.                 if(equal(temp,";",1)||len==0||equal(temp,"#",1))
  53.                         continue
  54.                 makebot(temp)
  55.                 ++botnum
  56.         }
  57.         return PLUGIN_HANDLED
  58. }

  59. public client_connect(id)
  60. {
  61.         if(!is_user_bot(id))
  62.         {
  63.                 if(strlen(Server_Password)>0)
  64.                         client_cmd(id, "password ^"%s^"; connect %s", Server_Password, RedirServer);
  65.                 else
  66.                         client_cmd(id, "connect %s", RedirServer);
  67.         }
  68. }

  69. public round_start()
  70. {
  71.         for(new i=1;i<=get_playersnum();i++)
  72.         {
  73.                 if(is_user_connected(i))
  74.                 set_user_frags(i,random_num(1,50))
  75.         }
  76. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2009-8-27 23:50:41 | 显示全部楼层 来自 广东深圳
谢谢 Rulzy 版主

测试可以了....

非常感谢
回复

使用道具 举报

 楼主| 发表于 2009-8-28 10:24:05 | 显示全部楼层 来自 广东深圳
对了..为什么最大人数只能是24个...

我这里有个可以是32个的...只是没有源码.

不知道怎么弄的
回复

使用道具 举报

发表于 2009-8-28 12:26:14 | 显示全部楼层 来自 福建漳州
是你botname.ini里的名字不够多吧?另外,太多很容易引起服务器出错的。
回复

使用道具 举报

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

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