From 05f591fb9c9fdc114b98f2f92b801fc732786793 Mon Sep 17 00:00:00 2001 From: Yimura Date: Fri, 21 May 2021 00:52:59 +0200 Subject: [PATCH] feat(Self): Added no ragdoll --- BigBaseV2/src/backend/backend.cpp | 1 + BigBaseV2/src/backend/looped/looped.hpp | 1 + .../src/backend/looped/self/no_ragdoll.cpp | 21 +++++++++++++++++++ BigBaseV2/src/core/globals.hpp | 6 +++++- BigBaseV2/src/gui/window/main/tab_self.cpp | 1 + 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 BigBaseV2/src/backend/looped/self/no_ragdoll.cpp diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index ff06b3d1..02634cca 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -12,6 +12,7 @@ namespace big QUEUE_JOB_BEGIN_CLAUSE() { looped::self_godmode(); + looped::self_no_ragdoll(); }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 28bf50e2..bf95ac82 100644 --- a/BigBaseV2/src/backend/looped/looped.hpp +++ b/BigBaseV2/src/backend/looped/looped.hpp @@ -7,6 +7,7 @@ namespace big public: static void self_godmode(); static void self_noclip(); + static void self_no_ragdoll(); static void weapons_cage_gun(); static void weapons_delete_gun(); diff --git a/BigBaseV2/src/backend/looped/self/no_ragdoll.cpp b/BigBaseV2/src/backend/looped/self/no_ragdoll.cpp new file mode 100644 index 00000000..0d8a5fe1 --- /dev/null +++ b/BigBaseV2/src/backend/looped/self/no_ragdoll.cpp @@ -0,0 +1,21 @@ +#include "backend/looped/looped.hpp" +#include "natives.hpp" + +namespace big +{ + static bool bLastNoRagdoll = false; + + void looped::self_no_ragdoll() + { + bool bNoRagdoll = g.self.no_ragdoll; + Ped player = PLAYER::PLAYER_PED_ID(); + + if ((bNoRagdoll && PED::IS_PED_RUNNING_RAGDOLL_TASK(player)) || (!bNoRagdoll && bNoRagdoll != bLastNoRagdoll)) + { + if (ENTITY::GET_ENTITY_HEIGHT_ABOVE_GROUND(player) < 1.0) + TASK::CLEAR_PED_TASKS_IMMEDIATELY(player); + + bLastNoRagdoll = bNoRagdoll; + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index a297aa0c..234de1ce 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -12,6 +12,7 @@ struct globals { struct self { bool godmode = false; bool noclip = false; + bool no_ragdoll = false; }; struct vehicle { @@ -31,6 +32,7 @@ struct globals { void from_json(const nlohmann::json& j) { this->self.godmode = j["self"]["godmode"]; + this->self.no_ragdoll = j["self"]["no_ragdoll"]; this->vehicle.horn_boost = j["vehicle"]["horn_boost"]; this->vehicle.speedo_meter = (SpeedoMeter)j["vehicle"]["speedo_meter"]; @@ -43,7 +45,8 @@ struct globals { return nlohmann::json{ { "self", { - { "godmode", this->self.godmode } + { "godmode", this->self.godmode }, + { "no_ragdoll", this->self.no_ragdoll } } }, { @@ -110,6 +113,7 @@ struct globals { return true; } +private: bool save() { std::string settings_file = std::getenv("appdata"); diff --git a/BigBaseV2/src/gui/window/main/tab_self.cpp b/BigBaseV2/src/gui/window/main/tab_self.cpp index ca2a8c38..aea1e4f7 100644 --- a/BigBaseV2/src/gui/window/main/tab_self.cpp +++ b/BigBaseV2/src/gui/window/main/tab_self.cpp @@ -8,6 +8,7 @@ namespace big { ImGui::Checkbox("God Mode", &g.self.godmode); ImGui::Checkbox("No Clip", &g.self.noclip); + ImGui::Checkbox("No Ragdoll", &g.self.no_ragdoll); ImGui::EndTabItem(); }