引用 | 編輯
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 |