Chat spam to reaction (#3192)
This commit is contained in:
parent
fd939c48cb
commit
78b4302721
@ -25,5 +25,6 @@ namespace big
|
||||
UNDEAD_OTR,
|
||||
// So that lua scripts can add a custom runtime reason.
|
||||
CUSTOM_REASON,
|
||||
CHAT_SPAM,
|
||||
};
|
||||
}
|
@ -225,9 +225,10 @@ namespace big
|
||||
reaction request_control_event{"Request Control Event", "REACTION_REQUEST_CONTROL_NOTIFY", "REACTION_REQUEST_CONTROL_ANNOUNCE"};
|
||||
reaction report{"Report", "REACTION_REPORT_NOTIFY", "REACTION_REPORT_ANNOUNCE"};
|
||||
reaction spectate{"Spectate", "REACTION_SPECTATING_NOTIFY", "REACTION_SPECTATING_ANNOUNCE"};
|
||||
reaction chat_spam{"Chat Spam", "REACTION_CHAT_SPAM_NOTIFY", "REACTION_CHAT_SPAM_ANNOUNCE"};
|
||||
interloper_reaction spectate_others{"Spectate Others", "REACTION_SPECTATING_OTHERS_NOTIFY", "REACTION_SPECTATING_OTHERS_ANNOUNCE", false, false};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(reactions, bounty, ceo_money, ceo_kick, clear_wanted_level, crash, end_session_kick, fake_deposit, force_mission, force_teleport, gta_banner, kick_from_interior, mc_teleport, network_bail, personal_vehicle_destroyed, remote_off_radar, rotate_cam, send_to_cutscene, send_to_location, sound_spam, spectate_notification, give_collectible, transaction_error, tse_freeze, tse_sender_mismatch, vehicle_kick, teleport_to_warehouse, trigger_business_raid, start_activity, start_script, null_function_kick, destroy_personal_vehicle, clear_ped_tasks, turn_into_beast, remote_wanted_level, remote_wanted_level_others, remote_ragdoll, kick_vote, report_cash_spawn, modder_detection, game_anti_cheat_modder_detection, request_control_event, report, send_to_interior, spectate, spectate_others)
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(reactions, bounty, ceo_money, ceo_kick, clear_wanted_level, crash, end_session_kick, fake_deposit, force_mission, force_teleport, gta_banner, kick_from_interior, mc_teleport, network_bail, personal_vehicle_destroyed, remote_off_radar, rotate_cam, send_to_cutscene, send_to_location, sound_spam, spectate_notification, give_collectible, transaction_error, tse_freeze, tse_sender_mismatch, vehicle_kick, teleport_to_warehouse, trigger_business_raid, start_activity, start_script, null_function_kick, destroy_personal_vehicle, clear_ped_tasks, turn_into_beast, remote_wanted_level, remote_wanted_level_others, remote_ragdoll, kick_vote, report_cash_spawn, modder_detection, game_anti_cheat_modder_detection, request_control_event, report, send_to_interior, spectate, chat_spam, spectate_others)
|
||||
} reactions{};
|
||||
|
||||
struct player
|
||||
@ -421,7 +422,6 @@ namespace big
|
||||
bool chat_commands = false;
|
||||
CommandAccessLevel chat_command_default_access_level = CommandAccessLevel::FRIENDLY;
|
||||
|
||||
bool kick_chat_spammers = false;
|
||||
bool kick_host_when_forcing_host = false;
|
||||
|
||||
bool explosion_karma = false;
|
||||
@ -469,7 +469,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, 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, block_ceo_creation, 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, trust_friends, use_spam_timer, spam_timer, spam_length, chat_translator)
|
||||
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_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, show_cheating_message, 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)
|
||||
} session{};
|
||||
|
||||
struct settings
|
||||
|
@ -126,14 +126,12 @@ namespace big
|
||||
{
|
||||
if (g.session.log_chat_messages)
|
||||
chat::log_chat(message, player, spam_reason, is_team);
|
||||
g_notification_service.push("PROTECTIONS"_T.data(),
|
||||
|
||||
std::format("{} {}", player->get_name(), "IS_A_SPAMMER"_T.data()));
|
||||
player->is_spammer = true;
|
||||
if (g.session.kick_chat_spammers
|
||||
&& !(player->is_trusted || (player->is_friend() && g.session.trust_friends) || g.session.trust_session))
|
||||
if (!(player->is_trusted || (player->is_friend() && g.session.trust_friends) || g.session.trust_session))
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get("smartkick"_J))->call(player, {});
|
||||
session::add_infraction(player, Infraction::CHAT_SPAM);
|
||||
g.reactions.chat_spam.process(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -223,6 +223,7 @@ namespace lua::network
|
||||
{"TRIED_KICK_PLAYER", big::Infraction::TRIED_KICK_PLAYER},
|
||||
{"TRIGGERED_ANTICHEAT", big::Infraction::TRIGGERED_ANTICHEAT},
|
||||
{"UNDEAD_OTR", big::Infraction::UNDEAD_OTR},
|
||||
{"CHAT_SPAM", big::Infraction::CHAT_SPAM},
|
||||
});
|
||||
|
||||
auto ns = state["network"].get_or_create<sol::table>();
|
||||
|
@ -22,6 +22,8 @@ namespace big
|
||||
{Infraction::INVALID_PLAYER_MODEL, "Had used an invalid player model"},
|
||||
{Infraction::SUPER_JUMP, "Had used super jump"},
|
||||
{Infraction::UNDEAD_OTR, "Had used undead OTR"},
|
||||
{Infraction::CUSTOM_REASON, ""},
|
||||
{Infraction::CHAT_SPAM, "Chat spammer"},
|
||||
};
|
||||
|
||||
const char* persistent_player::get_infraction_description(int infraction)
|
||||
|
@ -222,7 +222,6 @@ namespace big
|
||||
ImGui::SliderFloat("SPAM_TIMER"_T.data(), &g.session.spam_timer, 0.5f, 5.0f);
|
||||
ImGui::SliderInt("SPAM_LENGTH"_T.data(), &g.session.spam_length, 1, 256);
|
||||
}
|
||||
ImGui::Checkbox("AUTO_KICK_CHAT_SPAMMERS"_T.data(), &g.session.kick_chat_spammers);
|
||||
ImGui::Checkbox("LOG_CHAT_MSG"_T.data(), &g.session.log_chat_messages);
|
||||
ImGui::Checkbox("LOG_TXT_MSG"_T.data(), &g.session.log_text_messages);
|
||||
components::input_text_with_hint("##message", "VIEW_NET_CHAT_MESSAGE"_T, msg, sizeof(msg));
|
||||
|
@ -97,27 +97,40 @@ namespace big
|
||||
draw_reaction(g.reactions.bounty);
|
||||
draw_reaction(g.reactions.ceo_kick);
|
||||
draw_reaction(g.reactions.ceo_money);
|
||||
draw_reaction(g.reactions.chat_spam);
|
||||
draw_reaction(g.reactions.clear_ped_tasks);
|
||||
draw_reaction(g.reactions.clear_wanted_level);
|
||||
draw_reaction(g.reactions.crash);
|
||||
draw_reaction(g.reactions.end_session_kick);
|
||||
draw_reaction(g.reactions.destroy_personal_vehicle);
|
||||
draw_reaction(g.reactions.end_session_kick);
|
||||
draw_reaction(g.reactions.fake_deposit);
|
||||
draw_reaction(g.reactions.force_mission);
|
||||
draw_reaction(g.reactions.force_teleport);
|
||||
draw_reaction(g.reactions.game_anti_cheat_modder_detection);
|
||||
draw_reaction(g.reactions.give_collectible);
|
||||
draw_reaction(g.reactions.gta_banner);
|
||||
draw_reaction(g.reactions.kick_from_interior);
|
||||
draw_reaction(g.reactions.kick_vote);
|
||||
draw_reaction(g.reactions.mc_teleport);
|
||||
draw_reaction(g.reactions.modder_detection);
|
||||
draw_reaction(g.reactions.network_bail);
|
||||
draw_reaction(g.reactions.null_function_kick);
|
||||
draw_reaction(g.reactions.personal_vehicle_destroyed);
|
||||
draw_reaction(g.reactions.remote_off_radar);
|
||||
draw_reaction(g.reactions.remote_ragdoll);
|
||||
draw_reaction(g.reactions.remote_wanted_level);
|
||||
draw_interloper_reaction(g.reactions.remote_wanted_level_others);
|
||||
draw_reaction(g.reactions.report);
|
||||
draw_reaction(g.reactions.report_cash_spawn);
|
||||
draw_reaction(g.reactions.request_control_event);
|
||||
draw_reaction(g.reactions.rotate_cam);
|
||||
draw_reaction(g.reactions.send_to_cutscene);
|
||||
draw_reaction(g.reactions.send_to_location);
|
||||
draw_reaction(g.reactions.send_to_interior);
|
||||
draw_reaction(g.reactions.send_to_location);
|
||||
draw_reaction(g.reactions.sound_spam);
|
||||
draw_reaction(g.reactions.spectate);
|
||||
draw_reaction(g.reactions.spectate_notification);
|
||||
draw_interloper_reaction(g.reactions.spectate_others);
|
||||
draw_reaction(g.reactions.start_activity);
|
||||
draw_reaction(g.reactions.start_script);
|
||||
draw_reaction(g.reactions.teleport_to_warehouse);
|
||||
@ -125,21 +138,8 @@ namespace big
|
||||
draw_reaction(g.reactions.trigger_business_raid);
|
||||
draw_reaction(g.reactions.tse_freeze);
|
||||
draw_reaction(g.reactions.tse_sender_mismatch);
|
||||
draw_reaction(g.reactions.vehicle_kick);
|
||||
draw_reaction(g.reactions.turn_into_beast);
|
||||
draw_reaction(g.reactions.remote_wanted_level);
|
||||
draw_interloper_reaction(g.reactions.remote_wanted_level_others);
|
||||
ImGui::Separator();
|
||||
draw_reaction(g.reactions.clear_ped_tasks);
|
||||
draw_reaction(g.reactions.remote_ragdoll);
|
||||
draw_reaction(g.reactions.kick_vote);
|
||||
draw_reaction(g.reactions.modder_detection);
|
||||
draw_reaction(g.reactions.game_anti_cheat_modder_detection);
|
||||
draw_reaction(g.reactions.report);
|
||||
draw_reaction(g.reactions.report_cash_spawn);
|
||||
draw_reaction(g.reactions.request_control_event);
|
||||
draw_reaction(g.reactions.spectate);
|
||||
draw_interloper_reaction(g.reactions.spectate_others);
|
||||
draw_reaction(g.reactions.vehicle_kick);
|
||||
|
||||
components::title("SETTINGS_NOTIFICATIONS"_T);
|
||||
components::sub_title("SETTINGS_NOTIFY_GTA_THREADS"_T);
|
||||
|
Reference in New Issue
Block a user