diff --git a/memory-external/hacks/hack.hpp b/memory-external/hacks/hack.hpp index 85be195..03c9a75 100644 --- a/memory-external/hacks/hack.hpp +++ b/memory-external/hacks/hack.hpp @@ -26,6 +26,9 @@ namespace hack { }; void loop() { + + std::lock_guard lock(dataMutex); + if (g_game.isC4Planted) { Vector3 c4Origin = g_game.c4.get_origin(); diff --git a/memory-external/hacks/reader.cpp b/memory-external/hacks/reader.cpp index 164ce54..a51589a 100644 --- a/memory-external/hacks/reader.cpp +++ b/memory-external/hacks/reader.cpp @@ -68,6 +68,9 @@ void CGame::close() { } void CGame::loop() { + + std::lock_guard lock(dataMutex); + inGame = false; isC4Planted = false; diff --git a/memory-external/hacks/reader.hpp b/memory-external/hacks/reader.hpp index 7141a97..d25b249 100644 --- a/memory-external/hacks/reader.hpp +++ b/memory-external/hacks/reader.hpp @@ -3,6 +3,7 @@ #include "../classes/vector.hpp" #include #include +#include struct view_matrix_t { float* operator[ ](int index) { @@ -74,4 +75,6 @@ private: uintptr_t localList_entry2; }; -inline CGame g_game; \ No newline at end of file +inline CGame g_game; + +inline std::mutex dataMutex; \ No newline at end of file