引用 | 编辑
HsK
2012-06-30 02:18 |
楼主
▼ |
||
x6
很多有写过 amxx 的人也用过 RegisterHam 吧.例如 RegisterHam(Ham_TakeDamage,"player","fw_TakeDamage"); 但是 "player" 是指定不到 zbot 的... 因此, 便发展出以下方法 在bot 入ser 时, 再进行一次 RegisterHamFromEntity(Ham_TakeDamage,id,"fw_TakeDamage"); 的确可以令 zbot 也进行 Ham_TakeDamage 内容... 但是, 当 ser 中不是只有 zbot 那便可能做成 zbot 不进行 Ham_TakeDamage 内容 而 Yapb/Podbot/Sypb 进行 Ham_TakeDamage 内容2次 的bug了.... ____ 前言很长哦=.=''' 因此我参考了一下 podbot 和 sypb 源码.. 写出以下代码.. 复制程式 stock is_bot_type (id) { if (!is_user_bot (id)) return 0; // not bot new tracker[2], friends[2], ah[2]; get_user_info(id,"tracker",tracker,1); get_user_info(id,"friends",friends,1); get_user_info(id,"_ah",ah,1); if (tracker[0] == '0' && friends[0] == '0' && ah[0] == '0') return 1; // PodBot / YaPB / SyPB return 2; // Zbot } 当用到 hamsandwich 之中 复制程式 #include <amxmodx> #include <fakemeta> #include <hamsandwich> #define PLUGIN_NAME "Ham - Bot Get (ZBOT-PODBOT-SyPB)" #define PLUGIN_VERSION "1.0" #define PLUGIN_AUTHOR "HsK" new bool:Ham_load = false; public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); RegisterHam(Ham_TakeDamage,"player","fw_TakeDamage"); } public client_putinserver(id) set_task (1.0, "Ham_run", id); public Ham_run (id) { server_print("Bot Type : %s", (is_bot_type (id) == 2 ? "Zbot" : (is_bot_type (id) == 1 ? "SyPB/YaPB/PodBot" : "This is not Bot"))); if (!is_user_connected(id) || Ham_load) return; if (is_bot_type (id) != 2) return; Ham_load = true; RegisterHamFromEntity(Ham_TakeDamage,id,"fw_TakeDamage"); } public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) { if (victim == attacker || !attacker) return; client_print (attacker, print_chat, "** fw_TakeDamage **Damage! Bot id : %d", victim); } stock is_bot_type (id) { if (!is_user_bot (id)) return 0; // not bot new tracker[2], friends[2], ah[2]; get_user_info(id,"tracker",tracker,1); get_user_info(id,"friends",friends,1); get_user_info(id,"_ah",ah,1); if (tracker[0] == '0' && friends[0] == '0' && ah[0] == '0') return 1; // PodBot / YaPB / SyPB return 2; // Zbot } x3
|
引用 | 编辑
zxzyman
2012-07-04 08:19 |
1楼
▲ ▼ |
WOW!!
可以让ZP道具伤害都能对BOT造成效果 我正好也是PODBOT+ZBOT来搞ZP的. 题外: BOT好像不会辨识ZP中的幸存者 或 复仇者... x0 |
引用 | 编辑
williamyii77
2012-07-16 20:08 |
5楼
▲ ▼ |
辛苦你了
我收下了 x0 |
引用 | 编辑
a7811311622
2013-02-28 22:25 |
6楼
▲ ▼ |
我想问…既然知道ZBOT会在client_putinserver做个task去debug…
在那个时间点判断是否为ZBOT后无脑remove_task有效吗…? x0 |
引用 | 编辑
sombarihelp
2019-07-14 00:31 |
10楼
▲ |
x0 |