From 9503ab4fdb417154b5282292560ba0d1b0d7f9b3 Mon Sep 17 00:00:00 2001 From: Maddy <59680197+xM4ddy@users.noreply.github.com> Date: Tue, 8 Mar 2022 13:26:28 -0500 Subject: [PATCH] feat: remote clear wanted level and remote never wanted (#93) --- BigBaseV2/src/backend/backend.cpp | 1 + BigBaseV2/src/backend/looped/looped.hpp | 1 + .../backend/looped/player/player_never_wanted.cpp | 14 ++++++++++++++ BigBaseV2/src/core/globals.hpp | 1 + BigBaseV2/src/util/toxic.hpp | 14 +++++++++++++- BigBaseV2/src/views/view_player.cpp | 13 +++++++++++++ 6 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 BigBaseV2/src/backend/looped/player/player_never_wanted.cpp diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index c74e4717..bee14c71 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -47,6 +47,7 @@ namespace big QUEUE_JOB_BEGIN_CLAUSE() { + looped::player_never_wanted(); looped::player_specate(); }QUEUE_JOB_END_CLAUSE diff --git a/BigBaseV2/src/backend/looped/looped.hpp b/BigBaseV2/src/backend/looped/looped.hpp index 24d524cf..b29c1682 100644 --- a/BigBaseV2/src/backend/looped/looped.hpp +++ b/BigBaseV2/src/backend/looped/looped.hpp @@ -10,6 +10,7 @@ namespace big static void tunables_disable_phone(); static void tunables_no_idle_kick(); + static void player_never_wanted(); static void player_specate(); static void protections_replay_interface(); diff --git a/BigBaseV2/src/backend/looped/player/player_never_wanted.cpp b/BigBaseV2/src/backend/looped/player/player_never_wanted.cpp new file mode 100644 index 00000000..8b952159 --- /dev/null +++ b/BigBaseV2/src/backend/looped/player/player_never_wanted.cpp @@ -0,0 +1,14 @@ +#include "backend/looped/looped.hpp" +#include "services/player_service.hpp" +#include "util/toxic.hpp" + +namespace big +{ + void looped::player_never_wanted() + { + if (g->player.player_never_wanted && g_player_service->get_selected()->is_valid()) + { + toxic::clear_wanted_player(g_player_service->get_selected()->id()); + } + } +} diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index f46bc3a4..24158532 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -23,6 +23,7 @@ namespace big struct player { int character_slot = 1; + bool player_never_wanted = false; int set_level = 130; bool spectating = false; }; diff --git a/BigBaseV2/src/util/toxic.hpp b/BigBaseV2/src/util/toxic.hpp index d416ca4d..599cfa47 100644 --- a/BigBaseV2/src/util/toxic.hpp +++ b/BigBaseV2/src/util/toxic.hpp @@ -44,4 +44,16 @@ namespace big::toxic g_pointers->m_trigger_script_event(1, args, arg_count, -1); } -} \ No newline at end of file + + inline void clear_wanted_player(Player target) + { + constexpr size_t arg_count = 3; + int64_t args[arg_count] = { + (int)eRemoteEvent::ClearWantedLevel, + 0, + *script_global(1893548).at(target, 600).at(511).as() + }; + + g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target); + } +} diff --git a/BigBaseV2/src/views/view_player.cpp b/BigBaseV2/src/views/view_player.cpp index 156ac22f..ff4ecf93 100644 --- a/BigBaseV2/src/views/view_player.cpp +++ b/BigBaseV2/src/views/view_player.cpp @@ -14,6 +14,19 @@ namespace big ImGui::Text(title.c_str()); ImGui::Checkbox("Spectate", &g->player.spectating); + + if (ImGui::TreeNode("Misc")) { + + components::button("Clear Wanted Level", [] { + toxic::clear_wanted_player(g_player_service->get_selected()->id()); + }); + + ImGui::SameLine(); + + ImGui::Checkbox("Never Wanted", &g->player.player_never_wanted); + + ImGui::TreePop(); + } if (g_player_service->get_selected()->is_valid()) {