搜索
查看: 3238|回复: 7

【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

[复制链接]
发表于 2006-6-4 13:58:14 | 显示全部楼层 |阅读模式 来自 中国–湖北–武汉
[color="Blue"]参数:
1、[color="Red"]amx_addbots_to [color="Blue"]<NUMBER>               //  控制添加机器人是人数到该数目;不能使服务器全满!
2、[color="Red"]amx_killbots [color="Blue"]<1 或 [color="Blue"]0>     // 为1时,当所有玩家死光,6.0秒后杀死机器人。

[color="Blue"]添加机器人(BOT)的方法:
打开CS目录下面的\valve\autoexec.cfg或\cstrike\autoexec.cfg,添加一行[PHP]localinfo mm_gamedll podbot/podbot.dll[/PHP]

[color="Blue"]要求:
[color="Magenta"]amxx 1.70以上版本

本帖子中包含更多资源

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

×
发表于 2006-6-17 20:28:29 | 显示全部楼层 来自 中国–江苏–南京

回复: 【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

请问有没有在amxx1.6下用的?没详细研究过amxx,所以不知道get_pcvar_num可以用什么代替。另外,建议增加个#define yapb用来控制yapb bot,因为yapb和pod的命令是不一样的,而不懂编程的人可能没法修改你的源码中其他相关的部分。
回复 0 1

使用道具 举报

 楼主| 发表于 2006-6-4 14:23:28 | 显示全部楼层 来自 中国–湖北–武汉

回复: 【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

[color="Red"]下面时全部源码:
[PHP]
//       Cvar : amx_addbots_to <NUMBER>; add bots when the number of players is less than NUMBER. not full!
//                amx_killbots <1 or 0>; kill bots when all players has death

#include <amxmodx>

#define PLUGIN "PODBot Control"
#define VERSION "1.0"
#define AUTHOR "KinSprite"

#define ADD_ONE_BOT "addbot"
#define KILL_ALL_BOTS "killbots"
#define KILL_BOTS_AFTER_SECONDS 6.0
#define KILL_BOTS_TASK_ID 5555

new g_addbots_to
new g_kill_bots
new bool:has_end_round
new bool:has_exist_task

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
        g_addbots_to = register_cvar("amx_addbots_to","0")
        g_kill_bots = register_cvar("amx_killbots","1")
        register_logevent("StartNewRound",2,"0=World triggered","1=Round_Start")
        register_logevent("EndRound",2,"0=World triggered","1=Round_End")
}

public client_connect(id)
{
        //if(!is_user_bot(id))
        set_task(1.0, "check_bots")
        return PLUGIN_CONTINUE
}

public client_disconnect(id)
{
        //if(!is_user_bot(id))
        set_task(1.0, "check_bots")
        return PLUGIN_CONTINUE
}

public check_bots()
{
        new add_to_num = get_pcvar_num(g_addbots_to)
        if (add_to_num==0 || add_to_num==1)
                return PLUGIN_CONTINUE
        new max_players = get_maxplayers()
        if (max_players <= add_to_num)
                add_to_num = max_players - 1
        new players_num = get_playersnum(1)
        if (add_to_num > players_num)
        {
                server_cmd(ADD_ONE_BOT)
        }
        else if (add_to_num < players_num)
        {
                new ct_count, t_count, players[32], players_b[32]
                get_players(players, ct_count, "de","CT")
                get_players(players_b, t_count, "de","TERRORIST")
                if (t_count > ct_count)
                {
                        new userid = get_user_userid(players_b[t_count-1])
                        server_cmd("kick #%d",userid)
                }
                else if (ct_count != 0)
                {
                        new userid = get_user_userid(players[ct_count-1])
                        server_cmd("kick #%d",userid)
                }       
        }
        return PLUGIN_CONTINUE
}

//public client_death(killer, victim, wpnindex, hitplace, TK){
public client_death()
{
        if (!get_pcvar_num(g_kill_bots) || has_end_round || has_exist_task)
                return PLUGIN_CONTINUE
        new players[32],num
        get_players(players,num,"ac")
        if (num==0)
        {
                set_task(KILL_BOTS_AFTER_SECONDS,"kill_bots",KILL_BOTS_TASK_ID)
                has_exist_task = true
        }
        return PLUGIN_CONTINUE
}

public kill_bots()
{
        if (!has_end_round)
                server_cmd(KILL_ALL_BOTS)
}

public StartNewRound()
{
        if (task_exists(KILL_BOTS_TASK_ID))
                remove_task(KILL_BOTS_TASK_ID)
        has_exist_task = false
        has_end_round = false
}

public EndRound()
{
        has_exist_task = true
        has_end_round = true
}[/PHP]
回复

使用道具 举报

 楼主| 发表于 2006-6-17 23:01:47 | 显示全部楼层 来自 中国–黑龙江–哈尔滨

回复: 【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

Post by 52yz
请问有没有在amxx1.6下用的?没详细研究过amxx,所以不知道get_pcvar_num可以用什么代替。另外,建议增加个#define yapb用来控制yapb bot,因为yapb和pod的命令是不一样的,而不懂编程的人可能没法修改你的源码中其他相关的部分。


新编写的东西,一般只考虑支持最新的版本。 我没有用过yapb,也不知道他的Cvars与commands。 CZBot官方网上有这些,PODBot我是试出来的。:D  
  等我了解yapb以后再说。 
回复

使用道具 举报

发表于 2006-6-18 01:05:31 | 显示全部楼层 来自 中国–广东–深圳

回复: 【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

添加完localinfo mm_gamedll podbot/podbot.dll 后,服务器一开就自动关了。什么问题?
回复

使用道具 举报

 楼主| 发表于 2006-6-18 09:31:58 | 显示全部楼层 来自 中国–黑龙江–哈尔滨

回复: 【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

Post by AE86
添加完localinfo mm_gamedll podbot/podbot.dll 后,服务器一开就自动关了。什么问题?


先确认你的服务器是否能添加podbot? podbot一般情况下是在cs 1.5下面才有的。同时文件位置要对。
回复

使用道具 举报

发表于 2006-6-18 20:46:23 | 显示全部楼层 来自 中国–江苏–南京

回复: 【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

#include <amxmodx>
#define PLUGIN "PODBot Control"
#define VERSION "1.0"
#define AUTHOR "KinSprite"
#define ADD_ONE_BOT "yapb add"
#define KILL_ALL_BOTS "yapb killbots"
#define KILL_BOTS_AFTER_SECONDS 6.0
#define KILL_BOTS_TASK_ID 5555
new bool:has_end_round
new bool:has_exist_task
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("amx_addbots_to","0")
register_cvar("amx_killbots","1")
register_logevent("StartNewRound",2,"0=World triggered","1=Round_Start")
register_logevent("EndRound",2,"0=World triggered","1=Round_End")
}
public client_connect(id)
{
//if(!is_user_bot(id))
set_task(1.0, "check_bots")
return PLUGIN_CONTINUE
}
public client_disconnect(id)
{
//if(!is_user_bot(id))
set_task(1.0, "check_bots")
return PLUGIN_CONTINUE
}
public check_bots()
{
new add_to_num = get_cvar_num("amx_addbots_to")
if (add_to_num==0 || add_to_num==1)
  return PLUGIN_CONTINUE
new max_players = get_maxplayers()
if (max_players <= add_to_num)
  add_to_num = max_players - 1
new players_num = get_playersnum(1)
if (add_to_num > players_num)
{
  server_cmd(ADD_ONE_BOT)
}
else if (add_to_num < players_num)
{
  new ct_count, t_count, players[32], players_b[32]
  get_players(players, ct_count, "de","CT")
  get_players(players_b, t_count, "de","TERRORIST")
  if (t_count > ct_count)
  {
   new userid = get_user_userid(players_b[t_count-1])
   server_cmd("kick #%d",userid)
  }
  else if (ct_count != 0)
  {
   new userid = get_user_userid(players[ct_count-1])
   server_cmd("kick #%d",userid)
  }
}
return PLUGIN_CONTINUE
}
//public client_death(killer, victim, wpnindex, hitplace, TK){
public client_death()
{
if (!get_cvar_num("amx_kill_bots") || has_end_round || has_exist_task)
  return PLUGIN_CONTINUE
new players[32],num
get_players(players,num,"ac")
if (num==0)
{
  set_task(KILL_BOTS_AFTER_SECONDS,"kill_bots",KILL_BOTS_TASK_ID)
  has_exist_task = true
}
return PLUGIN_CONTINUE
}
public kill_bots()
{
if (!has_end_round)
  server_cmd(KILL_ALL_BOTS)
}
public StartNewRound()
{
if (task_exists(KILL_BOTS_TASK_ID))
  remove_task(KILL_BOTS_TASK_ID)
has_exist_task = false
has_end_round = false
}
public EndRound()
{
has_exist_task = true
has_end_round = true
}

我改了一下你的源程序,在1.6下编译通过,可在F上试的时候没作用,想请教一下我改的对不对,F用的是yapb的bot,对应的增加bot命令是yapb add,杀死所有bot的命令是yapb killbots
回复

使用道具 举报

 楼主| 发表于 2006-6-18 23:02:32 | 显示全部楼层 来自 中国–黑龙江–哈尔滨

回复: 【发布】PODBot Control v1.0 - 自动添加/踢出/杀死 POD机器人

也许yapb的控制跟podbot不一样,比如czbot是用bot_quota控制数量的。
你可以参见我写的czbot control v1.0 : http://forum.dt-club.net/thread/71/29581/
回复

使用道具 举报

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

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