Added bots_main_firstIsHost

This commit is contained in:
INeedBots 2020-12-01 13:57:43 -06:00
parent e79dea5ad2
commit 56302f3693
2 changed files with 19 additions and 3 deletions

View File

@ -22,6 +22,8 @@ init()
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
if(getDvar("bots_main_firstIsHost") == "")
setDvar("bots_main_firstIsHost", false);//first player to connect is a host
if(getDvar("bots_manage_add") == "") if(getDvar("bots_manage_add") == "")
setDvar("bots_manage_add", 0);//amount of bots to add to the game setDvar("bots_manage_add", 0);//amount of bots to add to the game
@ -77,6 +79,9 @@ init()
setDvar("bots_play_target_other", true); setDvar("bots_play_target_other", true);
if(getDvar("bots_play_killstreak") == "")//bot use killstreaks if(getDvar("bots_play_killstreak") == "")//bot use killstreaks
setDvar("bots_play_killstreak", true); setDvar("bots_play_killstreak", true);
if(!isDefined(game["botWarfare"]))
game["botWarfare"] = true;
level.defuseObject = undefined; level.defuseObject = undefined;
level.bots_smokeList = List(); level.bots_smokeList = List();

View File

@ -20,15 +20,26 @@ doHostCheck()
if (self is_bot()) if (self is_bot())
return; return;
DvarGUID = getDvar("bots_main_GUIDs");
result = false; result = false;
if (getDvar("bots_main_firstIsHost") != "0")
{
if (getDvar("bots_main_firstIsHost") == "1")
{
setDvar("bots_main_firstIsHost", self getguid());
}
if (getDvar("bots_main_firstIsHost") == self getguid()+"")
result = true;
}
DvarGUID = getDvar("bots_main_GUIDs");
if (DvarGUID != "") if (DvarGUID != "")
{ {
guids = strtok(DvarGUID, ","); guids = strtok(DvarGUID, ",");
for (i = 0; i < guids.size; i++) for (i = 0; i < guids.size; i++)
{ {
if(self getguid() == guids[i]) if(self getguid()+"" == guids[i])
result = true; result = true;
} }
} }
@ -44,7 +55,7 @@ doHostCheck()
*/ */
is_bot() is_bot()
{ {
return ((isDefined(self.pers["isBot"]) && self.pers["isBot"]) || (isDefined(self.pers["isBotWarfare"]) && self.pers["isBotWarfare"])); return self isBot();
} }
/* /*