From 5a9019fa62d97a95cd463f0c022564f132e54d4c Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Wed, 13 Dec 2023 13:32:26 -0500 Subject: [PATCH] Fixed TRIGGER_SCRIPT_EVENT for 3095. (#2527) --- scripts/gtav-classes.cmake | 2 +- src/backend/commands/player/kick/bail_kick.cpp | 2 +- src/backend/commands/player/kick/null_function_kick.cpp | 2 +- src/backend/commands/player/misc/enter_interior.cpp | 2 +- src/backend/commands/player/toxic/ceo_kick.cpp | 4 ++-- src/backend/commands/player/toxic/force_into_mission.cpp | 2 +- src/backend/commands/player/toxic/kick_from_interior.cpp | 2 +- src/backend/commands/player/toxic/kick_from_vehicle.cpp | 2 +- src/backend/commands/player/toxic/send_fake_ban_message.cpp | 2 +- src/backend/commands/player/toxic/send_sext.cpp | 2 +- src/backend/commands/player/toxic/send_to_apartment.cpp | 2 +- src/backend/commands/player/toxic/send_to_interior.cpp | 2 +- src/backend/commands/player/toxic/send_to_warehouse.cpp | 2 +- src/backend/commands/player/toxic/show_transaction_error.cpp | 2 +- src/backend/commands/player/toxic/start_script.cpp | 4 ++-- src/backend/commands/player/toxic/trigger_ceo_raid.cpp | 2 +- src/backend/looped/player/toxic_options.cpp | 2 +- src/crossmap.cpp | 2 +- src/function_types.hpp | 2 +- src/lua/bindings/network.cpp | 2 +- src/pointers.cpp | 2 +- src/services/script_connection/script_connection.cpp | 4 ++-- src/util/globals.hpp | 4 ++-- src/util/session.hpp | 2 +- src/util/toxic.hpp | 2 +- src/util/troll.hpp | 2 +- src/views/debug/view_debug_script_events.cpp | 2 +- 27 files changed, 31 insertions(+), 31 deletions(-) diff --git a/scripts/gtav-classes.cmake b/scripts/gtav-classes.cmake index d3767d6c..896c29d4 100644 --- a/scripts/gtav-classes.cmake +++ b/scripts/gtav-classes.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( gtav_classes GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git - GIT_TAG e52b8c65379f3304cf7b72dc87561c9d3924d4b4 + GIT_TAG 08cc88c83a988f1acfd90f89fa336ba548146831 GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/backend/commands/player/kick/bail_kick.cpp b/src/backend/commands/player/kick/bail_kick.cpp index a28c5769..7fa44a57 100644 --- a/src/backend/commands/player/kick/bail_kick.cpp +++ b/src/backend/commands/player/kick/bail_kick.cpp @@ -26,7 +26,7 @@ namespace big (int64_t)self::id, scr_globals::gpbd_fm_3.as()->Entries[player->id()].ScriptEventReplayProtectionCounter}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::NetworkBail); } }; diff --git a/src/backend/commands/player/kick/null_function_kick.cpp b/src/backend/commands/player/kick/null_function_kick.cpp index 63ef90f0..b01344d2 100644 --- a/src/backend/commands/player/kick/null_function_kick.cpp +++ b/src/backend/commands/player/kick/null_function_kick.cpp @@ -21,7 +21,7 @@ namespace big const size_t arg_count = 15; int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl, (int64_t)self::id, (int64_t)(int)-1}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::InteriorControl); } }; diff --git a/src/backend/commands/player/misc/enter_interior.cpp b/src/backend/commands/player/misc/enter_interior.cpp index 8c1dd400..9dfccda1 100644 --- a/src/backend/commands/player/misc/enter_interior.cpp +++ b/src/backend/commands/player/misc/enter_interior.cpp @@ -29,7 +29,7 @@ namespace big 0, 1}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << self::id); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << self::id, (int)eRemoteEvent::Teleport); } else if (scr_globals::globalplayer_bd.as()->Entries[id].SimpleInteriorData.Index != eSimpleInteriorIndex::SIMPLE_INTERIOR_INVALID) { diff --git a/src/backend/commands/player/toxic/ceo_kick.cpp b/src/backend/commands/player/toxic/ceo_kick.cpp index 31da0b48..870036e2 100644 --- a/src/backend/commands/player/toxic/ceo_kick.cpp +++ b/src/backend/commands/player/toxic/ceo_kick.cpp @@ -28,7 +28,7 @@ namespace big const size_t arg_count = 2; int64_t args[arg_count] = {(int64_t)eRemoteEvent::CeoKick, (int64_t)self::id}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::CeoKick); return; } else @@ -37,7 +37,7 @@ namespace big const size_t arg_count = 3; int64_t args[arg_count] = {(int64_t)eRemoteEvent::MarkPlayerAsBeast, (int64_t)self::id, leader}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::MarkPlayerAsBeast); } } }; diff --git a/src/backend/commands/player/toxic/force_into_mission.cpp b/src/backend/commands/player/toxic/force_into_mission.cpp index 451d258b..506c4dec 100644 --- a/src/backend/commands/player/toxic/force_into_mission.cpp +++ b/src/backend/commands/player/toxic/force_into_mission.cpp @@ -19,7 +19,7 @@ namespace big const size_t arg_count = 3; int64_t args[arg_count] = {(int64_t)eRemoteEvent::ForceMission, (int64_t)self::id, 0}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::ForceMission); } }; diff --git a/src/backend/commands/player/toxic/kick_from_interior.cpp b/src/backend/commands/player/toxic/kick_from_interior.cpp index 5ee21953..40c5836c 100644 --- a/src/backend/commands/player/toxic/kick_from_interior.cpp +++ b/src/backend/commands/player/toxic/kick_from_interior.cpp @@ -56,7 +56,7 @@ namespace big .SimpleInteriorData.InstanceId, }; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::KickFromInterior); } } }; diff --git a/src/backend/commands/player/toxic/kick_from_vehicle.cpp b/src/backend/commands/player/toxic/kick_from_vehicle.cpp index 6410d45a..7ba59c41 100644 --- a/src/backend/commands/player/toxic/kick_from_vehicle.cpp +++ b/src/backend/commands/player/toxic/kick_from_vehicle.cpp @@ -24,7 +24,7 @@ namespace big const size_t arg_count = 9; int64_t args[arg_count] = {(int64_t)eRemoteEvent::VehicleKick, self::id, 0, 0, 0, 0, 0, 0, 0}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::VehicleKick); } else { diff --git a/src/backend/commands/player/toxic/send_fake_ban_message.cpp b/src/backend/commands/player/toxic/send_fake_ban_message.cpp index 14ac3be5..95f414f6 100644 --- a/src/backend/commands/player/toxic/send_fake_ban_message.cpp +++ b/src/backend/commands/player/toxic/send_fake_ban_message.cpp @@ -23,7 +23,7 @@ namespace big strcpy((char*)&args[2], "HUD_ROSBANPERM"); - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::SendTextLabelSMS); } }; diff --git a/src/backend/commands/player/toxic/send_sext.cpp b/src/backend/commands/player/toxic/send_sext.cpp index 4f570d12..a3d98ab0 100644 --- a/src/backend/commands/player/toxic/send_sext.cpp +++ b/src/backend/commands/player/toxic/send_sext.cpp @@ -28,7 +28,7 @@ namespace big strcpy((char*)&args[2], (std::string("SXT_") + strippers[rand() % strippers.size()] + "_" + sext_types[rand() % sext_types.size()]) .data()); - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::SendTextLabelSMS); } }; diff --git a/src/backend/commands/player/toxic/send_to_apartment.cpp b/src/backend/commands/player/toxic/send_to_apartment.cpp index 697fa647..10adb8bf 100644 --- a/src/backend/commands/player/toxic/send_to_apartment.cpp +++ b/src/backend/commands/player/toxic/send_to_apartment.cpp @@ -19,7 +19,7 @@ namespace big const size_t arg_count = 9; int64_t args[arg_count] = {(int64_t)eRemoteEvent::Teleport, self::id, (int64_t)player->id(), (int64_t)(int)-1, 1, (int64_t)_args.get(0), 1, 1, 1}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::Teleport); } }; diff --git a/src/backend/commands/player/toxic/send_to_interior.cpp b/src/backend/commands/player/toxic/send_to_interior.cpp index c9bb6596..2498e554 100644 --- a/src/backend/commands/player/toxic/send_to_interior.cpp +++ b/src/backend/commands/player/toxic/send_to_interior.cpp @@ -34,7 +34,7 @@ namespace big (int64_t) true, -1}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::InteriorControl); } }; diff --git a/src/backend/commands/player/toxic/send_to_warehouse.cpp b/src/backend/commands/player/toxic/send_to_warehouse.cpp index 4842fb6f..53900b39 100644 --- a/src/backend/commands/player/toxic/send_to_warehouse.cpp +++ b/src/backend/commands/player/toxic/send_to_warehouse.cpp @@ -19,7 +19,7 @@ namespace big const size_t arg_count = 6; int64_t args[arg_count] = {(int64_t)eRemoteEvent::TeleportToWarehouse, self::id, (int64_t)player->id(), 1, (int64_t)_args.get(0)}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::TeleportToWarehouse); } }; diff --git a/src/backend/commands/player/toxic/show_transaction_error.cpp b/src/backend/commands/player/toxic/show_transaction_error.cpp index 2530b9bf..01f76a00 100644 --- a/src/backend/commands/player/toxic/show_transaction_error.cpp +++ b/src/backend/commands/player/toxic/show_transaction_error.cpp @@ -28,7 +28,7 @@ namespace big *scr_globals::gsbd_fm_events.at(9).as(), *scr_globals::gsbd_fm_events.at(10).as()}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::TransactionError); } }; diff --git a/src/backend/commands/player/toxic/start_script.cpp b/src/backend/commands/player/toxic/start_script.cpp index 821ea1bd..04c5eb88 100644 --- a/src/backend/commands/player/toxic/start_script.cpp +++ b/src/backend/commands/player/toxic/start_script.cpp @@ -30,14 +30,14 @@ namespace big args[2 + 19] = arg19; args[24] = scr_globals::gpbd_fm_3.as()->Entries[player->id()].ScriptEventReplayProtectionCounter; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::StartScriptBegin); for (int i = 0; i < 2; i++) { const size_t arg_count_2 = 25; int64_t args_2[arg_count_2] = {(int64_t)eRemoteEvent::StartScriptProceed, (int64_t)self::id}; args_2[2 + 17] = 1337; - g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << player->id(), (int)eRemoteEvent::StartScriptProceed); script::get_current()->yield(20ms); } diff --git a/src/backend/commands/player/toxic/trigger_ceo_raid.cpp b/src/backend/commands/player/toxic/trigger_ceo_raid.cpp index 776c74bf..3fd9e694 100644 --- a/src/backend/commands/player/toxic/trigger_ceo_raid.cpp +++ b/src/backend/commands/player/toxic/trigger_ceo_raid.cpp @@ -18,7 +18,7 @@ namespace big const size_t arg_count = 3; int64_t args[arg_count] = {(int64_t)eRemoteEvent::TriggerCEORaid, (int64_t)self::id, 0}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::TriggerCEORaid); } }; diff --git a/src/backend/looped/player/toxic_options.cpp b/src/backend/looped/player/toxic_options.cpp index eab67a9b..6e56ea54 100644 --- a/src/backend/looped/player/toxic_options.cpp +++ b/src/backend/looped/player/toxic_options.cpp @@ -55,7 +55,7 @@ namespace big const size_t arg_count = 3; int64_t args[arg_count] = {(int64_t)eRemoteEvent::TSECommand, (int64_t)self::id, (int64_t)eRemoteEvent::TSECommandRotateCam}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, rotate_cam_bits); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, rotate_cam_bits, (int)eRemoteEvent::TSECommand); } }); } diff --git a/src/crossmap.cpp b/src/crossmap.cpp index ff23cf37..dc8ce6c5 100644 --- a/src/crossmap.cpp +++ b/src/crossmap.cpp @@ -91,7 +91,7 @@ namespace big {0x936E6168A9BCEDB5, 0x5E3ED023C0E7CC7C}, {0xD8F66A3A60C62153, 0x4BC3E5D2FB0A1665}, {0x2902843FCD2B2D79, 0xFCEF367B86651ED3}, - {0x5AE99C571D5BBE5D, 0x2C0E0814582947D3}, + {0x5AE99C571D5BBE5D, 0x71A6F836422FDD2B}, {0x078EBE9809CCD637, 0xCD17096A98584C2B}, {0x5262CC1995D07E09, 0x6FF322107B12B749}, {0x18C1270EA7F199BC, 0x828F3FAE99DA791A}, diff --git a/src/function_types.hpp b/src/function_types.hpp index ca87da5e..1e053435 100644 --- a/src/function_types.hpp +++ b/src/function_types.hpp @@ -56,7 +56,7 @@ namespace big::functions using get_net_game_player = CNetGamePlayer* (*)(Player player); - using trigger_script_event = void (*)(int event_group, int64_t* args, int arg_count, int player_bits); + using trigger_script_event = void (*)(int event_group, int64_t* args, int arg_count, int player_bits, int event_id); using increment_stat_event = bool (*)(uint64_t net_event_struct, int64_t sender, int64_t a3); diff --git a/src/lua/bindings/network.cpp b/src/lua/bindings/network.cpp index af40eeec..d11cd7e7 100644 --- a/src/lua/bindings/network.cpp +++ b/src/lua/bindings/network.cpp @@ -34,7 +34,7 @@ namespace lua::network for (auto arg : args) actual_args.push_back((uint32_t)arg); - big::g_pointers->m_gta.m_trigger_script_event(1, actual_args.data(), actual_args.size(), bitset); + big::g_pointers->m_gta.m_trigger_script_event(1, actual_args.data(), actual_args.size(), bitset, args[0]); } // Lua API: Function diff --git a/src/pointers.cpp b/src/pointers.cpp index 7c2800b3..1f951b7b 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -202,7 +202,7 @@ namespace big // Trigger Script Event { "TSE", - "84 C9 0F 84 ? ? ? ? 48 89 5C 24 ? 48 89 74 24", + "48 8B C4 48 89 58 08 44 89 48 20 55 56 57 48 83 EC 30", [](memory::handle ptr) { g_pointers->m_gta.m_trigger_script_event = ptr.as(); diff --git a/src/services/script_connection/script_connection.cpp b/src/services/script_connection/script_connection.cpp index 45654b42..7e3203f3 100644 --- a/src/services/script_connection/script_connection.cpp +++ b/src/services/script_connection/script_connection.cpp @@ -64,14 +64,14 @@ namespace big args[2 + 17] = 1337; args[24] = scr_globals::gpbd_fm_3.as()->Entries[m_target->get()->id()].ScriptEventReplayProtectionCounter; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << m_target->get()->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << m_target->get()->id(), (int)eRemoteEvent::StartScriptBegin); for (int i = 0; i < 2; i++) { const size_t arg_count_2 = 25; int64_t args_2[arg_count_2] = {(int64_t)eRemoteEvent::StartScriptProceed, (int64_t)self::id}; args_2[2 + 17] = 1337; - g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << m_target->get()->id()); + g_pointers->m_gta.m_trigger_script_event(1, args_2, arg_count_2, 1 << m_target->get()->id(), (int)eRemoteEvent::StartScriptProceed); script::get_current()->yield(20ms); } diff --git a/src/util/globals.hpp b/src/util/globals.hpp index 4c5320e6..685a4656 100644 --- a/src/util/globals.hpp +++ b/src/util/globals.hpp @@ -16,7 +16,7 @@ namespace big::globals self::id, (int64_t)scr_globals::gpbd_fm_3.as()->Entries[target].ScriptEventReplayProtectionCounter}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target, (int)eRemoteEvent::ClearWantedLevel); } inline void give_remote_otr(Player target) @@ -30,7 +30,7 @@ namespace big::globals false, (int64_t)scr_globals::gpbd_fm_3.as()->Entries[target].ScriptEventReplayProtectionCounter}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target, (int)eRemoteEvent::RemoteOffradar); } inline Interior get_interior_from_player(Player player) diff --git a/src/util/session.hpp b/src/util/session.hpp index 4249b144..66d99e87 100644 --- a/src/util/session.hpp +++ b/src/util/session.hpp @@ -222,6 +222,6 @@ namespace big::session 0 // bParam3 }; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target, (int)eRemoteEvent::GiveCollectible); } } diff --git a/src/util/toxic.hpp b/src/util/toxic.hpp index 3cbce82c..f646dec7 100644 --- a/src/util/toxic.hpp +++ b/src/util/toxic.hpp @@ -48,7 +48,7 @@ namespace big::toxic const size_t arg_count = 4; int64_t args[arg_count] = {(int64_t)eRemoteEvent::StartActivity, (int64_t)self::id, (int64_t)type, (int64_t) true}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target->id()); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << target->id(), (int)eRemoteEvent::StartActivity); } inline bool set_time(player_ptr target, uint32_t millis) diff --git a/src/util/troll.hpp b/src/util/troll.hpp index b4609c06..664f29cb 100644 --- a/src/util/troll.hpp +++ b/src/util/troll.hpp @@ -33,7 +33,7 @@ namespace big::troll *scr_globals::gsbd_fm_events.at(9).as(), *scr_globals::gsbd_fm_events.at(10).as()}; - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, -1); + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, -1, (int)eRemoteEvent::Bounty); } } diff --git a/src/views/debug/view_debug_script_events.cpp b/src/views/debug/view_debug_script_events.cpp index 1b1b0de6..20d2bbcc 100644 --- a/src/views/debug/view_debug_script_events.cpp +++ b/src/views/debug/view_debug_script_events.cpp @@ -56,7 +56,7 @@ namespace big components::button("DEBUG_SCRIPT_EVENT_SEND_EVENT"_T, [] { args[1] = self::id;// prevent detection from AC - g_pointers->m_gta.m_trigger_script_event(1, args, event_arg_count, event_everyone ? -1 : 1 << event_player_bits); + g_pointers->m_gta.m_trigger_script_event(1, args, event_arg_count, event_everyone ? -1 : 1 << event_player_bits, args[0]); }); ImGui::EndTabItem();