diff --git a/src/backend/commands/player/kick/breakup_kick.cpp b/src/backend/commands/player/kick/breakup_kick.cpp index 087680e9..bf840fcc 100644 --- a/src/backend/commands/player/kick/breakup_kick.cpp +++ b/src/backend/commands/player/kick/breakup_kick.cpp @@ -20,7 +20,7 @@ namespace big virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override { - if (!player || !g_player_service->get_self()->is_host() || !player->get_net_data()) + if (!player || !g_player_service->get_self()->is_host() || !player->get_net_data() || !player->is_valid()) return; rage::snMsgRemoveGamersFromSessionCmd cmd{}; diff --git a/src/backend/commands/player/kick/end_session_kick.cpp b/src/backend/commands/player/kick/end_session_kick.cpp index 83d41436..42f7787e 100644 --- a/src/backend/commands/player/kick/end_session_kick.cpp +++ b/src/backend/commands/player/kick/end_session_kick.cpp @@ -17,7 +17,7 @@ namespace big virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override { - if (!player) + if (!player || !player->is_valid()) return; if (!scripts::force_host("freemode"_J)) { diff --git a/src/backend/commands/player/kick/host_kick.cpp b/src/backend/commands/player/kick/host_kick.cpp index 281aecdd..ea21874d 100644 --- a/src/backend/commands/player/kick/host_kick.cpp +++ b/src/backend/commands/player/kick/host_kick.cpp @@ -14,7 +14,7 @@ namespace big virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override { - if (!player) + if (!player || !player->is_valid()) return; if (!g_player_service->get_self()->is_host()) { diff --git a/src/backend/commands/player/kick/oom_kick.cpp b/src/backend/commands/player/kick/oom_kick.cpp index 79a17624..2d2f5ba3 100644 --- a/src/backend/commands/player/kick/oom_kick.cpp +++ b/src/backend/commands/player/kick/oom_kick.cpp @@ -20,7 +20,7 @@ namespace big virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override { - if (!player) + if (!player || !player->is_valid()) return; packet msg{}; diff --git a/src/backend/commands/player/kick/script_host_kick.cpp b/src/backend/commands/player/kick/script_host_kick.cpp index b6dbc96f..798ad708 100644 --- a/src/backend/commands/player/kick/script_host_kick.cpp +++ b/src/backend/commands/player/kick/script_host_kick.cpp @@ -17,7 +17,7 @@ namespace big virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override { - if (!player) + if (!player || !player->is_valid()) return; if (!scripts::force_host("freemode"_J)) { diff --git a/src/backend/commands/player/kick/multi_kick.cpp b/src/backend/commands/player/kick/smart_kick.cpp similarity index 53% rename from src/backend/commands/player/kick/multi_kick.cpp rename to src/backend/commands/player/kick/smart_kick.cpp index 1d466fba..982a59b6 100644 --- a/src/backend/commands/player/kick/multi_kick.cpp +++ b/src/backend/commands/player/kick/smart_kick.cpp @@ -6,7 +6,7 @@ namespace big { - class multi_kick : player_command + class smart_kick : player_command { using player_command::player_command; @@ -18,17 +18,18 @@ namespace big virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override { if (g_player_service->get_self()->is_host()) - dynamic_cast(command::get("breakup"_J))->call(player, {}), - dynamic_cast(command::get("hostkick"_J))->call(player, {}); - - dynamic_cast(command::get("oomkick"_J))->call(player, {}); - script::get_current()->yield(700ms); - - - if (player && !g_player_service->get_self()->is_host() && player->is_valid() && !player->is_host()) - dynamic_cast(command::get("desync"_J))->call(player, {}); + { + dynamic_cast(command::get("breakup"_J))->call(player, {}); + } + else + { + if (player->is_host()) + dynamic_cast(command::get("oomkick"_J))->call(player, {}); + else + dynamic_cast(command::get("desync"_J))->call(player, {}); + } } }; - multi_kick g_multi_kick("multikick", "MULTI_KICK", "MULTI_KICK_DESC", 0, false); + smart_kick g_smart_kick("smartkick", "SMART_KICK", "SMART_KICK_DESC", 0, false); } diff --git a/src/backend/looped/session/auto_kick_host.cpp b/src/backend/looped/session/auto_kick_host.cpp index 885606ed..9721ee7a 100644 --- a/src/backend/looped/session/auto_kick_host.cpp +++ b/src/backend/looped/session/auto_kick_host.cpp @@ -18,7 +18,7 @@ namespace big if (plyr.second->is_host()) { - dynamic_cast(command::get("multikick"_J))->call(plyr.second, {}); + dynamic_cast(command::get("smartkick"_J))->call(plyr.second, {}); } }); } diff --git a/src/backend/reactions/reaction.cpp b/src/backend/reactions/reaction.cpp index 160e6592..2199ad48 100644 --- a/src/backend/reactions/reaction.cpp +++ b/src/backend/reactions/reaction.cpp @@ -33,7 +33,7 @@ namespace big if (kick) { g_fiber_pool->queue_job([player] { - dynamic_cast(command::get("multikick"_J))->call(player, {}); + dynamic_cast(command::get("smartkick"_J))->call(player, {}); }); } diff --git a/src/hooks/player_management/assign_physical_index.cpp b/src/hooks/player_management/assign_physical_index.cpp index e5afe5e8..0c46342b 100644 --- a/src/hooks/player_management/assign_physical_index.cpp +++ b/src/hooks/player_management/assign_physical_index.cpp @@ -136,7 +136,7 @@ namespace big } else { - dynamic_cast(command::get("multikick"_J))->call(plyr, {}); + dynamic_cast(command::get("smartkick"_J))->call(plyr, {}); g_notification_service.push_warning("LOBBY_LOCK"_T.data(), std::vformat("LOBBY_LOCK_DENIED"_T.data(), std::make_format_args(plyr->get_net_data()->m_name))); } diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index b498c9fe..0ac9edb0 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -129,7 +129,7 @@ namespace big if (g.session.kick_chat_spammers && !(player->is_trusted || (player->is_friend() && g.session.trust_friends) || g.session.trust_session)) { - dynamic_cast(command::get("multikick"_J))->call(player, {}); + dynamic_cast(command::get("smartkick"_J))->call(player, {}); } return true; } diff --git a/src/services/context_menu/context_menu_service.hpp b/src/services/context_menu/context_menu_service.hpp index 9cbb00dd..392c2112 100644 --- a/src/services/context_menu/context_menu_service.hpp +++ b/src/services/context_menu/context_menu_service.hpp @@ -204,7 +204,7 @@ namespace big }}, {"KICK", [this] { - static player_command* command = dynamic_cast(command::get("multikick"_J)); + static player_command* command = dynamic_cast(command::get("smartkick"_J)); command->call(ped::get_player_from_ped(m_handle), {}); script::get_current()->yield(500ms); }}, diff --git a/src/views/players/player/player_kick.cpp b/src/views/players/player/player_kick.cpp index ebbf506b..53e362c8 100644 --- a/src/views/players/player/player_kick.cpp +++ b/src/views/players/player/player_kick.cpp @@ -27,7 +27,7 @@ namespace big ImGui::SameLine(); components::command_checkbox<"breakupcheating">(); - components::player_command_button<"multikick">(g_player_service->get_selected()); + components::player_command_button<"smartkick">(g_player_service->get_selected()); ImGui::SameLine(); components::player_command_button<"oomkick">(g_player_service->get_selected());