From 28b1224898ac0978dfff1c48998bdbda345a8160 Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 19 Dec 2021 00:25:54 +0100 Subject: [PATCH] feat(Self): Added super run --- BigBaseV2/src/backend/backend.cpp | 1 + BigBaseV2/src/backend/looped/looped.hpp | 1 + .../src/backend/looped/self/super_run.cpp | 53 +++++++++++++++++++ BigBaseV2/src/core/globals.hpp | 3 ++ BigBaseV2/src/gui/window/main/tab_self.cpp | 1 + 5 files changed, 59 insertions(+) create mode 100644 BigBaseV2/src/backend/looped/self/super_run.cpp diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index 3aacc9c9..a19c733f 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -41,6 +41,7 @@ namespace big looped::self_off_radar(); looped::self_police(); looped::self_no_ragdoll(); + looped::self_super_run(); }QUEUE_JOB_END_CLAUSE QUEUE_JOB_BEGIN_CLAUSE() diff --git a/BigBaseV2/src/backend/looped/looped.hpp b/BigBaseV2/src/backend/looped/looped.hpp index 19ab6f81..8a3d435e 100644 --- a/BigBaseV2/src/backend/looped/looped.hpp +++ b/BigBaseV2/src/backend/looped/looped.hpp @@ -21,6 +21,7 @@ namespace big static void self_police(); static void self_noclip(); static void self_no_ragdoll(); + static void self_super_run(); static void system_update_players(); static void system_update_pointers(); diff --git a/BigBaseV2/src/backend/looped/self/super_run.cpp b/BigBaseV2/src/backend/looped/self/super_run.cpp new file mode 100644 index 00000000..a1b10758 --- /dev/null +++ b/BigBaseV2/src/backend/looped/self/super_run.cpp @@ -0,0 +1,53 @@ +#include "backend/looped/looped.hpp" +#include "gta/enums.hpp" +#include "natives.hpp" +#include "util/math.hpp" + +namespace big +{ + static float run_speed = 10.f; + static float run_cap = 100.f; + static bool super_run_state = false; + + void looped::self_super_run() + { + if (g.self.super_run && PAD::IS_CONTROL_PRESSED(0, 21)) + { + if (run_speed < run_cap) run_speed += .5f; + + Ped player = PLAYER::PLAYER_PED_ID(); + + Vector3 pos = ENTITY::GET_ENTITY_COORDS(player, true); + + Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2); + float yaw = math::deg_to_rad(rot.z + 90); + + Vector3 offset; + offset.x = pos.x + (run_speed * cos(yaw)); + offset.y = pos.y + (run_speed * sin(yaw)); + offset.z = pos.z + .2f; + + float groundZ; + MISC::GET_GROUND_Z_FOR_3D_COORD(offset.x, offset.y, 1000.f, &groundZ, false, false); + if (groundZ < pos.z) + offset.z = groundZ; + + Vector3 vel = offset - pos; + + ENTITY::SET_ENTITY_VELOCITY(player, vel.x, vel.y, vel.z); + + g_local_player->m_player_info->m_run_speed = .7f; + } + else if (!g.self.super_run && g.self.super_run != super_run_state) + { + g_local_player->m_player_info->m_run_speed = 1.f; + } + else if (PAD::IS_CONTROL_JUST_RELEASED(0, 21)) + { + run_speed = 10.f; + g_local_player->m_player_info->m_run_speed = 1.f; + } + + super_run_state = g.self.super_run; + } +} \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 6b35c17d..764395cc 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -65,6 +65,7 @@ struct globals { bool never_wanted = false; bool noclip = false; bool no_ragdoll = false; + bool super_run = false; int wanted_level = 0; frame_flags frame_flags{}; @@ -154,6 +155,7 @@ struct globals { this->self.off_radar = j["self"]["off_radar"]; this->self.never_wanted = j["self"]["never_wanted"]; this->self.no_ragdoll = j["self"]["no_ragdoll"]; + this->self.super_run = j["self"]["super_run"]; this->self.frame_flags.explosive_ammo = j["self"]["frame_flags"]["explosive_ammo"]; this->self.frame_flags.explosive_melee = j["self"]["frame_flags"]["explosive_melee"]; @@ -232,6 +234,7 @@ struct globals { { "off_radar", this->self.off_radar }, { "never_wanted", this->self.never_wanted }, { "no_ragdoll", this->self.no_ragdoll }, + { "super_run", this->self.super_run }, { "frame_flags", { diff --git a/BigBaseV2/src/gui/window/main/tab_self.cpp b/BigBaseV2/src/gui/window/main/tab_self.cpp index bfbeedd8..52f3642e 100644 --- a/BigBaseV2/src/gui/window/main/tab_self.cpp +++ b/BigBaseV2/src/gui/window/main/tab_self.cpp @@ -25,6 +25,7 @@ namespace big ImGui::Checkbox("Free Cam", &g.self.free_cam); ImGui::Checkbox("No Clip", &g.self.noclip); ImGui::Checkbox("No Ragdoll", &g.self.no_ragdoll); + ImGui::Checkbox("Super Run", &g.self.super_run); if (ImGui::TreeNode("Frame Flags")) {