Updated to mw2's

This commit is contained in:
INeedBots 2020-11-20 02:10:44 -06:00
parent aba2d55e42
commit 37ac438d57

View File

@ -20,8 +20,6 @@ init()
cac_init_patch(); cac_init_patch();
thread hook_callbacks(); thread hook_callbacks();
setDvar("sv_botsPressAttackBtn", true);
if(getDvar("bots_main_GUIDs") == "") if(getDvar("bots_main_GUIDs") == "")
setDvar("bots_main_GUIDs", "");//guids of players who will be given host powers, comma seperated setDvar("bots_main_GUIDs", "");//guids of players who will be given host powers, comma seperated
@ -87,6 +85,8 @@ init()
level.smokeRadius = 255; level.smokeRadius = 255;
level.bots = [];
level.bots_fullautoguns = []; level.bots_fullautoguns = [];
level.bots_fullautoguns["rpd"] = true; level.bots_fullautoguns["rpd"] = true;
level.bots_fullautoguns["m60e4"] = true; level.bots_fullautoguns["m60e4"] = true;
@ -257,6 +257,16 @@ fixPerksAndScriptKick()
self.pers["isBot"] = true; self.pers["isBot"] = true;
} }
/*
When a bot disconnects.
*/
onDisconnect()
{
self waittill("disconnect");
level.bots = array_remove(level.bots, self);
}
/* /*
Called when a player connects. Called when a player connects.
*/ */
@ -287,9 +297,23 @@ connected()
self thread maps\mp\bots\_bot_internal::connected(); self thread maps\mp\bots\_bot_internal::connected();
self thread maps\mp\bots\_bot_script::connected(); self thread maps\mp\bots\_bot_script::connected();
level.bots[level.bots.size] = self;
self thread onDisconnect();
level notify("bot_connected", self); level notify("bot_connected", self);
} }
/*
When a bot gets added into the game.
*/
added()
{
self endon("disconnect");
self thread maps\mp\bots\_bot_internal::added();
self thread maps\mp\bots\_bot_script::added();
}
/* /*
Adds a bot to the game. Adds a bot to the game.
*/ */
@ -472,7 +496,12 @@ teamBots()
if(player.pers["team"] == toTeam) if(player.pers["team"] == toTeam)
continue; continue;
player notify("menuresponse", game["menu_team"], toTeam); if (toTeam == "allies")
player thread [[level.allies]]();
else if (toTeam == "axis")
player thread [[level.axis]]();
else
player thread [[level.spectator]]();
break; break;
} }
} }
@ -495,7 +524,7 @@ teamBots()
{ {
if(axis > teamAmount) if(axis > teamAmount)
{ {
player notify("menuresponse", game["menu_team"], "allies"); player thread [[level.allies]]();
break; break;
} }
} }
@ -503,12 +532,12 @@ teamBots()
{ {
if(axis < teamAmount) if(axis < teamAmount)
{ {
player notify("menuresponse", game["menu_team"], "axis"); player thread [[level.axis]]();
break; break;
} }
else if(player.pers["team"] != "allies") else if(player.pers["team"] != "allies")
{ {
player notify("menuresponse", game["menu_team"], "allies"); player thread [[level.allies]]();
break; break;
} }
} }
@ -619,17 +648,6 @@ addBots()
} }
} }
/*
When a bot gets added into the game.
*/
added()
{
self endon("disconnect");
self thread maps\mp\bots\_bot_internal::added();
self thread maps\mp\bots\_bot_script::added();
}
/* /*
A thread for ALL players, will monitor and grenades thrown. A thread for ALL players, will monitor and grenades thrown.
*/ */