From 0bf069ad999d6fd6d9e4b4ac24d87b624e8f6e65 Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Tue, 19 Mar 2024 05:33:50 -0400 Subject: [PATCH] Fixed hooks::scripted_game_event using incorrect types and sizes. (#2844) --- src/hooks/protections/script_event_handler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hooks/protections/script_event_handler.cpp b/src/hooks/protections/script_event_handler.cpp index 0ebfc8a8..b9d252f2 100644 --- a/src/hooks/protections/script_event_handler.cpp +++ b/src/hooks/protections/script_event_handler.cpp @@ -59,7 +59,8 @@ namespace big bool hooks::scripted_game_event(CScriptedGameEvent* scripted_game_event, CNetGamePlayer* player) { - const auto args = scripted_game_event->m_args; + const auto args = scripted_game_event->m_args; + const auto args_count = scripted_game_event->m_args_size / 8; const auto hash = static_cast(args[0]); const auto player_name = player->get_name(); @@ -70,8 +71,8 @@ namespace big { std::vector script_event_args; - script_event_args.reserve(scripted_game_event->m_args_size); - for (int i = 0; i < scripted_game_event->m_args_size; i++) + script_event_args.reserve(args_count); + for (int i = 0; i < args_count; i++) script_event_args.push_back(args[i]); auto event_ret = g_lua_manager->trigger_event((int)player->m_player_id, script_event_args); @@ -432,7 +433,7 @@ namespace big && (!g.debug.logs.script_event.filter_player || g.debug.logs.script_event.player_id == player->m_player_id)) { std::string script_args = "{ "; - for (std::size_t i = 0; i < scripted_game_event->m_args_size; i++) + for (int i = 0; i < args_count; i++) { if (i) script_args += ", ";