zp4.3的BOT倒數前不開槍的插件在zp5.0裡不管用
誰能幫我修改一下
謝謝
複製程式
/********************************************
=============================================
* ZBot Helper For Zombie Plague 4.3+ *
=============================================
Description:
Fix some issues happens when playing with
Bots on CS:CZ
Additional CVAR:
bot_auto_kill <1|0>
bot_show_notification <1|0>
Modules:
- csx (for Countdown HUD Message)
- fakemeta (for flashlight code)
Changelog:
1.0 Initial release
1.1 Fix event_start so it works
1.2 Fix release
+ Added HUD Countdown features
+ Added 2 new cvars
+ Added experimental force flashlight
+ Added show notification
> Fix round end, bots stop attacking
each others now
1.3 Change logic, Fix sync issue
1.4 Fix release
+ Added bot_auto_kill
- Remove countdown code
- Remove force flashlight code
> Bots don't use smg (more survive)
> Bots don't use sniper (more survive)
Credits:
- AMXModx Team (AMXModX 1.8.1)
- Mercylezz (Zombie Plague 4.3)
********************************************/
#include <amxmodx>
#include <csx>
#include <fakemeta>
#include <amxmisc>
#include <zombieplague>
#define PLUGIN "[ZP] ZBot Helper Lite"
#define VERSION "1.4"
#define AUTHOR "Dels"
new freeze_time, max_player;
new cvar_zbot_autokill, cvar_zbot_notification;
const TASK_ID = 1603;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
//used for "bot_auto_kill"
register_event("DeathMsg","event_death","a");
//cvars
cvar_zbot_autokill = register_cvar("bot_auto_kill", "0"); //auto kill when all human die
cvar_zbot_notification = register_cvar("bot_show_notification", "0"); //not actual debug, just show notification
}
public event_round_start()
{
//bugfix
remove_task(TASK_ID);
//initialization each time round start
set_cvar_num("mp_autoteambalance", 0); //是否啟動自動隊伍平衡功能 0=關閉 1=開啟 或是人數例如32
set_cvar_num("mp_friendlyfire", 1); //玩家是否可以傷害到隊友 0=關閉 1=開啟
set_cvar_num("mp_freezetime", 4); //回合開始前的凍結時間 (單位: 秒, 0 為無凍結時間)
set_cvar_num("mp_limitteams", 0); //隊伍雙方人數最大可相差幾人 0=關閉 或是人數例如32
set_cvar_num("bot_allow_grenades", 1); //設定BOT是否使用手榴彈 1=使用
set_cvar_num("bot_allow_shotguns", 1); //設定BOT是否使用散彈槍 1=使用
set_cvar_num("bot_allow_pistols", 1); //設定BOT是否使用手槍 1=使用
set_cvar_num("bot_allow_snipers", 1); //設定BOT是否使用狙擊槍 1=使用
set_cvar_num("bot_allow_rogues", 0); //設定BOT是否跟隨隊伍 1=使用
set_cvar_num("bot_allow_machine_guns", 1); //設定BOT是否使用機槍 1=使用
set_cvar_num("bot_allow_sub_machine_guns", 1); //設定BOT是否使用衝鋒槍 1=使用
set_cvar_num("bot_allow_shield", 0); //設定BOT不使用盾牌 1=不使用
set_cvar_num("bot_allow_rifles", 1); //設定BOT是否使用步槍 1=使用
set_cvar_num("bot_zombie", 1); //設定BOT喪屍出現前不亂跑及不亂開槍 1=不亂跑及不亂開槍
//notification stuff
if (get_pcvar_num(cvar_zbot_notification) == 1)
client_print(0, print_chat, "DUMB BOTS: ENABLED");
freeze_time = get_cvar_num("zp_delay") - 1;
set_task(4.0, "freeze_bots", TASK_ID);
}
public freeze_bots()
{
--freeze_time;
if(freeze_time >= 1)
{
set_task(1.0, "freeze_bots", TASK_ID);
}
else
{
set_cvar_num("bot_zombie", 0);
remove_task(TASK_ID);
//notification stuff
if (get_pcvar_num(cvar_zbot_notification) == 1)
client_print(0, print_chat, "DUMB BOTS: DISABLED");
}
}
public zp_round_ended(winteam)
{
if (winteam != WIN_NO_ONE)
{
set_cvar_num("bot_zombie", 1);
//notification stuff
if (get_pcvar_num(cvar_zbot_notification) == 1)
client_print(0, print_chat, "DUMB BOTS: ENABLED");
}
}
public event_death()
{
if (get_pcvar_num(cvar_zbot_autokill) == 1)
{
new alive_humans;
max_player = get_maxplayers();
for (new i = 1; i <= max_player; i++)
{
if (!is_user_bot(i) && !is_user_hltv(i) && is_user_alive(i))
alive_humans++;
}
if (alive_humans == 0)
{
//set_cvar_string("bot_kill", "all"); //the simple way, bot frag decreased
for (new j = 1; j <= max_player; j++)
{
if (is_user_bot(j) && !is_user_hltv(j) && is_user_alive(j))
user_kill(j, 1)
}
}
}
}