From 17e79dbaaaa30e2f5f6890b54d03909422258a49 Mon Sep 17 00:00:00 2001 From: Rxann <80224521+Rxann@users.noreply.github.com> Date: Mon, 24 Jul 2023 16:10:44 -0400 Subject: [PATCH] Added Empty lobby button (#1812) --- src/backend/commands/session/wipe_session.cpp | 21 +++++++++++++++++++ src/hooks/protections/receive_net_message.cpp | 3 ++- src/views/network/view_network.cpp | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/backend/commands/session/wipe_session.cpp diff --git a/src/backend/commands/session/wipe_session.cpp b/src/backend/commands/session/wipe_session.cpp new file mode 100644 index 00000000..7b5c2454 --- /dev/null +++ b/src/backend/commands/session/wipe_session.cpp @@ -0,0 +1,21 @@ +#include "backend/player_command.hpp" +#include "network/CNetworkPlayerMgr.hpp" +#include "pointers.hpp" +#include "services/players/player_service.hpp" + +namespace big +{ + class empty_session : command + { + using command::command; + virtual void execute(const std::vector&, const std::shared_ptr ctx) + { + g_player_service->iterate([](const player_entry& player) { + auto mgr = *g_pointers->m_gta.m_network_player_mgr; + mgr->RemovePlayer(player.second->get_net_game_player()); + }); + g_notification_service->push_success("Empty Session", "Completed"); + } + }; + empty_session g_empty_session("emptysession", "Remove All Players From Session", "Removes everyone from the session", 0); +} \ No newline at end of file diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 8f93b862..7152e43a 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -15,6 +15,7 @@ #include #include + inline void gamer_handle_deserialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf) { constexpr int PC_PLATFORM = 3; @@ -121,7 +122,7 @@ namespace big dynamic_cast(command::get(RAGE_JOAAT("breakup")))->call(player, {}), dynamic_cast(command::get(RAGE_JOAAT("hostkick")))->call(player, {}); - dynamic_cast(command::get(RAGE_JOAAT("bailkick")))->call(player, {}); + dynamic_cast(command::get(RAGE_JOAAT("endkick")))->call(player, {}); dynamic_cast(command::get(RAGE_JOAAT("nfkick")))->call(player, {}); } return true; diff --git a/src/views/network/view_network.cpp b/src/views/network/view_network.cpp index aca22c47..9b48cc05 100644 --- a/src/views/network/view_network.cpp +++ b/src/views/network/view_network.cpp @@ -479,6 +479,7 @@ namespace big }, true, "Teleport"); + components::command_button<"emptysession">({}, "Empty Session"); components::sub_title("SCRIPT_HOST_FEATURES"_T); ImGui::Checkbox("DISABLE_CEO_MONEY"_T.data(), &g.session.block_ceo_money);