diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index 17ce5fac..d44781bd 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -12,6 +12,8 @@ namespace big { looped::system_screen_size(); looped::system_update_players(); + + looped::system_update_pointers(); }QUEUE_JOB_END_CLAUSE QUEUE_JOB_BEGIN_CLAUSE() diff --git a/BigBaseV2/src/backend/looped/looped.hpp b/BigBaseV2/src/backend/looped/looped.hpp index 32a71fa2..6acb5465 100644 --- a/BigBaseV2/src/backend/looped/looped.hpp +++ b/BigBaseV2/src/backend/looped/looped.hpp @@ -16,6 +16,7 @@ namespace big static void self_no_ragdoll(); static void system_update_players(); + static void system_update_pointers(); static void system_screen_size(); static void weapons_cage_gun(); diff --git a/BigBaseV2/src/backend/looped/system/update_pointers.cpp b/BigBaseV2/src/backend/looped/system/update_pointers.cpp new file mode 100644 index 00000000..6cfda10e --- /dev/null +++ b/BigBaseV2/src/backend/looped/system/update_pointers.cpp @@ -0,0 +1,11 @@ +#include "backend/looped/looped.hpp" +#include "gta_util.hpp" + +namespace big +{ + void looped::system_update_pointers() + { + if (g_local_player == nullptr) + g_local_player = gta_util::get_local_ped(); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/common.hpp b/BigBaseV2/src/common.hpp index f2ab337c..6e54c262 100644 --- a/BigBaseV2/src/common.hpp +++ b/BigBaseV2/src/common.hpp @@ -51,8 +51,9 @@ #include "logger.hpp" #include "core/globals.hpp" +#include "core/class/CPed.hpp" #include "gta/player.hpp" -// #include "settings.h" + namespace big { @@ -65,4 +66,6 @@ namespace big inline HANDLE g_main_thread{}; inline DWORD g_main_thread_id{}; inline std::atomic_bool g_running{ true }; + + inline CPed* g_local_player; } diff --git a/BigBaseV2/src/gta_util.hpp b/BigBaseV2/src/gta_util.hpp index 0d00d408..16b1288c 100644 --- a/BigBaseV2/src/gta_util.hpp +++ b/BigBaseV2/src/gta_util.hpp @@ -1,7 +1,7 @@ #pragma once #include "common.hpp" #include "gta/array.hpp" -#include "gta/ped_factory.hpp" +#include "core/class/CPedFactory.hpp" #include "gta/player.hpp" #include "gta/script_thread.hpp" #include "gta/tls_context.hpp" @@ -25,7 +25,7 @@ namespace big::gta_util { if (auto ped = ped_factory->m_local_ped) { - return ped->m_playerinfo; + return ped->m_player_info; } }