diff --git a/src/backend/looped/session/auto_kick_host.cpp b/src/backend/looped/session/auto_kick_host.cpp index ffb190c3..87d82853 100644 --- a/src/backend/looped/session/auto_kick_host.cpp +++ b/src/backend/looped/session/auto_kick_host.cpp @@ -8,13 +8,14 @@ namespace big static bool bLastKickHost = false; void looped::session_auto_kick_host() { - bool kick_host = false; // *g_pointers->m_gta.m_is_session_started && g.session.force_session_host && g.session.kick_host_when_forcing_host; + bool kick_host = *g_pointers->m_gta.m_is_session_started && g.session.spoof_host_token_type != 0 && g.session.kick_host_when_forcing_host; if (kick_host && !bLastKickHost) [[unlikely]] { g_player_service->iterate([](auto& plyr) { // Don't kick trusted players - if (plyr.second->is_trusted || (g.session.trust_friends && plyr.second->is_friend())) - return; + if (plyr.second->is_trusted || (g.session.trust_friends && plyr.second->is_friend()) + || (plyr.second->is_modder && g.session.exclude_modders_from_kick_host)) + return; if (plyr.second->is_host()) { diff --git a/src/core/settings.hpp b/src/core/settings.hpp index 4ba3506c..3936ce50 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -446,6 +446,7 @@ namespace big CommandAccessLevel chat_command_default_access_level = CommandAccessLevel::FRIENDLY; bool kick_host_when_forcing_host = false; + bool exclude_modders_from_kick_host = false; bool explosion_karma = false; bool damage_karma = false; @@ -495,7 +496,7 @@ namespace big NLOHMANN_DEFINE_TYPE_INTRUSIVE(chat_translator, enabled, print_result, draw_result, bypass_same_language, target_language, endpoint); } chat_translator{}; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(session, log_chat_messages, log_text_messages, decloak_players, spoof_host_token_type, custom_host_token, hide_token_spoofing_when_host, force_script_host, player_magnet_enabled, player_magnet_count, is_team, join_in_sctv_slots, kick_host_when_forcing_host, explosion_karma, damage_karma, disable_traffic, disable_peds, force_thunder, block_ceo_money, randomize_ceo_colors, block_jobs, block_muggers, block_ceo_raids, block_ceo_creation, send_to_apartment_idx, send_to_warehouse_idx, chat_commands, chat_command_default_access_level, anonymous_bounty, lock_session, fast_join, unhide_players_from_player_list, allow_friends_into_locked_session, trust_friends, use_spam_timer, spam_timer, spam_length, chat_translator, script_block_opts) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(session, log_chat_messages, log_text_messages, decloak_players, spoof_host_token_type, custom_host_token, hide_token_spoofing_when_host, force_script_host, player_magnet_enabled, player_magnet_count, is_team, join_in_sctv_slots, kick_host_when_forcing_host, exclude_modders_from_kick_host, explosion_karma, damage_karma, disable_traffic, disable_peds, force_thunder, block_ceo_money, randomize_ceo_colors, block_jobs, block_muggers, block_ceo_raids, block_ceo_creation, send_to_apartment_idx, send_to_warehouse_idx, chat_commands, chat_command_default_access_level, anonymous_bounty, lock_session, fast_join, unhide_players_from_player_list, allow_friends_into_locked_session, trust_friends, use_spam_timer, spam_timer, spam_length, chat_translator, script_block_opts) } session{}; struct settings diff --git a/src/services/player_database/player_database_service.cpp b/src/services/player_database/player_database_service.cpp index ed1b780b..1c411488 100644 --- a/src/services/player_database/player_database_service.cpp +++ b/src/services/player_database/player_database_service.cpp @@ -323,18 +323,14 @@ namespace big first_time = false; } - static auto last_update = std::chrono::high_resolution_clock::now() - 45s; - while (g_running && g.player_db.update_player_online_states) { - const auto cur = std::chrono::high_resolution_clock::now(); - if (cur - last_update > 45s && !updating) + if (!updating) { updating = true; g_fiber_pool->queue_job([this] { update_player_states(true); updating = false; - last_update = std::chrono::high_resolution_clock::now(); }); } diff --git a/src/views/network/view_controls.cpp b/src/views/network/view_controls.cpp index ca6e5817..39c4f762 100644 --- a/src/views/network/view_controls.cpp +++ b/src/views/network/view_controls.cpp @@ -171,11 +171,18 @@ namespace big ImGui::EndDisabled(); - //if (g.session.force_session_host) - //{ - // ImGui::SameLine(); - // ImGui::Checkbox("KICK_HOST_ON_JOIN"_T.data(), &g.session.kick_host_when_forcing_host); - //} + if (g.session.spoof_host_token_type != 0) + { + ImGui::Checkbox("KICK_HOST_ON_JOIN"_T.data(), &g.session.kick_host_when_forcing_host); + + if (g.session.kick_host_when_forcing_host) + { + ImGui::SameLine(); + ImGui::Checkbox("EXCLUDE_MODDERS_FROM_KICK_HOST"_T.data(), &g.session.exclude_modders_from_kick_host); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("EXCLUDE_MODDERS_FROM_KICK_HOST_DESC"_T.data()); + } + } ImGui::Checkbox("FORCE_SCRIPT_HOST"_T.data(), &g.session.force_script_host); if (ImGui::IsItemHovered())