fix(self): fix auto tp to waypoint (#919)

This commit is contained in:
Johann 2023-01-31 00:19:05 +01:00 committed by GitHub
parent f1c0092956
commit 469850098a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 32 deletions

View File

@ -22,7 +22,6 @@ namespace big
looped::system_desync_kick_protection();
looped::system_spoofing();
looped::system_mission_creator();
looped::system_auto_tp();
for (auto command : g_looped_commands)
if (command->is_enabled())

View File

@ -41,7 +41,6 @@ namespace big
static void system_desync_kick_protection();
static void system_spoofing();
static void system_mission_creator();
static void system_auto_tp();
static void vehicle_auto_drive();
static void vehicle_boost_behavior();

View File

@ -1,28 +0,0 @@
#include "backend/looped/looped.hpp"
#include "fiber_pool.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "pointers.hpp"
namespace big
{
bool bLastAutoTP = false;
void looped::system_auto_tp()
{
bool temp_disable_tp = (!*g_pointers->m_is_session_started) && CUTSCENE::IS_CUTSCENE_ACTIVE();
if ((!g.self.auto_tp || temp_disable_tp) && bLastAutoTP)
{
MISC::USING_MISSION_CREATOR(false);
MISC::ALLOW_MISSION_CREATOR_WARP(false);
}
if (g.self.auto_tp && !temp_disable_tp)
{
MISC::USING_MISSION_CREATOR(true);
MISC::ALLOW_MISSION_CREATOR_WARP(true);
}
bLastAutoTP = g.self.auto_tp;
}
}

View File

@ -0,0 +1,24 @@
#include "natives.hpp"
#include "backend/looped_command.hpp"
#include "util/teleport.hpp"
namespace big
{
class auto_tp_to_waypoint : looped_command
{
using looped_command::looped_command;
virtual void on_tick() override
{
//this is a hack to prevent the warning notify..
if (!teleport::to_blip((int)BlipIcons::Waypoint))
return;
bool temp_disable_tp = (!*g_pointers->m_is_session_started) && CUTSCENE::IS_CUTSCENE_ACTIVE();
if (!temp_disable_tp)
teleport::to_waypoint();
}
};
auto_tp_to_waypoint g_auto_tp_to_waypoint("autotptowp", "Auto-Teleport To Waypoint", "Automatically teleports you to a waypoint as soon as you set one.", g.self.auto_tp);
}

View File

@ -14,8 +14,7 @@ namespace big
components::command_button<"waypointtp">({}, "Waypoint");
ImGui::SameLine();
components::command_button<"objectivetp">({}, "Objective");
ImGui::Checkbox("Auto-Teleport To Waypoint", &g.self.auto_tp);
components::command_checkbox<"autotptowp">();
ImGui::Text("Vehicles:");
components::command_button<"lastvehtp">();