diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp index 70686347..de11571a 100644 --- a/src/backend/backend.cpp +++ b/src/backend/backend.cpp @@ -36,7 +36,7 @@ namespace big { looped::system_self_globals(); looped::system_update_pointers(); - looped::system_desync_kick_protection(); + looped::system_update_desync_kick(); looped::system_spoofing(); looped::system_mission_creator(); diff --git a/src/backend/commands/player/kick/complaint_kick.cpp b/src/backend/commands/player/kick/complaint_kick.cpp index 98ba23bd..d3c7678f 100644 --- a/src/backend/commands/player/kick/complaint_kick.cpp +++ b/src/backend/commands/player/kick/complaint_kick.cpp @@ -27,7 +27,7 @@ namespace big return; } - g_player_service->m_player_to_use_complaint_kick = player; + player->trigger_desync_kick = true; } }; diff --git a/src/backend/commands/player/kick/end_session_kick.cpp b/src/backend/commands/player/kick/end_session_kick.cpp index de269eff..83d41436 100644 --- a/src/backend/commands/player/kick/end_session_kick.cpp +++ b/src/backend/commands/player/kick/end_session_kick.cpp @@ -25,12 +25,12 @@ namespace big return; } - g_player_service->m_player_to_use_end_session_kick = player; + player->trigger_end_session_kick = true; *scr_globals::gsbd.as() = (int)(__rdtsc() % 50000) + 6; // making the game trigger the broadcast is a bit difficult and requires a little bit of tampering with the value and some luck script::get_current()->yield(5s); *scr_globals::gsbd.as() = 4; } }; - end_session_kick g_end_session_kick("endkick", "END_KICK", "END_KICK_DESC", 0, false); + end_session_kick g_end_session_kick("endkick", "END_KICK", "END_KICK_DESC", 0); } diff --git a/src/backend/commands/player/toxic/kick_from_interior.cpp b/src/backend/commands/player/toxic/kick_from_interior.cpp index 5a18af47..efb3c2cf 100644 --- a/src/backend/commands/player/toxic/kick_from_interior.cpp +++ b/src/backend/commands/player/toxic/kick_from_interior.cpp @@ -23,14 +23,14 @@ namespace big if (scr_globals::gpbd_fm_1.as()->Entries[player->id()].PropertyData.Index != -1) { auto cxn = g_script_connection_service->create_connection("am_mp_property_int", player); - cxn->set_host_broadcast_size(1359); - cxn->set_player_broadcast_size(1185); + cxn->set_host_broadcast_size(1317); + // cxn->set_player_broadcast_size(1185); cxn->set_no_remote_start(true); cxn->set_wait_for_host_broadcast_data(true); cxn->set_quick_cleanup(true); cxn->set_debug_logging(true); cxn->set_broadcast_modify_callback([](rage::scrThread* thread, uint64_t* server_vars, uint64_t* client_vars) { - server_vars[718] = 1; + server_vars[677] = 1; // this changes every update }); g_fiber_pool->queue_job([cxn] { diff --git a/src/backend/commands/player/toxic/send_sext.cpp b/src/backend/commands/player/toxic/send_sext.cpp index 1a85714e..9ad75ec9 100644 --- a/src/backend/commands/player/toxic/send_sext.cpp +++ b/src/backend/commands/player/toxic/send_sext.cpp @@ -25,7 +25,7 @@ namespace big const size_t arg_count = 9; int64_t args[arg_count] = {(int64_t)eRemoteEvent::SendTextLabelSMS, self::id, 1 << player->id()}; - strcpy((char*)&args[2], + strcpy((char*)&args[3], (std::string("SXT_") + strippers[rand() % strippers.size()] + "_" + sext_types[rand() % sext_types.size()]) .data()); g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::SendTextLabelSMS); diff --git a/src/backend/commands/player/toxic/start_script.cpp b/src/backend/commands/player/toxic/start_script.cpp index b926cc92..e8466e37 100644 --- a/src/backend/commands/player/toxic/start_script.cpp +++ b/src/backend/commands/player/toxic/start_script.cpp @@ -20,7 +20,7 @@ namespace big virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override { - const int arg_count = 26; + const size_t arg_count = 27; int64_t args[arg_count] = {(int64_t)eRemoteEvent::StartScriptBegin, (int64_t)self::id, 1 << player->id()}; args[3] = scriptId; @@ -34,7 +34,7 @@ namespace big for (int i = 0; i < 2; i++) { - const int arg_count_2 = 26; + const size_t arg_count_2 = 27; int64_t args_2[arg_count_2] = {(int64_t)eRemoteEvent::StartScriptProceed, (int64_t)self::id, 1 << player->id()}; args_2[3 + 17] = 1337; g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id(), (int)eRemoteEvent::StartScriptProceed); @@ -52,6 +52,6 @@ namespace big start_script<230> g_start_badlands("badlands", "BACKEND_START_SCRIPT_START_BADLANDS_REVENGE_II", "BACKEND_START_SCRIPT_START_BADLANDS_REVENGE_II_DESC", 0); start_script<235> g_start_space_monkey("spacemonkey", "BACKEND_START_SCRIPT_START_SPACE_MONKEY", "BACKEND_START_SCRIPT_START_SPACE_MONKEY_DESC", 0); start_script<231> g_start_wizards_ruin("wizard", "BACKEND_START_SCRIPT_START_WIZARD", "BACKEND_START_SCRIPT_START_WIZARD_DESC", 0); - start_script<236> g_start_qub3d("qub3d", "BACKEND_START_SCRIPT_START_QUB3D", "BACKEND_START_SCRIPT_START_QUB3D_DESC", 0); // puzzle? + start_script<236> g_start_qub3d("qub3d", "BACKEND_START_SCRIPT_START_QUB3D", "BACKEND_START_SCRIPT_START_QUB3D_DESC", 0); // puzzle start_script<237> g_start_camhedz("camhedz", "BACKEND_START_SCRIPT_START_CAMHEDZ", "BACKEND_START_SCRIPT_START_CAMHEDZ_DESC", 0); } \ No newline at end of file diff --git a/src/backend/looped/looped.hpp b/src/backend/looped/looped.hpp index 7543d267..d88fc60f 100644 --- a/src/backend/looped/looped.hpp +++ b/src/backend/looped/looped.hpp @@ -38,7 +38,7 @@ namespace big static void system_self_globals(); static void system_update_pointers(); - static void system_desync_kick_protection(); + static void system_update_desync_kick(); static void system_spoofing(); static void system_mission_creator(); diff --git a/src/backend/looped/player/toxic_options.cpp b/src/backend/looped/player/toxic_options.cpp index a432b0d1..2bc1f7c9 100644 --- a/src/backend/looped/player/toxic_options.cpp +++ b/src/backend/looped/player/toxic_options.cpp @@ -40,9 +40,6 @@ namespace big if (entry.second->explosion_loop) toxic::blame_explode_player(entry.second, entry.second, EXP_TAG_SUBMARINE_BIG, 9999.0f, true, false, 9999.0f); - if (entry.second->freeze_loop && entry.second->get_ped()->m_net_object) - g_pointers->m_gta.m_clear_ped_tasks_network(entry.second->get_ped(), true); - if (entry.second->ragdoll_loop && entry.second->get_ped()->m_net_object) g_pointers->m_gta.m_request_ragdoll(entry.second->get_ped()->m_net_object->m_object_id); diff --git a/src/backend/looped/system/desync_kick_protection.cpp b/src/backend/looped/system/desync_kick_protection.cpp deleted file mode 100644 index 30cb3602..00000000 --- a/src/backend/looped/system/desync_kick_protection.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "backend/looped/looped.hpp" -#include "fiber_pool.hpp" -#include "gta_util.hpp" -#include "natives.hpp" -#include "script.hpp" -#include "services/players/player_service.hpp" - -#include - -namespace big -{ - void looped::system_desync_kick_protection() - { - memset(>a_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(uint64_t)); - - if (!g_player_service->m_player_to_use_complaint_kick - || !g_player_service->m_player_to_use_complaint_kick->get()->get_net_data()) - gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0; - else - { - gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 1; - gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained[0] = - g_player_service->m_player_to_use_complaint_kick->get()->get_net_data()->m_host_token; - } - - auto old = gta_util::get_network()->m_game_complaint_mgr.m_host_token; - - if (gta_util::get_network()->m_game_session_state > 3 && gta_util::get_network()->m_game_session_state < 6 - && g_player_service->m_player_to_use_complaint_kick && g_player_service->get_self()->is_valid() - && !g_player_service->get_self()->is_host()) - { - g_pointers->m_gta.m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr); - } - } -} \ No newline at end of file diff --git a/src/backend/looped/system/update_desync_kick.cpp b/src/backend/looped/system/update_desync_kick.cpp new file mode 100644 index 00000000..673ad00f --- /dev/null +++ b/src/backend/looped/system/update_desync_kick.cpp @@ -0,0 +1,33 @@ +#include "backend/looped/looped.hpp" +#include "fiber_pool.hpp" +#include "gta_util.hpp" +#include "natives.hpp" +#include "script.hpp" +#include "services/players/player_service.hpp" + +#include + +namespace big +{ + void looped::system_update_desync_kick() + { + memset(>a_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(uint64_t)); + gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0; + + for (auto& player : g_player_service->players()) + { + if (player.second->is_valid() && player.second->trigger_desync_kick) + { + gta_util::get_network()->m_game_complaint_mgr.raise_complaint(player.second->get_net_data()->m_host_token); + } + } + + + if (gta_util::get_network()->m_game_session_state > 3 && gta_util::get_network()->m_game_session_state < 6 + && gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained && g_player_service->get_self()->is_valid() + && !g_player_service->get_self()->is_host()) + { + g_pointers->m_gta.m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr); + } + } +} \ No newline at end of file diff --git a/src/hooks/misc/serialize_join_request_message.cpp b/src/hooks/misc/serialize_join_request_message.cpp index 5aa1042f..fe5c26f2 100644 --- a/src/hooks/misc/serialize_join_request_message.cpp +++ b/src/hooks/misc/serialize_join_request_message.cpp @@ -9,7 +9,7 @@ namespace big bool hooks::serialize_join_request_message(RemoteGamerInfoMsg* info, void* data, int size, int* bits_serialized) { if (info->unk_0xC0 == 0) - info->unk_0xC0 = 1; + info->unk_0xC0 = 1; // TODO: do we need this anymore? info->m_num_handles = 0; return g_hooking->get_original()(info, data, size, bits_serialized); diff --git a/src/hooks/protections/update_presence_attribute.cpp b/src/hooks/protections/update_presence_attribute.cpp index 1033b2e6..8f4d6d81 100644 --- a/src/hooks/protections/update_presence_attribute.cpp +++ b/src/hooks/protections/update_presence_attribute.cpp @@ -27,12 +27,6 @@ namespace big return true; } - // shouldn't have any side effects - if (hash == "peeraddr"_J) - { - value = (char*)""; - } - return g_hooking->get_original()(presence_data, profile_index, attr, value); } } diff --git a/src/hooks/toxic/broadcast_net_array.cpp b/src/hooks/toxic/broadcast_net_array.cpp index 1ffac0be..a7e8005c 100644 --- a/src/hooks/toxic/broadcast_net_array.cpp +++ b/src/hooks/toxic/broadcast_net_array.cpp @@ -17,8 +17,10 @@ namespace big Player orig_player; int orig_participant; - bool need_to_use_end_session_kick = g_player_service->m_player_to_use_end_session_kick - && target->m_player_id == g_player_service->m_player_to_use_end_session_kick->get()->id() + auto plyr = g_player_service->get_by_id(target->m_player_id); + + bool need_to_use_end_session_kick = plyr && plyr->is_valid() + && plyr->trigger_end_session_kick && _this->m_array == scr_globals::gsbd.as(); bool need_to_modify_wanted_level = g.session.wanted_level_all diff --git a/src/services/players/player.hpp b/src/services/players/player.hpp index f95b3037..cb692631 100644 --- a/src/services/players/player.hpp +++ b/src/services/players/player.hpp @@ -34,9 +34,6 @@ namespace big player& operator=(const player&) = default; player& operator=(player&&) noexcept = default; - float screen_position_x = -1.f; - float screen_position_y = -1.f; - [[nodiscard]] CVehicle* get_current_vehicle() const; [[nodiscard]] const char* get_name() const; [[nodiscard]] rage::rlGamerInfo* get_net_data() const; @@ -64,7 +61,6 @@ namespace big bool kill_loop = false; bool explosion_loop = false; - bool freeze_loop = false; bool ragdoll_loop = false; bool rotate_cam_loop = false; @@ -98,6 +94,9 @@ namespace big bool log_clones = false; bool log_network_events = false; + bool trigger_desync_kick = false; + bool trigger_end_session_kick = false; + int spectating_player = -1; protected: diff --git a/src/services/players/player_service.cpp b/src/services/players/player_service.cpp index 7318a68f..d63ca00d 100644 --- a/src/services/players/player_service.cpp +++ b/src/services/players/player_service.cpp @@ -29,8 +29,6 @@ namespace big void player_service::do_cleanup() { - m_player_to_use_end_session_kick.reset(); - m_player_to_use_complaint_kick.reset(); m_selected_player = m_dummy; m_players.clear(); } @@ -117,12 +115,6 @@ namespace big }); it != m_players.end()) { - if (m_player_to_use_end_session_kick == it->second) - m_player_to_use_end_session_kick = std::nullopt; - - if (m_player_to_use_complaint_kick == it->second) - m_player_to_use_complaint_kick = std::nullopt; - m_players.erase(it); } } diff --git a/src/services/players/player_service.hpp b/src/services/players/player_service.hpp index 931a7b05..65f8b3ba 100644 --- a/src/services/players/player_service.hpp +++ b/src/services/players/player_service.hpp @@ -53,9 +53,6 @@ namespace big } void set_selected(player_ptr plyr); - - std::optional m_player_to_use_end_session_kick = std::nullopt; - std::optional m_player_to_use_complaint_kick = std::nullopt; }; inline player_service* g_player_service{}; diff --git a/src/services/script_patcher/script_patch.hpp b/src/services/script_patcher/script_patch.hpp index e53ff2d2..e577be74 100644 --- a/src/services/script_patcher/script_patch.hpp +++ b/src/services/script_patcher/script_patch.hpp @@ -18,10 +18,11 @@ namespace big static uint8_t* get_code_address(script_data* data, uint32_t index); static const std::optional get_code_location_by_pattern(script_data* data, const memory::pattern& pattern); + + public: void enable(script_data* data); void disable(script_data* data); - public: inline rage::joaat_t get_script() { return m_script; diff --git a/src/util/chat.hpp b/src/util/chat.hpp index aab8328a..46d3b388 100644 --- a/src/util/chat.hpp +++ b/src/util/chat.hpp @@ -123,6 +123,9 @@ namespace big::chat { inline SpamReason is_text_spam(const char* text, player_ptr player) { + if ((player->is_trusted || (g.session.trust_friends && player->is_friend()))) + return SpamReason::NOT_A_SPAMMER; // don't filter messages from friends + if (g.session.use_spam_timer) { if (player->last_message_time.has_value()) diff --git a/src/views/debug/view_debug_misc.cpp b/src/views/debug/view_debug_misc.cpp index d40d80c4..44ce28ca 100644 --- a/src/views/debug/view_debug_misc.cpp +++ b/src/views/debug/view_debug_misc.cpp @@ -83,6 +83,13 @@ namespace big components::button("REMOVE_BLACKSCREEN"_T, [] { CAM::DO_SCREEN_FADE_IN(0); + PLAYER::SET_PLAYER_CONTROL(self::id, true, 0); + ENTITY::FREEZE_ENTITY_POSITION(self::ped, false); + MISC::FORCE_GAME_STATE_PLAYING(); + if (self::veh == 0) + TASK::CLEAR_PED_TASKS_IMMEDIATELY(self::ped); + HUD::DISPLAY_RADAR(true); + HUD::DISPLAY_HUD(true); }); components::button("TP_TO_SAFE_POS"_T, [] { diff --git a/src/views/players/player/player_toxic.cpp b/src/views/players/player/player_toxic.cpp index f7361dbe..b7dcccb4 100644 --- a/src/views/players/player/player_toxic.cpp +++ b/src/views/players/player/player_toxic.cpp @@ -97,8 +97,6 @@ namespace big ImGui::Checkbox("KILL_LOOP"_T.data(), &g_player_service->get_selected()->kill_loop); ImGui::SameLine(); ImGui::Checkbox("EXPLOSION_LOOP"_T.data(), &g_player_service->get_selected()->explosion_loop); - ImGui::SameLine(); - ImGui::Checkbox("FREEZE_LOOP"_T.data(), &g_player_service->get_selected()->freeze_loop); ImGui::Checkbox("RAGDOLL_LOOP"_T.data(), &g_player_service->get_selected()->ragdoll_loop); ImGui::SameLine();