Merge pull request #860 from nullworks/totallynotelite

Fix bots getting stuck while respawning
This commit is contained in:
TotallyNotElite 2019-10-26 23:01:24 +02:00 committed by GitHub
commit 6051bb0e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 12 deletions

View File

@ -741,7 +741,8 @@ static void cm()
reportall();
}
static Timer autojointeam{};
static Timer unstuck{};
static int unstucks;
static Timer report_timer2{};
void update()
{
@ -775,9 +776,19 @@ void update()
return;
if (LOCAL_E->m_bAlivePlayer())
autojointeam.update();
if (autojointeam.test_and_set(60000) && !LOCAL_E->m_bAlivePlayer())
hack::command_stack().push("autoteam; join_class sniper");
{
unstuck.update();
unstucks = 0;
}
if (unstuck.test_and_set(10000))
{
unstucks++;
// Send menuclosed to tell the server that we want to respawn
hack::command_stack().push("menuclosed");
// If that didnt work, force pick a team and class
if (unstucks > 3)
hack::command_stack().push("autoteam; join_class sniper");
}
if (micspam)
{

View File

@ -36,18 +36,18 @@ CatCommand join("mm_join", "Join mm Match", []() {
bool replaced = false;
namespace hooked_methods
{
DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, unsigned int panel, bool force, bool allow_force)
DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_, vgui::VPANEL panel, bool force, bool allow_force)
{
if (!isHackActive())
return original::PaintTraverse(this_, panel, force, allow_force);
static bool textures_loaded = false;
static unsigned long panel_scope = 0;
static unsigned long FocusOverlayPanel = 0;
static unsigned long motd_panel = 0;
static unsigned long motd_panel_sd = 0;
static unsigned long health_panel = 0;
static bool call_default = true;
static bool textures_loaded = false;
static vgui::VPANEL panel_scope = 0;
static vgui::VPANEL FocusOverlayPanel = 0;
static vgui::VPANEL motd_panel = 0;
static vgui::VPANEL motd_panel_sd = 0;
static vgui::VPANEL health_panel = 0;
static bool call_default = true;
static bool cur;
static ConVar *software_cursor = g_ICvar->FindVar("cl_software_cursor");
static const char *name;