host func

This commit is contained in:
Your Name 2020-09-07 14:52:38 -06:00
parent 792bf42c88
commit c0bf3fbc6d
3 changed files with 24 additions and 4 deletions

View File

@ -10,11 +10,11 @@ init()
{ {
level.bw_VERSION = "2.0.0"; level.bw_VERSION = "2.0.0";
if(getDvar("bots_main_debug") == "") if(getDvar("bots_main") == "")
setDvar("bots_main_debug", 0); setDvar("bots_main", true);
if(getDVarint("bots_main_debug")) if (!getDvarInt("bots_main"))
return; return;
thread load_waypoints(); thread load_waypoints();
thread hook_callbacks(); thread hook_callbacks();
@ -365,6 +365,9 @@ connected()
{ {
self endon("disconnect"); self endon("disconnect");
if (!isDefined(self.pers["bot_host"]))
self thread doHostCheck();
if(!self is_bot()) if(!self is_bot())
return; return;
@ -382,6 +385,8 @@ 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 notify("bot_connected", self);
} }
/* /*

View File

@ -2,6 +2,16 @@
#include maps\mp\_utility; #include maps\mp\_utility;
#include maps\mp\gametypes\_hud_util; #include maps\mp\gametypes\_hud_util;
is_host()
{
return (isDefined(self.pers["bot_host"]) && self.pers["bot_host"]);
}
doHostCheck()
{
self.pers["bot_host"] = false;
}
/* /*
Returns if the player is a bot. Returns if the player is a bot.
*/ */

View File

@ -5,6 +5,9 @@
init() init()
{ {
if(getDvar("bots_main_debug") == "")
setDvar("bots_main_debug", 0);
if(!getDVarint("bots_main_debug")) if(!getDVarint("bots_main_debug"))
return; return;
@ -17,11 +20,13 @@ init()
exitLevel(false); exitLevel(false);
} }
setDvar("bots_main", 0);
setdvar("bots_main_menu", 0); setdvar("bots_main_menu", 0);
setdvar("bots_manage_fill_mode", 0); setdvar("bots_manage_fill_mode", 0);
setdvar("bots_manage_fill", 0); setdvar("bots_manage_fill", 0);
setdvar("bots_manage_add", 0); setdvar("bots_manage_add", 0);
setdvar("bots_manage_fill_kick", 1); setdvar("bots_manage_fill_kick", 1);
setDvar("bots_manage_fill_spec", 1);
if (getDvar("bots_main_debug_distance") == "") if (getDvar("bots_main_debug_distance") == "")
setDvar("bots_main_debug_distance", 512.0); setDvar("bots_main_debug_distance", 512.0);