Allow Friends Into Locked Lobby (#1747)

This commit is contained in:
Rxann 2023-07-18 04:42:14 -04:00 committed by GitHub
parent d3b3e57899
commit 9755f4f960
3 changed files with 37 additions and 20 deletions

View File

@ -360,17 +360,18 @@ namespace big
struct session
{
bool log_chat_messages = false;
bool log_text_messages = false;
bool decloak_players = false;
bool unhide_players_from_player_list = true;
bool force_session_host = false;
bool force_script_host = false;
bool player_magnet_enabled = false;
int player_magnet_count = 32;
bool is_team = false;
bool join_in_sctv_slots = false;
bool lock_session = false;
bool log_chat_messages = false;
bool log_text_messages = false;
bool decloak_players = false;
bool unhide_players_from_player_list = true;
bool force_session_host = false;
bool force_script_host = false;
bool player_magnet_enabled = false;
int player_magnet_count = 32;
bool is_team = false;
bool join_in_sctv_slots = false;
bool lock_session = false;
bool allow_friends_into_locked_session = false;
const char chat_command_prefix = '/';
const char chat_output_prefix = '>';
@ -410,7 +411,7 @@ namespace big
bool fast_join = false;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(session, log_chat_messages, log_text_messages, decloak_players, force_session_host, force_script_host, player_magnet_enabled, player_magnet_count, is_team, join_in_sctv_slots, kick_chat_spammers, 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, send_to_apartment_idx, send_to_warehouse_idx, chat_commands, chat_command_default_access_level, show_cheating_message, anonymous_bounty, lock_session, fast_join, unhide_players_from_player_list)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(session, log_chat_messages, log_text_messages, decloak_players, force_session_host, force_script_host, player_magnet_enabled, player_magnet_count, is_team, join_in_sctv_slots, kick_chat_spammers, 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, send_to_apartment_idx, send_to_warehouse_idx, chat_commands, chat_command_default_access_level, show_cheating_message, anonymous_bounty, lock_session, fast_join, unhide_players_from_player_list, allow_friends_into_locked_session)
} session{};
struct settings
@ -419,9 +420,9 @@ namespace big
struct rainbow
{
bool fade = false;
bool fade = false;
bool spasm = false;
int speed = 1;
int speed = 1;
} rainbow{};
struct hotkeys
@ -722,8 +723,8 @@ namespace big
struct paintgun
{
bool rainbow = false;
float col[4] = {0.f, 0.f, 1.f, 1.f};
bool rainbow = false;
float col[4] = {0.f, 0.f, 1.f, 1.f};
NLOHMANN_DEFINE_TYPE_INTRUSIVE(paintgun, rainbow, col)
} paintgun{};

View File

@ -128,9 +128,18 @@ namespace big
if (g.session.lock_session && g_player_service->get_self()->is_host())
{
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(plyr, {});
g_notification_service->push_warning("Lock Session",
std::format("A player with the name of {} has been denied entry", plyr->get_net_data()->m_name));
if (plyr->is_friend() && g.session.allow_friends_into_locked_session)
{
g_notification_service->push_success("Lock Session",
std::format("A friend with the name of {} has been allowed to join the locked session",
plyr->get_net_data()->m_name));
}
else
{
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(plyr, {});
g_notification_service->push_warning("Lock Session",
std::format("A player with the name of {} has been denied entry", plyr->get_net_data()->m_name));
}
}
if (is_spoofed_host_token(plyr->get_net_data()->m_host_token))

View File

@ -116,10 +116,17 @@ namespace big
ImGui::BeginDisabled(!g_player_service->get_self()->is_host());
ImGui::Checkbox("Lobby Lock", &g.session.lock_session);
if (ImGui::Checkbox("Lobby Lock", &g.session.lock_session))
{
ImGui::Checkbox("Allow Friends Into Locked Lobby", &g.session.allow_friends_into_locked_session);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Allows Friends to Join Lobby While Locked");
}
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Blocks all players from joining. May not work on some modders.");
ImGui::EndDisabled();
components::script_patch_checkbox("REVEAL_OTR_PLAYERS"_T, &g.session.decloak_players, "Reveals players that are off the radar");