feat(ScriptEventHandler): Block forced teleport to beach (#337)

This commit is contained in:
mentolixite 2022-07-15 14:55:40 +02:00 committed by GitHub
parent fc6f797088
commit 1600918926
5 changed files with 47 additions and 26 deletions

View File

@ -144,8 +144,8 @@ namespace big
RemoteOffradar = -391633760, RemoteOffradar = -391633760,
RotateCam = 801199324, RotateCam = 801199324,
SendToCutscene = 1068259786, SendToCutscene = 1068259786,
SendToIsland = -621279188, SendToCayoPerico = -621279188,
SendToCayo = 1463943751, SendToLocation = 1463943751,
SoundSpam = 1132878564, SoundSpam = 1132878564,
Spectate = -1113591308, Spectate = -1113591308,
Teleport = 603406648, Teleport = 603406648,

View File

@ -55,7 +55,7 @@ namespace big
pair remote_off_radar{}; pair remote_off_radar{};
pair rotate_cam{}; pair rotate_cam{};
pair send_to_cutscene{}; pair send_to_cutscene{};
pair send_to_island{}; pair send_to_location{};
pair sound_spam{}; pair sound_spam{};
pair spectate{}; pair spectate{};
pair transaction_error{}; pair transaction_error{};
@ -110,7 +110,7 @@ namespace big
bool remote_off_radar = true; bool remote_off_radar = true;
bool rotate_cam = true; bool rotate_cam = true;
bool send_to_cutscene = true; bool send_to_cutscene = true;
bool send_to_island = true; bool send_to_location = true;
bool sound_spam = true; bool sound_spam = true;
bool spectate = true; bool spectate = true;
bool transaction_error = true; bool transaction_error = true;
@ -446,8 +446,8 @@ namespace big
script_handler.rotate_cam.notify = script_handler_j["rotate_cam"]["notify"]; script_handler.rotate_cam.notify = script_handler_j["rotate_cam"]["notify"];
script_handler.send_to_cutscene.log = script_handler_j["send_to_cutscene"]["log"]; script_handler.send_to_cutscene.log = script_handler_j["send_to_cutscene"]["log"];
script_handler.send_to_cutscene.notify = script_handler_j["send_to_cutscene"]["notify"]; script_handler.send_to_cutscene.notify = script_handler_j["send_to_cutscene"]["notify"];
script_handler.send_to_island.log = script_handler_j["send_to_island"]["log"]; script_handler.send_to_location.log = script_handler_j["send_to_location"]["log"];
script_handler.send_to_island.notify = script_handler_j["send_to_island"]["notify"]; script_handler.send_to_location.notify = script_handler_j["send_to_location"]["notify"];
script_handler.sound_spam.log = script_handler_j["sound_spam"]["log"]; script_handler.sound_spam.log = script_handler_j["sound_spam"]["log"];
script_handler.sound_spam.notify = script_handler_j["sound_spam"]["notify"]; script_handler.sound_spam.notify = script_handler_j["sound_spam"]["notify"];
script_handler.spectate.log = script_handler_j["spectate"]["log"]; script_handler.spectate.log = script_handler_j["spectate"]["log"];
@ -486,7 +486,7 @@ namespace big
script_handler.remote_off_radar = script_handler_j["remote_off_radar"]; script_handler.remote_off_radar = script_handler_j["remote_off_radar"];
script_handler.rotate_cam = script_handler_j["rotate_cam"]; script_handler.rotate_cam = script_handler_j["rotate_cam"];
script_handler.send_to_cutscene = script_handler_j["send_to_cutscene"]; script_handler.send_to_cutscene = script_handler_j["send_to_cutscene"];
script_handler.send_to_island = script_handler_j["send_to_island"]; script_handler.send_to_location = script_handler_j["send_to_location"];
script_handler.sound_spam = script_handler_j["sound_spam"]; script_handler.sound_spam = script_handler_j["sound_spam"];
script_handler.spectate = script_handler_j["spectate"]; script_handler.spectate = script_handler_j["spectate"];
script_handler.transaction_error = script_handler_j["transaction_error"]; script_handler.transaction_error = script_handler_j["transaction_error"];
@ -702,7 +702,7 @@ namespace big
{ "remote_off_radar", return_notify_pair(script_handler_notifications.remote_off_radar) }, { "remote_off_radar", return_notify_pair(script_handler_notifications.remote_off_radar) },
{ "rotate_cam", return_notify_pair(script_handler_notifications.rotate_cam) }, { "rotate_cam", return_notify_pair(script_handler_notifications.rotate_cam) },
{ "send_to_cutscene", return_notify_pair(script_handler_notifications.send_to_cutscene) }, { "send_to_cutscene", return_notify_pair(script_handler_notifications.send_to_cutscene) },
{ "send_to_island", return_notify_pair(script_handler_notifications.send_to_island) }, { "send_to_location", return_notify_pair(script_handler_notifications.send_to_location) },
{ "sound_spam", return_notify_pair(script_handler_notifications.sound_spam) }, { "sound_spam", return_notify_pair(script_handler_notifications.sound_spam) },
{ "spectate", return_notify_pair(script_handler_notifications.spectate) }, { "spectate", return_notify_pair(script_handler_notifications.spectate) },
{ "transaction_error", return_notify_pair(script_handler_notifications.transaction_error) }, { "transaction_error", return_notify_pair(script_handler_notifications.transaction_error) },
@ -736,7 +736,7 @@ namespace big
{ "remote_off_radar", script_handler_protections.remote_off_radar }, { "remote_off_radar", script_handler_protections.remote_off_radar },
{ "rotate_cam", script_handler_protections.rotate_cam }, { "rotate_cam", script_handler_protections.rotate_cam },
{ "send_to_cutscene", script_handler_protections.send_to_cutscene }, { "send_to_cutscene", script_handler_protections.send_to_cutscene },
{ "send_to_island", script_handler_protections.send_to_island }, { "send_to_location", script_handler_protections.send_to_location },
{ "sound_spam", script_handler_protections.sound_spam }, { "sound_spam", script_handler_protections.sound_spam },
{ "spectate", script_handler_protections.spectate }, { "spectate", script_handler_protections.spectate },
{ "transaction_error", script_handler_protections.transaction_error }, { "transaction_error", script_handler_protections.transaction_error },

View File

@ -144,19 +144,10 @@ namespace big
return true; return true;
} }
break; break;
case eRemoteEvent::SendToCayo: case eRemoteEvent::SendToCayoPerico:
if (args[2] == 0 && args[3] == 0 && args[4] == 3 && args[5] == 1 && args[6] == 0) if (g->protections.script_events.send_to_location)
{ {
if (g->protections.script_events.send_to_island) format_string(player_name, "Send to Cayo Perico", notify.send_to_location.log, notify.send_to_location.notify);
{
format_string(player_name, "Send to Cayo Beach", notify.send_to_island.log, notify.send_to_island.notify);
return true;
}
}
else
{
format_string(player_name, "TSE Freeze", notify.tse_freeze.log, notify.tse_freeze.notify);
return true; return true;
} }
@ -169,14 +160,44 @@ namespace big
return true; return true;
} }
break; break;
case eRemoteEvent::SendToIsland: case eRemoteEvent::SendToLocation:
if (g->protections.script_events.send_to_island) {
bool known_location = false;
if (args[2] == 0 && args[3] == 0)
{ {
format_string(player_name, "Send to Island", notify.send_to_island.log, notify.send_to_island.notify); if (args[4] == 4 && args[5] == 0)
{
known_location = true;
if (g->protections.script_events.send_to_location)
{
format_string(player_name, "Send to Beach", notify.send_to_location.log, notify.send_to_location.notify);
return true;
}
}
else if ((args[4] == 3 || args[4] == 4) && args[5] == 1)
{
known_location = true;
if (g->protections.script_events.send_to_location)
{
format_string(player_name, "Send to Cayo Perico", notify.send_to_location.log, notify.send_to_location.notify);
return true;
}
}
}
if (!known_location)
{
format_string(player_name, "TSE Freeze", notify.tse_freeze.log, notify.tse_freeze.notify);
return true; return true;
} }
break; break;
}
case eRemoteEvent::SoundSpam: case eRemoteEvent::SoundSpam:
if (g->protections.script_events.sound_spam) if (g->protections.script_events.sound_spam)
{ {

View File

@ -77,7 +77,7 @@ namespace big
draw_pair_option("Remote Off Radar", script_event_handler.remote_off_radar); draw_pair_option("Remote Off Radar", script_event_handler.remote_off_radar);
draw_pair_option("Rotate Cam", script_event_handler.rotate_cam); draw_pair_option("Rotate Cam", script_event_handler.rotate_cam);
draw_pair_option("Send to Cutscene", script_event_handler.send_to_cutscene); draw_pair_option("Send to Cutscene", script_event_handler.send_to_cutscene);
draw_pair_option("Send to Island", script_event_handler.send_to_island); draw_pair_option("Send to Location", script_event_handler.send_to_location);
ImGui::EndGroup(); ImGui::EndGroup();
ImGui::SameLine(); ImGui::SameLine();

View File

@ -30,7 +30,7 @@ namespace big
ImGui::BeginGroup(); ImGui::BeginGroup();
ImGui::Checkbox("Send to Cutscene", &g->protections.script_events.send_to_cutscene); ImGui::Checkbox("Send to Cutscene", &g->protections.script_events.send_to_cutscene);
ImGui::Checkbox("Send to Island", &g->protections.script_events.send_to_island); ImGui::Checkbox("Send to Location", &g->protections.script_events.send_to_location);
ImGui::Checkbox("Sound Spam", &g->protections.script_events.sound_spam); ImGui::Checkbox("Sound Spam", &g->protections.script_events.sound_spam);
ImGui::Checkbox("Spectate", &g->protections.script_events.spectate); ImGui::Checkbox("Spectate", &g->protections.script_events.spectate);
ImGui::Checkbox("Transaction Error", &g->protections.script_events.transaction_error); ImGui::Checkbox("Transaction Error", &g->protections.script_events.transaction_error);