add: player esp fix: many stuff

This commit is contained in:
ALittlePatate
2022-10-02 19:07:31 +02:00
parent f66aa4aebe
commit 69ba735d96
9 changed files with 74 additions and 5 deletions

View File

@@ -21,6 +21,12 @@ void OnUpdate() {
if (settings::server_name_spoof) {
Misc::SetServerName(settings::server_name);
}
Misc::UnlimitedUV(settings::unlimited_uv);
if (settings::unlimited_uv) {
settings::unlimited_uv_reset = true;
Misc::UnlimitedUV(settings::unlimited_uv);
}
if (!settings::unlimited_uv && settings::unlimited_uv_reset) {
Misc::UnlimitedUV(false);
settings::unlimited_uv_reset = false;
}
}

View File

@@ -303,6 +303,7 @@
<ClInclude Include="Dependencies\Minhook\src\HDE\table64.h" />
<ClInclude Include="Dependencies\Minhook\src\trampoline.h" />
<ClInclude Include="dllmain.hpp" />
<ClInclude Include="Features\ESP\ESP.hpp" />
<ClInclude Include="Features\Menu.hpp" />
<ClInclude Include="Features\Misc\Misc.hpp" />
<ClInclude Include="framework.h" />
@@ -346,6 +347,7 @@
<ClCompile Include="Dependencies\Minhook\src\hook.c" />
<ClCompile Include="Dependencies\Minhook\src\trampoline.c" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="Features\ESP\ESP.cpp" />
<ClCompile Include="Features\Menu.cpp" />
<ClCompile Include="Features\Misc\Misc.cpp" />
<ClCompile Include="Hooks\Hooks.cpp" />

View File

@@ -0,0 +1,48 @@
#include "ESP.hpp"
#include "../../Utils/Settings/Settings.hpp"
#include "../../Utils/Players/Players.hpp"
#include "../../Dependencies/IL2CPP_Resolver/il2cpp_resolver.hpp"
#include "../../Utils/Output/Output.hpp"
void ESP::PlayerESP() {
IL2CPP::Thread::Attach(IL2CPP::Domain::Get());
while (1) {
if (settings::player_esp || settings::player_snaplines) {
for (Unity::CGameObject* player : Players::PlayerList) {
if (!player) {
continue;
}
Unity::Vector3 pivotPos = player->GetComponent("Transform")->GetMemberValue<Unity::Vector3>("position");
Unity::Vector3 playerFootPos;
playerFootPos.x = pivotPos.x;
playerFootPos.z = pivotPos.z;
playerFootPos.y = pivotPos.y - 2.f; //At the feet
Unity::Vector3 playerHeadPos;
playerHeadPos.x = pivotPos.x;
playerHeadPos.z = pivotPos.z;
playerHeadPos.y = pivotPos.y + 2.f; //At the head
Unity::CGameObject* Camera = Unity::GameObject::Find("Camera");
if (!Camera) {
continue;
}
Unity::CComponent* CameraMain = Camera->GetComponent("Camera");
if (!CameraMain) {
continue;
}
std::vector<Unity::il2cppFieldInfo*> fields;
CameraMain->FetchFields(&fields);
for (Unity::il2cppFieldInfo* field : fields) {
print("--> %s\n", field->m_pName);
}
}
}
}
}

View File

@@ -0,0 +1,5 @@
#pragma once
namespace ESP {
void PlayerESP();
}

View File

@@ -1,8 +1,13 @@
#include "Misc.hpp"
#include "../../Utils/Output/Output.hpp"
#include <time.h>
void Misc::SetRank(int rank) {
Players::LocalPlayer->GetComponent("NolanRankController")->CallMethodSafe<void*>("SetRank", rank);
Unity::CComponent* NolanRankController = Players::LocalPlayer->GetComponent("NolanRankController");
if (!NolanRankController) {
return;
}
NolanRankController->CallMethodSafe<void*>("SetRank", rank);
}
void Misc::WalkInlobby(bool walk) {
@@ -29,7 +34,6 @@ void Misc::UnlimitedUV(bool active) {
}
catch (...) {
settings::unlimited_uv = false;
print("Unlimited UV error");
}
}

View File

@@ -13,7 +13,7 @@ void Players::GetPlayersThread() {
* Used as a "cache" - sorta
* I use this instead of my good old corroutine
*/
IL2CPP::Thread::Attach(IL2CPP::Domain::Get());
while (1) {
PlayerList.clear();

View File

@@ -5,6 +5,7 @@ namespace settings {
float flashlight_color[4] = { 255.f, 255.f, 255.f, 255.f };
bool unlimited_uv = false;
bool unlimited_uv_reset = true;
bool fullbright = false;
bool player_esp = false;

View File

@@ -9,6 +9,7 @@ namespace settings {
extern float flashlight_color[4];
extern bool unlimited_uv;
extern bool unlimited_uv_reset;
extern bool fullbright;
extern bool player_esp;

View File

@@ -9,6 +9,7 @@
#include "Utils/Output/Output.hpp"
#include "Callbacks/OnUpdate.hpp"
#include "Utils/Players/Players.hpp"
#include "Features/ESP/ESP.hpp"
#include <IL2CPP_Resolver/il2cpp_resolver.hpp>
@@ -64,6 +65,7 @@ DWORD WINAPI Main() {
IL2CPP::Callback::OnUpdate::Add(OnUpdate);
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Players::GetPlayersThread, 0, 0, 0);
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ESP::PlayerESP, 0, 0, 0); //running in a different thread to help performance
return TRUE;
}