host func

This commit is contained in:
Your Name 2020-09-07 14:52:40 -06:00
parent b94d247135
commit 1cf3e43a78
3 changed files with 35 additions and 0 deletions

View File

@ -10,6 +10,12 @@ init()
{
level.bw_VERSION = "1.0.0";
if(getDvar("bots_main") == "")
setDvar("bots_main", true);
if (!getDvarInt("bots_main"))
return;
thread load_waypoints();
cac_init_patch();
thread hook_callbacks();
@ -278,6 +284,9 @@ connected()
{
self endon("disconnect");
if (!isDefined(self.pers["bot_host"]))
self thread doHostCheck();
if(!self is_bot())
return;
@ -297,6 +306,8 @@ connected()
self thread maps\mp\bots\_bot_internal::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\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.
*/

View File

@ -4,6 +4,12 @@
init()
{
if(getDvar("bots_main_debug") == "")
setDvar("bots_main_debug", 0);
if(!getDVarint("bots_main_debug"))
return;
if(!getDVarint("developer"))
{
setdvar("developer_script", 1);
@ -12,6 +18,14 @@ init()
setdvar("sv_mapRotation", "map "+getDvar("mapname"));
exitLevel(false);
}
setDvar("bots_main", 0);
setdvar("bots_main_menu", 0);
setdvar("bots_manage_fill_mode", 0);
setdvar("bots_manage_fill", 0);
setdvar("bots_manage_add", 0);
setdvar("bots_manage_fill_kick", 1);
setDvar("bots_manage_fill_spec", 1);
if (getDvar("bots_main_debug_distance") == "")
setDvar("bots_main_debug_distance", 512.0);