add checkboxes for some missing protections

- remote_wanted_level, clear_ped_tasks, ragdoll, request_control, vehicle_special_ability
- sound_spam check in NETWORK_PLAY_SOUND_EVENT
This commit is contained in:
dynamoNg 2024-08-31 11:59:18 +05:30
parent 6bc6801fec
commit 7e990bef54
5 changed files with 76 additions and 61 deletions

View File

@ -292,7 +292,6 @@ namespace big
bool rotate_cam = true;
bool send_to_cutscene = true;
bool send_to_location = true;
bool sound_spam = true;
bool spectate = true;
bool give_collectible = true;
bool vehicle_kick = true;
@ -309,6 +308,12 @@ namespace big
bool force_relay_connections = false;
bool stop_traffic = true;
bool desync_kick = false;
bool remote_wanted_level = true;
bool clear_ped_tasks = true;
bool ragdoll = true;
bool request_control = true;
bool vehicle_special_ability = true;
bool sound_spam = true;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(protections, script_events, rid_join, receive_pickup, admin_check, kick_rejoin, force_relay_connections, stop_traffic, desync_kick)
} protections{};

View File

@ -43,7 +43,7 @@ namespace big
g.reactions.turn_into_beast.process(plyr);
}
if ((array->m_array >= scr_globals::globalplayer_bd.as<uint8_t*>()
if (g.protections.remote_wanted_level && (array->m_array >= scr_globals::globalplayer_bd.as<uint8_t*>()
&& array->m_array <= scr_globals::globalplayer_bd.at(31, sizeof(GlobalPlayerBDEntry) / 8).as<uint8_t*>())
&& scr_globals::globalplayer_bd.as<GlobalPlayerBD*>()->Entries[sender->m_player_id].RemoteWantedLevelPlayer != -1)
{

View File

@ -499,7 +499,7 @@ namespace big
return false;
}();
if (should_block)
if (g.protections.sound_spam && should_block)
{
LOGF(stream::net_events, WARNING, "Blocked NETWORK_PLAY_SOUND_EVENT from {} with is_entity: {}, ref_hash: {:X}, sound_hash: {:X}, sound_id: {}, script_hash: {:X}", plyr->get_name(), is_entity ? "T" : "F", ref_hash, sound_hash, sound_id, script_hash);
}
@ -626,7 +626,8 @@ namespace big
{
int net_id = buffer->Read<int>(13);
if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id)
if (g.protections.clear_ped_tasks && g_local_player && g_local_player->m_net_object
&& g_local_player->m_net_object->m_object_id == net_id)
{
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
g.reactions.clear_ped_tasks.process(plyr);
@ -640,7 +641,7 @@ namespace big
{
int net_id = buffer->Read<int>(13);
if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id)
if (g.protections.ragdoll && g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id)
{
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
g.reactions.remote_ragdoll.process(plyr);
@ -681,8 +682,8 @@ namespace big
case eNetworkEvents::REQUEST_CONTROL_EVENT:
{
auto net_id = buffer->Read<int>(13);
if (g_local_player && g_local_player->m_vehicle && g_local_player->m_vehicle->m_net_object
&& g_local_player->m_vehicle->m_net_object->m_object_id == net_id) //The request is for a vehicle we are currently in.
if (g.protections.request_control && g_local_player && g_local_player->m_vehicle
&& g_local_player->m_vehicle->m_net_object && g_local_player->m_vehicle->m_net_object->m_object_id == net_id) //The request is for a vehicle we are currently in.
{
Vehicle personal_vehicle = mobile::mechanic::get_personal_vehicle();
Vehicle veh = g_pointers->m_gta.m_ptr_to_handle(g_local_player->m_vehicle);
@ -848,23 +849,25 @@ namespace big
}
case eNetworkEvents::NETWORK_PLAY_SOUND_EVENT:
{
if (plyr && plyr->m_play_sound_rate_limit.process())
if (g.protections.sound_spam)
{
if (plyr->m_play_sound_rate_limit.exceeded_last_process())
if (plyr && plyr->m_play_sound_rate_limit.process())
{
//notify::crash_blocked(source_player, "sound spam"); --- false positives
if (plyr->m_play_sound_rate_limit.exceeded_last_process())
{
//notify::crash_blocked(source_player, "sound spam"); --- false positives
}
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return;
}
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return;
}
if (plyr && scan_play_sound_event(plyr, *buffer))
{
g.reactions.sound_spam.process(plyr);
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return;
if (plyr && scan_play_sound_event(plyr, *buffer))
{
g.reactions.sound_spam.process(plyr);
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return;
}
}
break;
}
case eNetworkEvents::EXPLOSION_EVENT:
@ -891,7 +894,7 @@ namespace big
{
int16_t net_id = buffer->Read<int16_t>(13);
if (is_local_vehicle(net_id))
if (g.protections.vehicle_special_ability && is_local_vehicle(net_id))
{
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
return;

View File

@ -220,7 +220,7 @@ namespace big
return true;
}
if (g.protections.script_events.sound_spam && static_cast<eRemoteEvent>(args[3]) == eRemoteEvent::TSECommandSound)
if (g.protections.sound_spam && static_cast<eRemoteEvent>(args[3]) == eRemoteEvent::TSECommandSound)
{
if (!plyr || plyr->m_play_sound_rate_limit_tse.process())
{
@ -286,7 +286,7 @@ namespace big
}
case eRemoteEvent::SoundSpam:
{
if (g.protections.script_events.sound_spam && (!plyr || plyr->m_invites_rate_limit.process()))
if (g.protections.sound_spam && (!plyr || plyr->m_invites_rate_limit.process()))
{
if (plyr->m_invites_rate_limit.exceeded_last_process())
g.reactions.sound_spam.process(plyr);

View File

@ -15,51 +15,58 @@ namespace big
void view::protection_settings()
{
ImGui::BeginGroup();
ImGui::Checkbox("BOUNTY"_T.data(), &g.protections.script_events.bounty);
ImGui::Checkbox("CEO_MONEY"_T.data(), &g.protections.script_events.ceo_money);
ImGui::Checkbox("FORCE_MISSION"_T.data(), &g.protections.script_events.force_mission);
ImGui::Checkbox("FORCE_TELEPORT"_T.data(), &g.protections.script_events.force_teleport);
ImGui::Checkbox("GTA_BANNER"_T.data(), &g.protections.script_events.gta_banner);
ImGui::Checkbox("MC_TELEPORT"_T.data(), &g.protections.script_events.mc_teleport);
ImGui::Checkbox("SEND_TO_CUTSCENE"_T.data(), &g.protections.script_events.send_to_cutscene);
ImGui::BeginGroup(); // 8 Checkbox
{
ImGui::Checkbox("BOUNTY"_T.data(), &g.protections.script_events.bounty);
ImGui::Checkbox("CEO_MONEY"_T.data(), &g.protections.script_events.ceo_money);
ImGui::Checkbox("FORCE_MISSION"_T.data(), &g.protections.script_events.force_mission);
ImGui::Checkbox("FORCE_TELEPORT"_T.data(), &g.protections.script_events.force_teleport);
ImGui::Checkbox("GTA_BANNER"_T.data(), &g.protections.script_events.gta_banner);
ImGui::Checkbox("MC_TELEPORT"_T.data(), &g.protections.script_events.mc_teleport);
ImGui::Checkbox("SEND_TO_CUTSCENE"_T.data(), &g.protections.script_events.send_to_cutscene);
ImGui::Checkbox("REQUEST_CONTROL_EVENT"_T.data(), &g.protections.request_control);
}
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("SEND_TO_LOCATION"_T.data(), &g.protections.script_events.send_to_location);
ImGui::Checkbox("SOUND_SPAM"_T.data(), &g.protections.script_events.sound_spam);
ImGui::Checkbox("PERSONAL_VEHICLE_DESTROYED"_T.data(), &g.protections.script_events.personal_vehicle_destroyed);
ImGui::Checkbox("REMOTE_OFF_RADAR"_T.data(), &g.protections.script_events.remote_off_radar);
ImGui::Checkbox("ROTATE_CAM"_T.data(), &g.protections.script_events.rotate_cam);
ImGui::Checkbox("TELEPORT_TO_WAREHOUSE"_T.data(), &g.protections.script_events.teleport_to_warehouse);
ImGui::Checkbox("START_ACTIVITY"_T.data(), &g.protections.script_events.start_activity);
ImGui::BeginGroup(); // 8 Checkbox
{
ImGui::Checkbox("SEND_TO_LOCATION"_T.data(), &g.protections.script_events.send_to_location);
ImGui::Checkbox("SOUND_SPAM"_T.data(), &g.protections.sound_spam);
ImGui::Checkbox("PERSONAL_VEHICLE_DESTROYED"_T.data(), &g.protections.script_events.personal_vehicle_destroyed);
ImGui::Checkbox("REMOTE_OFF_RADAR"_T.data(), &g.protections.script_events.remote_off_radar);
ImGui::Checkbox("ROTATE_CAM"_T.data(), &g.protections.script_events.rotate_cam);
ImGui::Checkbox("TELEPORT_TO_WAREHOUSE"_T.data(), &g.protections.script_events.teleport_to_warehouse);
ImGui::Checkbox("START_ACTIVITY"_T.data(), &g.protections.script_events.start_activity);
ImGui::Checkbox("REMOTE_RAGDOLL"_T.data(), &g.protections.ragdoll);
}
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("SPECTATE"_T.data(), &g.protections.script_events.spectate);
ImGui::Checkbox("VEHICLE_KICK"_T.data(), &g.protections.script_events.vehicle_kick);
ImGui::Checkbox("WANTED_LEVEL"_T.data(), &g.protections.script_events.clear_wanted_level);
ImGui::Checkbox("BLOCK_RID_JOINING"_T.data(), &g.protections.rid_join);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("BLOCK_RID_JOINING_DESCRIPTION"_T.data());
ImGui::Checkbox("RECEIVE_PICKUP"_T.data(), &g.protections.receive_pickup);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("VIEW_PROTECTION_SETTINGS_RECEIVE_PICKUP_TOOLTIP"_T.data());
ImGui::Checkbox("GIVE_COLLECTIBLE"_T.data(), &g.protections.script_events.give_collectible);
ImGui::BeginGroup(); // 7 Checkbox
{
ImGui::Checkbox("SPECTATE"_T.data(), &g.protections.script_events.spectate);
ImGui::Checkbox("VEHICLE_KICK"_T.data(), &g.protections.script_events.vehicle_kick);
ImGui::Checkbox("CLEAR_WANTED_LEVEL"_T.data(), &g.protections.script_events.clear_wanted_level);
ImGui::Checkbox("BLOCK_RID_JOINING"_T.data(), &g.protections.rid_join);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("BLOCK_RID_JOINING_DESCRIPTION"_T.data());
ImGui::Checkbox("RECEIVE_PICKUP"_T.data(), &g.protections.receive_pickup);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("VIEW_PROTECTION_SETTINGS_RECEIVE_PICKUP_TOOLTIP"_T.data());
ImGui::Checkbox("GIVE_COLLECTIBLE"_T.data(), &g.protections.script_events.give_collectible);
ImGui::Checkbox("REMOTE_WANTED_LEVEL"_T.data(), &g.protections.remote_wanted_level);
}
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
ImGui::Checkbox("ADMIN_CHECK"_T.data(), &g.protections.admin_check);
ImGui::Checkbox("VIEW_PROTECTION_SETTINGS_KICK_REJOIN"_T.data(), &g.protections.kick_rejoin);
ImGui::Checkbox("BLOCK_TRAFFIC_MANIPULATION"_T.data(), &g.protections.stop_traffic);
components::command_checkbox<"forcerelays">();
ImGui::Checkbox("DESYNC_KICK"_T.data(), &g.protections.desync_kick);
ImGui::BeginGroup(); // 7 Checkbox
{
ImGui::Checkbox("ADMIN_CHECK"_T.data(), &g.protections.admin_check);
ImGui::Checkbox("VIEW_PROTECTION_SETTINGS_KICK_REJOIN"_T.data(), &g.protections.kick_rejoin);
ImGui::Checkbox("BLOCK_TRAFFIC_MANIPULATION"_T.data(), &g.protections.stop_traffic);
components::command_checkbox<"forcerelays">();
ImGui::Checkbox("DESYNC_KICK"_T.data(), &g.protections.desync_kick);
ImGui::Checkbox("REMOTE_CLEAR_PED_TASK"_T.data(), &g.protections.clear_ped_tasks);
ImGui::Checkbox("REMOTE_VEH_SPECIAL_ABILITY_EVENT"_T.data(), &g.protections.vehicle_special_ability);
}
ImGui::EndGroup();
ImGui::SeparatorText("VIEW_PROTECTION_SETTINGS_OPTIONS"_T.data());