0% found this document useful (0 votes)
188 views17 pages

Aimbot

Uploaded by

greenzetsu88854
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views17 pages

Aimbot

Uploaded by

greenzetsu88854
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 17

bool section ***

bool AIMBUTTON;
bool Aim_Menuu;

struct sAimMenu {
bool Enable;
int Meter;
bool Pov;
bool Pred;
bool Recoil;
bool Aimbot;
int Cross;
int Position;
float Recc;
EAimTarget Target;
EAimTrigger Trigger;
bool IgnoreKnocked;
bool VisCheck;
bool IgnoreBots;
bool TargetLine;};
sAimMenu SilentAim{0};
sAimMenu AimBot{0};
};

#include "IMAGE/Aim_off.h"
#include "IMAGE/Aim_on.h"

#define W2S(w, s) UGameplayStatics::ProjectWorldToScreen(localController, w, true,


s)
bool isInsideFOV(int x, int y) {
if (!Config.SilentAim.Cross)
return true;
int circle_x = glWidth / 2;
int circle_y = glHeight / 2;
int rad = Config.SilentAim.Cross*0.5f;
return (x - circle_x) * (x - circle_x) + (y - circle_y) * (y - circle_y) <=
rad * rad;
}

auto GetTargetByCrossDist() {
ASTExtraPlayerCharacter *result = 0;
float max = std::numeric_limits<float>::infinity();
auto Actors = getActors();
auto localPlayer = g_LocalPlayer;
auto localController = g_LocalController;
if (localPlayer) {
for (int i = 0; i < Actors.size(); i++) {
auto Actor = Actors[i];
if (isObjectInvalid(Actor))
continue;
if (Actor->IsA(ASTExtraPlayerCharacter::StaticClass())) {
auto Player = (ASTExtraPlayerCharacter *)Actor;
auto Target = (ASTExtraPlayerCharacter *) Actor;
float dist = localPlayer->GetDistanceTo(Target) / 100.0f;
if (dist > Config.SilentAim.Meter)
continue;
if (Player->PlayerKey == localPlayer->PlayerKey)
continue;
if (Player->TeamID == localPlayer->TeamID)
continue;
if (Player->bDead)
continue;
if (Config.SilentAim.IgnoreKnocked) {
if (Player->Health == 0.0f)
continue;}
if (Config.SilentAim.VisCheck) {
if (!localController->LineOfSightTo(Player, {0, 0, 0}, true))
continue;}
if (Config.SilentAim.IgnoreBots) {
if (Player->bEnsure)
continue;}
auto Root = Player->GetBonePos("Root", {});
auto Head = Player->GetBonePos("Head", {});
FVector2D RootSc, HeadSc;
if (W2S(Root, &RootSc) && W2S(Head, &HeadSc)) {
float height = abs(HeadSc.Y - RootSc.Y);
float width = height * 0.65f;
FVector middlePoint = {HeadSc.X + (width / 2), HeadSc.Y + (height / 2), 0};
if ((middlePoint.X >= 0 && middlePoint.X <= glWidth) && (middlePoint.Y >= 0
&& middlePoint.Y <= glHeight)) {
FVector2D v2Middle = FVector2D((float) (glWidth / 2), (float) (glHeight /
2));
FVector2D v2Loc = FVector2D(middlePoint.X, middlePoint.Y);
if (isInsideFOV((int) middlePoint.X, (int) middlePoint.Y)) {
float dist = FVector2D::Distance(v2Middle, v2Loc);
if (dist < max) {
max = dist;
result = Player;
}}}}}}}return result;}

bool isInsideFOVA(int x, int y) {


if (!Config.AimBot.Cross)
return true;
int circle_x = glWidth / 2;
int circle_y = glHeight / 2;
int rad = Config.AimBot.Cross*0.5f;
return (x - circle_x) * (x - circle_x) + (y - circle_y) * (y - circle_y) <=
rad * rad;
}
auto GetTargetForAimBot() {
ASTExtraPlayerCharacter *result = 0;
float max = std::numeric_limits<float>::infinity();
auto Actors = getActors();
auto localPlayer = g_LocalPlayer;
auto localController = g_LocalController;
if (localPlayer) {
for (auto Actor : Actors) {
if (isObjectInvalid(Actor))
continue;
if (Actor->IsA(ASTExtraPlayerCharacter::StaticClass())) {
auto Player = (ASTExtraPlayerCharacter *) Actor;
auto Target = (ASTExtraPlayerCharacter *) Actor;
float dist = localPlayer->GetDistanceTo(Target) / 100.0f;
if (dist > Config.AimBot.Meter)
continue;
if (Player->PlayerKey == localPlayer->PlayerKey)
continue;
if (Player->TeamID == localPlayer->TeamID)
continue;
if (Player->bDead)
continue;
if (Config.AimBot.IgnoreKnocked) {
if (Player->Health == 0.0f)
continue;}
if (Config.AimBot.VisCheck) {
if (!localController->LineOfSightTo(Player, {0, 0, 0}, true))
continue;}
if (Config.AimBot.IgnoreBots) {
if (Player->bEnsure)
continue;}
auto Root = Player->GetBonePos("Root", {});
auto Head = Player->GetBonePos("Head", {});
FVector2D RootSc, HeadSc;
if (W2S(Root, &RootSc) && W2S(Head, &HeadSc)) {
float height = abs(HeadSc.Y - RootSc.Y);
float width = height * 0.65f;
FVector middlePoint = {HeadSc.X + (width / 2), HeadSc.Y + (height / 2), 0};
if ((middlePoint.X >= 0 && middlePoint.X <= glWidth) && (middlePoint.Y >= 0
&& middlePoint.Y <= glHeight)) {
FVector2D v2Middle = FVector2D((float) (glWidth / 2), (float) (glHeight /
2));
FVector2D v2Loc = FVector2D(middlePoint.X, middlePoint.Y);
if (isInsideFOVA((int) middlePoint.X, (int) middlePoint.Y)) {
float dist = FVector2D::Distance(v2Middle, v2Loc);
if (dist < max) {
max = dist;
result = Player;
}}}}}}}return result;}

bool triggerOk = false;


if (Config.SilentAim.Trigger != EAimTrigger::None) {
if (Config.SilentAim.Trigger == EAimTrigger::Shooting) {
triggerOk = g_LocalPlayer->bIsWeaponFiring;
} else if (Config.SilentAim.Trigger == EAimTrigger::Scoping) {
triggerOk = g_LocalPlayer->bIsGunADS;
} else if (Config.SilentAim.Trigger == EAimTrigger::Both) {
triggerOk = g_LocalPlayer->bIsWeaponFiring && g_LocalPlayer-
>bIsGunADS;
} else if (Config.SilentAim.Trigger == EAimTrigger::Any) {
triggerOk = g_LocalPlayer->bIsWeaponFiring || g_LocalPlayer-
>bIsGunADS;
}} else triggerOk = true;
if (triggerOk) {
FVector targetAimPos = Target->GetBonePos("Head", {});
targetAimPos.Z += 15.f;
if (Config.SilentAim.Target == EAimTarget::Chest) {
targetAimPos.Z -= 25.0f;}
UShootWeaponEntity *ShootWeaponEntityComponent = thiz-
>ShootWeaponEntityComponent;
if (ShootWeaponEntityComponent) {
if (Config.SilentAim.Pred) {
ASTExtraVehicleBase *CurrentVehicle = Target->CurrentVehicle;
if (CurrentVehicle) {
FVector LinearVelocity = CurrentVehicle->ReplicatedMovement.LinearVelocity;
float dist = g_LocalPlayer->GetDistanceTo(Target);
auto timeToTravel = dist / ShootWeaponEntityComponent->BulletFireSpeed;
targetAimPos = UKismetMathLibrary::Add_VectorVector(targetAimPos,
UKismetMathLibrary::Multiply_VectorFloat(LinearVelocity, timeToTravel));
targetAimPos.Z += LinearVelocity.Z * timeToTravel + 0.5 * Config.Line *
timeToTravel * timeToTravel;
} else {
FVector Velocity = Target->GetVelocity();

float dist = g_LocalPlayer->GetDistanceTo(Target);

auto timeToTravel = dist / ShootWeaponEntityComponent->BulletFireSpeed;


targetAimPos = UKismetMathLibrary::Add_VectorVector(targetAimPos,
UKismetMathLibrary::Multiply_VectorFloat(Velocity, timeToTravel));
targetAimPos.Z += Velocity.Z * timeToTravel + 0.5 * Config.Line *
timeToTravel * timeToTravel;
}}
FVector fDir = UKismetMathLibrary::Subtract_VectorVector(targetAimPos,
g_LocalController->PlayerCameraManager->CameraCache.POV.Location);
rot = UKismetMathLibrary::Conv_VectorToRotator(fDir);
}}}}return orig_shoot_event(thiz, start, rot, weapon, unk1);}

circle*****

void Line(ImDrawList *draw,FVector2D origin, FVector2D dest, ImColor color)


{draw->AddLine({origin.X, origin.Y},{dest.X, dest.Y},color, 1.0f);}
void Box3D(ImDrawList *draw, Vector3 origin, Vector3 extends, ImColor col) {
origin -= extends / 2;
Vector3 one = origin;
Vector3 two = origin; two.X += extends.X;
Vector3 tree = origin; tree.X += extends.X; tree.Y += extends.Y;
Vector3 four = origin; four.Y += extends.Y;
Vector3 five = one; five.Z += extends.Z;
Vector3 six = two; six.Z += extends.Z;
Vector3 seven = tree; seven.Z += extends.Z;
Vector3 eight = four; eight.Z += extends.Z;
FVector2D s1, s2, s3, s4, s5, s6, s7, s8;
Line(draw,s1, s2, col);
Line(draw,s2, s3, col);
Line(draw,s3, s4, col);
Line(draw,s4, s1, col);
Line(draw,s5, s6, col);
Line(draw,s6, s7, col);
Line(draw,s7, s8, col);
Line(draw,s8, s5, col);
Line(draw,s1, s5, col);
Line(draw,s2, s6, col);
Line(draw,s3, s7, col);
Line(draw,s4, s8, col);}

void DrawBoxEnemy(ImDrawList *draw, ImVec2 X, ImVec2 Y, float thicc, float


rounding, int color) {
draw->AddLine({X.x, X.y}, {Y.x, Y.y}, color, thicc);}

void Box4Line(ImDrawList *draw, float thicc, int x, int y, int w, int h, int color)
{
int iw = w / 4;
int ih = h / 4;
draw->AddRect(ImVec2(x, y),ImVec2(x + iw, y), color, thicc);
draw->AddRect(ImVec2(x + w - iw, y),ImVec2(x + w, y), color, thicc);
draw->AddRect(ImVec2(x, y),ImVec2(x, y + ih), color, thicc);
draw->AddRect(ImVec2(x + w - 1, y),ImVec2(x + w - 1, y + ih), color, thicc);;
draw->AddRect(ImVec2(x, y + h),ImVec2(x + iw, y + h), color, thicc);
draw->AddRect(ImVec2(x + w - iw, y + h),ImVec2(x + w, y + h), color, thicc);
draw->AddRect(ImVec2(x, y + h - ih), ImVec2(x, y + h), color, thicc);
draw->AddRect(ImVec2(x + w - 1, y + h - ih), ImVec2(x + w - 1, y + h), color,
thicc);
}

void Box3D(ImDrawList *draw, FVector origin, FVector extends, ImColor col) {


origin.X -= extends.X / 2.f;
origin.Y -= extends.Y / 2.f;
origin.Z -= extends.Z / 2.f;
FVector one = origin;
FVector two = origin; two.X += extends.X;
FVector tree = origin; tree.X += extends.X; tree.Y += extends.Y;
FVector four = origin; four.Y += extends.Y;
FVector five = one; five.Z += extends.Z;
FVector six = two; six.Z += extends.Z;
FVector seven = tree; seven.Z += extends.Z;
FVector eight = four; eight.Z += extends.Z;
FVector2D s1, s2, s3, s4, s5, s6, s7, s8;
if (W2S2(one, &s1) && W2S2(two, &s2) && W2S2(tree, &s3) && W2S2(four, &s4)
&&
W2S2(five, &s5) && W2S2(six, &s6) && W2S2(seven, &s7) && W2S2(eight, &s8)){
Line(draw,s1, s2, col);
Line(draw,s2, s3, col);
Line(draw,s3, s4, col);
Line(draw,s4, s1, col);
Line(draw,s5, s6, col);
Line(draw,s6, s7, col);
Line(draw,s7, s8, col);
Line(draw,s8, s5, col);
Line(draw,s1, s5, col);
Line(draw,s2, s6, col);
Line(draw,s3, s7, col);
Line(draw,s4, s8, col);
}}

void Box3DV(ImDrawList *draw, Vector3 origin, Vector3 extends, ImColor col) {


origin -= extends / 2;
Vector3 one = origin;
Vector3 two = origin; two.X += extends.X;
Vector3 tree = origin; tree.X += extends.X; tree.Y += extends.Y;
Vector3 four = origin; four.Y += extends.Y;
Vector3 five = one; five.Z += extends.Z;
Vector3 six = two; six.Z += extends.Z;
Vector3 seven = tree; seven.Z += extends.Z;
Vector3 eight = four; eight.Z += extends.Z;
FVector2D s1, s2, s3, s4, s5, s6, s7, s8;
Line(draw,s1, s2, col);
Line(draw,s2, s3, col);
Line(draw,s3, s4, col);
Line(draw,s4, s1, col);
Line(draw,s5, s6, col);
Line(draw,s6, s7, col);
Line(draw,s7, s8, col);
Line(draw,s8, s5, col);
Line(draw,s1, s5, col);
Line(draw,s2, s6, col);
Line(draw,s3, s7, col);
Line(draw,s4, s8, col);
}

after login*****

if(ImGui::OptButton1("Aim Menu", ImVec2(140,40))) {Aim_Menuu = true;Esp_Menuu =


false;Skin_Menuu = false;Item_Menuu = false;}
ImGui::SameLine();

ImGui::SliderFloat("Aimbot Smoothness", &AimSmooth, 1.0f, 10.0f,"%.3f"

bool Aimbot;
sAimMenu SilentAim{0};
sAimMenu AimBot{0};

bool isInsideFOVA(int x, int y) {


if (!Config.AimBot.Cross)
return true;
int circle_x = glWidth / 2;
int circle_y = glHeight / 2;
int rad = Config.AimBot.Cross*0.5f;
return (x - circle_x) * (x - circle_x) + (y - circle_y) * (y - circle_y) <=
rad * rad;
}
auto GetTargetForAimBot() {
ASTExtraPlayerCharacter *result = 0;
float max = std::numeric_limits<float>::infinity();
auto Actors = getActors();
auto localPlayer = g_LocalPlayer;
auto localController = g_LocalController;
if (localPlayer) {
for (auto Actor : Actors) {
if (isObjectInvalid(Actor))
continue;
if (Actor->IsA(ASTExtraPlayerCharacter::StaticClass())) {
auto Player = (ASTExtraPlayerCharacter *) Actor;
auto Target = (ASTExtraPlayerCharacter *) Actor;
float dist = localPlayer->GetDistanceTo(Target) / 100.0f;
if (dist > Config.AimBot.Meter)
continue;
if (Player->PlayerKey == localPlayer->PlayerKey)
continue;
if (Player->TeamID == localPlayer->TeamID)
continue;
if (Player->bDead)
continue;
if (Config.AimBot.IgnoreKnocked) {
if (Player->Health == 0.0f)
continue;}
if (Config.AimBot.VisCheck) {
if (!localController->LineOfSightTo(Player, {0, 0, 0}, true))
continue;}
if (Config.AimBot.IgnoreBots) {
if (Player->bEnsure)
continue;}
auto Root = Player->GetBonePos("Root", {});
auto Head = Player->GetBonePos("Head", {});
FVector2D RootSc, HeadSc;
if (W2S(Root, &RootSc) && W2S(Head, &HeadSc)) {
float height = abs(HeadSc.Y - RootSc.Y);
float width = height * 0.65f;
FVector middlePoint = {HeadSc.X + (width / 2), HeadSc.Y + (height / 2), 0};
if ((middlePoint.X >= 0 && middlePoint.X <= glWidth) && (middlePoint.Y >= 0
&& middlePoint.Y <= glHeight)) {
FVector2D v2Middle = FVector2D((float) (glWidth / 2), (float) (glHeight /
2));
FVector2D v2Loc = FVector2D(middlePoint.X, middlePoint.Y);
if (isInsideFOVA((int) middlePoint.X, (int) middlePoint.Y)) {
float dist = FVector2D::Distance(v2Middle, v2Loc);
if (dist < max) {
max = dist;
result = Player;
}}}}}}}return result;}

if (Config.AimBot.Enable) {
ASTExtraPlayerCharacter *Target = GetTargetForAimBot();
if (Target) {
bool triggerOk = false;
if (Config.AimBot.Trigger != EAimTrigger::None) {
if (Config.AimBot.Trigger == EAimTrigger::Shooting) {
triggerOk = localPlayer->bIsWeaponFiring;
} else if (Config.AimBot.Trigger ==
EAimTrigger::Scoping) {
triggerOk = localPlayer->bIsGunADS;
} else if (Config.AimBot.Trigger == EAimTrigger::Both)
{
triggerOk = localPlayer->bIsWeaponFiring &&
localPlayer->bIsGunADS;
} else if (Config.AimBot.Trigger == EAimTrigger::Any) {
triggerOk = localPlayer->bIsWeaponFiring ||
localPlayer->bIsGunADS;
}
} else triggerOk = true;
if (triggerOk){
FVector targetAimPos = Target->GetBonePos("Head", {});
if (Config.AimBot.Target == EAimTarget::Chest){
targetAimPos.Z -= 29.55f;
targetAimPos.Y -= 1.224f;}

auto WeaponManagerComponent = localPlayer-


>WeaponManagerComponent;
if (WeaponManagerComponent) {
auto propSlot = WeaponManagerComponent-
>GetCurrentUsingPropSlot();
if ((int) propSlot.GetValue() >= 1 &&
(int) propSlot.GetValue() <= 3) {
auto CurrentWeaponReplicated =
(ASTExtraShootWeapon *) WeaponManagerComponent->CurrentWeaponReplicated;
if (CurrentWeaponReplicated) {
auto ShootWeaponComponent =
CurrentWeaponReplicated->ShootWeaponComponent;
if (ShootWeaponComponent) {
UShootWeaponEntity
*ShootWeaponEntityComponent = ShootWeaponComponent->ShootWeaponEntityComponent;
if (ShootWeaponEntityComponent) {
ASTExtraVehicleBase *CurrentVehicle
= Target->CurrentVehicle;
if (CurrentVehicle) {
FVector LinearVelocity =
CurrentVehicle->ReplicatedMovement.LinearVelocity;
float dist = localPlayer-
>GetDistanceTo(Target);
auto timeToTravel = dist /

ShootWeaponEntityComponent->BulletFireSpeed;
targetAimPos =
UKismetMathLibrary::Add_VectorVector(
targetAimPos,

UKismetMathLibrary::Multiply_VectorFloat(
LinearVelocity,
timeToTravel));
} else {
FVector Velocity = Target-
>GetVelocity();
float dist = localPlayer-
>GetDistanceTo(Target);
auto timeToTravel = dist /

ShootWeaponEntityComponent->BulletFireSpeed;
targetAimPos =
UKismetMathLibrary::Add_VectorVector(
targetAimPos,

UKismetMathLibrary::Multiply_VectorFloat(
Velocity,
timeToTravel));}

if (Config.AimBot.Recoil) {
if (g_LocalPlayer->bIsGunADS) {
if (g_LocalPlayer->bIsWeaponFiring) {
float dist = g_LocalPlayer->GetDistanceTo(Target) / 100.f;

targetAimPos.Z -= dist * Config.AimBot.Recc;}}}

FVector fDir =
UKismetMathLibrary::Subtract_VectorVector(targetAimPos, g_LocalController-
>PlayerCameraManager->CameraCache.POV.Location);
FRotator Yaptr =
UKismetMathLibrary::Conv_VectorToRotator(fDir);
FRotator CpYaT = localController-
>PlayerCameraManager->CameraCache.POV.Rotation;
Yaptr.Pitch -= CpYaT.Pitch;
Yaptr.Yaw -= CpYaT.Yaw;
Yaptr.Roll = 0.f;
IMGUI_GOD(Yaptr);
CpYaT.Pitch += Yaptr.Pitch / AimSmooth;

CpYaT.Yaw += Yaptr.Yaw / AimSmooth;


CpYaT.Roll = 0.f;
localController-
>SetControlRotation(CpYaT,"");
}}}}}}}}

other file. jsonPreferences.h *******""

#pragma once

#include <fstream>
#include "json.hpp"
android_app *g_App = nullptr;
using json = nlohmann::json;

struct JsonPreferences {

enum EAimTarget {
Head = 0,
Chest = 1
};

enum EAimTrigger {
None = 0,
Shooting = 1,
Scoping = 2,
Both = 3,
Any = 4
};

enum EAimPriority {
DistancePriority = 0,
FOVPriority = 1
};

std::map<int, bool> Items;

sESPMenu ESPMenu{false};

struct sAimMenu {
bool EnableAllHack;
bool Enable;
bool Autofire;
bool AimBot;
bool CameraCache;
EAimTarget Target;
EAimTrigger Trigger;
EAimPriority Priority;
bool IgnoreKnocked;
bool IgnoreBot;

friend void to_json(json &j, const JsonPreferences &p) {


{("AimBullet"), p.Config.SilentAim.Enable},
{("AimBot"), p.Config.SilentAim.AimBot},
{("##Target"), p.Config.SilentAim.Target},
{("##Trigger"), p.Config.SilentAim.Trigger},
{("Ignore Knocked"), p.Config.SilentAim.IgnoreKnocked},
{("Ignore Bot"), p.Config.SilentAim.IgnoreBot},
};

friend void from_json(const json &j, JsonPreferences &p) {


if (j.find(("Ignore Knocked")) != j.end()) {
j.at(("Ignore Knocked")).get_to(p.Config.SilentAim.IgnoreKnocked);
}
if (j.find(("Ignore Bot")) != j.end()) {
j.at(("Ignore Bot")).get_to(p.Config.SilentAim.IgnoreBot);

if (j.find(("AimBullet")) != j.end()) {
j.at(("AimBullet")).get_to(p.Config.SilentAim.Enable);
}
if (j.find(("AimBot")) != j.end()) {
j.at(("AimBot")).get_to(p.Config.SilentAim.AimBot);
}
};

std::string GetFilesDirShit() {
if (!g_App)
return "";

auto activity = g_App->activity;


if (!activity)
return "";

auto vm = activity->vm;
if (!vm)
return "";

auto object = activity->clazz;


if (!object)
return "";

std::string FileDirReal;

JNIEnv *env;
vm->AttachCurrentThread(&env, nullptr);
{
auto wrapper_class =
env->FindClass(("android/content/ContextWrapper"));
auto methodID = env->GetMethodID(wrapper_class, ("getFilesDir"),
("()Ljava/io/File;"));
auto objectFile = env->CallObjectMethod(object, methodID);

auto classFile = env->GetObjectClass(objectFile);


auto methodIDPath = env->GetMethodID(classFile, ("getAbsolutePath"),
("()Ljava/lang/String;"));
auto stringPath = (jstring) env->CallObjectMethod(objectFile,
methodIDPath);
auto m_FilesDir = env->GetStringUTFChars(stringPath, nullptr);

FileDirReal += m_FilesDir;
FileDirReal += ("/Config.json");
env->ReleaseStringUTFChars(stringPath, m_FilesDir);

//LOGI("GetFilesDirShit %s", FileDirReal.c_str());


}
vm->DetachCurrentThread();

return FileDirReal;
}

bool isStateChanged = false;


////////////////////////////////////////////////////////////////

void load() {
std::ifstream ifs(GetFilesDirShit().c_str());
if (ifs.good()) {
json j = json::parse(ifs);
*this = j.get<JsonPreferences>();
} else
LOGI("Failed to load preferences from %s", GetFilesDirShit().c_str());
}

void save() {
try {
json j = *this;
std::ofstream ofs(GetFilesDirShit().c_str());
ofs << std::setw(4) << j.dump() << std::endl;
} catch (std::exception &e) {
LOGI("Failed to save preferences from %s", GetFilesDirShit().c_str());
}
}

} preferences;

in main.cpp*****

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <string>
#include <regex>

using namespace std;

void FindSdkOffset(const string& SdkPath, const string& ClassName, const string&


SearchString, vector<string>& results, string VarName) {
ifstream file(SdkPath, ios::binary);
if (!file) {
cout << "Error opening file: " << SdkPath << endl;
return;
}

bool ClassNameFound = false;

string line;
while (getline(file, line)) {

if (!ClassNameFound && line.find(ClassName) != string::npos) {


ClassNameFound = true;
continue;
}

if (ClassNameFound && line.find(SearchString) != string::npos) {


std::regex offsetRegex("Offset: (0x[0-9a-fA-F]+),");
std::smatch offsetMatch;

if (std::regex_search(line, offsetMatch, offsetRegex)) {


if (offsetMatch.size() == 2) {
std::string offsetValue = "const uintptr_t " +
VarName + " = " + offsetMatch[1].str() + ";";
results.push_back(offsetValue);
}
else {
std::cout << "Invalid offset match." << std::endl;
}
}
else {
std::cout << "Offset not found in the input string." <<
std::endl;
}

break;
}
}

file.close();
}
int main(int argc, const char* argv[]) {
string SdkPath = argv[1];
string ClassName_1 = "Class:
StaticMeshComponent.MeshComponent.PrimitiveComponent.SceneComponent.ActorComponent.
Object";
string SearchString_1 = "int NoneAIGameTime;//[Offset:";
vector<string> results_1;
FindSdkOffset(SdkPath, ClassName_1, SearchString_1, results_1, "MinLOD");

std::vector<std::tuple<std::string, std::string, std::string>> formats = {


{"Class: World.Object", "GameStateBase* GameState;//[Offset:",
"GameState"},
{"Class:
STExtraGameStateBase.UAEGameState.LuaGameState.GameState.GameStateBase.Info.Actor.O
bject", "int AlivePlayerNum;//[Offset:", "AlivePlayerNum"},
{"Class: GameState.GameStateBase.Info.Actor.Object", "int
ElapsedTime;//[Offset:", "ElapsedTime"},
{"", "int NoneAIGameTime;//[Offset: ", "NoneAIGameTime"},
{"", "int PlayerNum;//[Offset:", "PlayerNum"},
{"", "int PlayerNum;//[Offset:", "RealPlayerNum"},
{"", "int AliveTeamNum;//[Offset:", "AliveTeamNum"},
{"Class:
STExtraGameStateBase.UAEGameState.LuaGameState.GameState.GameStateBase.Info.Actor.O
bject", "int PlayerNumPerTeam;//[Offset:", "PlayerNumPerTeam"},
{"Class:
STExtraGameStateBase.UAEGameState.LuaGameState.GameState.GameStateBase.Info.Actor.O
bject", "FString GameModeID;//[Offset: ", "GameModeID"},
{"", "int CurCircleWave;//[Offset: ", "CurCircleWave"},
{"", "int GameReplayType;//[Offset:", "GameReplayType"},

{"lass: Pawn.Actor.Object", "PlayerState* PlayerState;//[Offset:",


"PlayerState"},
{"Class: UAEPlayerState.LuaPlayerState.PlayerState.Info.Actor.Object",
"int Kills;//[Offset:", "PlayerKills"},
{"Class: UAEPlayerState.LuaPlayerState.PlayerState.Info.Actor.Object",
"FString Nation;//[Offset:", "PlayerNation"},
{"Class: UAEPlayerState.LuaPlayerState.PlayerState.Info.Actor.Object",
"int TeamID;//[Offset:", "PlayerTeamID"},
{"Class: UAEPlayerState.LuaPlayerState.PlayerState.Info.Actor.Object",
"int PlayerLevel;//[Offset:", "PlayerLevel"},
{"Class: UAEPlayerState.LuaPlayerState.PlayerState.Info.Actor.Object",
"FString PlayerUID;//[Offset:", "PlayerPlayerUID"},

{"Class: PlayerState.Info.Actor.Object", "FString


PlayerName;//[Offset:", "PlayerName"},
{"Class:
STExtraPlayerState.UAEPlayerState.LuaPlayerState.PlayerState.Info.Actor.Object",
"float PlayerHealth;//[Offset:", "PlayerHealth"},

{"Class: World.Object", "Level* PersistentLevel;//[Offset:",


"PersistentLevel"},
{"Class: World.Object", "NetDriver* NetDriver;//[Offset:",
"NetDriver"},
{"", "NetConnection* ServerConnection;//[Offset:", "ServerConnection"},
{"Class: Player.Object", "PlayerController*
PlayerController;//[Offset", "PlayerController"},
{"", "Pawn* AcknowledgedPawn;//[Offset:", "AcknowledgedPawn"},
{"", "SceneComponent* RootComponent;//[Offset:", "RootComponent"},

{"Class: STExtraCharacter.UAECharacter.Character.Pawn.Actor.Object",
"uint64 CurrentStates;//[Offset:", "CurrentStates"},
{"Class:
CharacterMovementComponent.PawnMovementComponent.NavMovementComponent.MovementCompo
nent.ActorComponent.Object", "Vector LastUpdateVelocity;//[Offset:",
"LastUpdateVelocity"},
{"Class: UAECharacter.Character.Pawn.Actor.Object", "int
TeamID;//[Offset: ", "TeamId"},
{"Class: UAECharacter.Character.Pawn.Actor.Object", "bool bEnsure;",
"IsBot"},
{"Class: UAECharacter.Character.Pawn.Actor.Object", "FString
PlayerName;//[Offset:", "Name"},
{"Class: UAECharacter.Character.Pawn.Actor.Object", "FString
Nation;//[Offset: ", "Nation"},
{"STExtraCharacter.UAECharacter.Character.Pawn.Actor.Object", "bool
bDead;//(ByteOffset: 0, ByteMask: 1, FieldMask: 1)[Offset:", "IsDead"},
{"", "FString PlayerUID;//[Offset:", "PlayerUID"},
{"Class: STExtraCharacter.UAECharacter.Character.Pawn.Actor.Object",
"float Health;//[Offset:", "Health"},
{"Class: STExtraCharacter.UAECharacter.Character.Pawn.Actor.Object",
"float HealthMax;//[Offset:", "HealthMax"},
{"", "float NearDeathBreath;//[Offset: ", "NearDeathBreath"},
{"", "STCharacterNearDeathComp* NearDeatchComponent;//[Offset:",
"NearDeatchComponent"},
{"", "float BreathMax;//[Offset:", "BreathMax"},

{"Class: Controller.Actor.Object", "Rotator ControlRotation;//[Offset:


", "ControlRotation"},
{"Class: SceneComponent.ActorComponent.Object", "Vector
ComponentVelocity;//[Offset:", "ComponentVelocity"},
{"Class: STExtraCharacter.UAECharacter.Character", "STExtraVehicleBase*
CurrentVehicle;//[Offset:", "CurrentVehicle"},
{"Class: Actor.Object", "RepMovement ReplicatedMovement;//[Offset:",
"ReplicatedMovement"},

{"Class: SceneComponent.ActorComponent.Object", "Vector


RelativeLocation;//[Offset:", "RelativeLocation"},
{"Class: SceneComponent.ActorComponent.Object", "Rotator
RelativeRotation;//[Offset:", "RelativeRotation"},

{"Character.Pawn.Actor.Object", "SkeletalMeshComponent*
Mesh;//[Offset:", "Mesh"},
{"Class: WeaponMeshCfg", "enum meshType;//[Offset", "BodyAddv"},
{"Class:
StaticMeshComponent.MeshComponent.PrimitiveComponent.SceneComponent.ActorComponent.
Object", "int MinLOD;//[Offset: ", "MinLOD"},

{"", "STExtraWeapon* CurrentWeaponReplicated;//[Offset:",


"CurrentWeaponReplicated"},
{"", "CharacterWeaponManagerComponent* WeaponManagerComponent;",
"WeaponManagerComponent"},

{"", "STExtraWeapon* CurrentReloadWeapon;//[Offset:",


"CurrentReloadWeapon"},
// {"", "", "CurrentWeapon"},
{"", "STExtraShootWeaponComponent* ShootWeaponComponent;//[Offset: ",
"ShootWeaponComponent"},
{"Class:
STExtraShootWeaponComponent.WeaponLogicBaseComponent.ActorComponent.Object",
"STExtraShootWeapon* OwnerShootWeapon;//[Offset: ", "OwnerShootWeapon"},
{"Class: STExtraShootWeapon.STExtraWeapon.LuaActor.Actor.Object", "int
CurBulletNumInClip;//[Offset:", "CurBulletNumInClip"},
{"Class: STExtraShootWeapon.STExtraWeapon.LuaActor.Actor.Object", "int
CurMaxBulletNumInOneClip;//[Offset:", "CurMaxBulletNumInOneClip"},
{"", "ShootWeaponEntity* ShootWeaponEntityComp;//[Offset:",
"ShootWeaponEntity"},
{"", "ShootWeaponEffectComponent* ShootWeaponEffectComp;//[Offset:",
"ShootWeaponEffectComp"},

{"Class:
ShootWeaponEffectComponent.WeaponEffectComponent.WeaponLogicBaseComponent.ActorComp
onent.Object", "float CameraShakeInnerRadius", "CameraShakeInnerRadius"},
{"", "float CameraShakeOuterRadius;//[Offset: ",
"CameraShakeOuterRadius"},
{"", "float CameraShakFalloff;//[Offset:", "CameraShakFalloff"},
{"", "CharacterOverrideAttrData[] CharacterOverrideAttrs;//[Offset:",
"CharacterOverrideAttrs"},
{"", "float BulletFireSpeed;//[Offset:", "BulletFireSpeed"},
{"", "float BulletMomentum;//[Offset: ", "BulletMomentum"},
{"", "float BulletRange;//[Offset:", "BulletRange"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float BaseImpactDamage;//[Offset:", "BaseImpactDamage"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float VehicleDamageScale;//[Offset:", "VehicleDamageScale"},
{"Class: STExtraFlareGunBullet.Actor.Object", "float
LaunchGravityScale;//[Offset: ", "LaunchGravityScale"},

{"", "loat ShootInterval;//[Offset: ", "ShootInterval"},


{"", "bool bHasSingleFireMode;//(ByteOffset: 0, ByteMask: 1, FieldMask:
255)[Offset:", "bHasSingleFireMode"},
{"", "bool bHasAutoFireMode;//(ByteOffset: 0, ByteMask: 1, FieldMask:
255)[Offset:", "bHasAutoFireMode"},
{"", "bool bHasBurstFireMode;//(ByteOffset: 0, ByteMask: 1, FieldMask:
255)[Offset:", "bHasBurstFireMode"},
{"", "float BurstShootInterval;//[Offset:", "BurstShootInterval"},
{"", "float ReloadRate;//[Offset:", "ReloadRate"},

{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float AccessoriesVRecoilFactor;//[Offset:", "AccessoriesVRecoilFactor"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float AccessoriesHRecoilFactor;//[Offset:", "AccessoriesHRecoilFactor"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float AccessoriesRecoveryFactor;//[Offset:", "AccessoriesRecoveryFactor"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float ShotGunCenterPerc;//[Offset:", "ShotGunCenterPerc"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float ShotGunVerticalSpread;//[Offset:", "ShotGunVerticalSpread"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float ShotGunHorizontalSpread;//[Offset:", "ShotGunHorizontalSpread"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float GameDeviationFactor;//[Offset:", "GameDeviationFactor"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float GameDeviationAccuracy;//[Offset:", "GameDeviationAccuracy"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float AccessoriesDeviationFactor;//[Offset:", "AccessoriesDeviationFactor"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float VehicleWeaponDeviationAngle;//[Offset:", "VehicleWeaponDeviationAngle"},
{"Class:
ShootWeaponEntity.WeaponEntity.WeaponLogicBaseComponent.ActorComponent.Object",
"float RecoilKickADS;//[Offset:", "RecoilKickADS"},

{"Class:
VehicleCommonComponent.VehicleComponent.LuaActorComponent.ActorComponent.Object",
"float HP;//[Offset:", "HP"},
{"Class:
VehicleCommonComponent.VehicleComponent.LuaActorComponent.ActorComponent.Object",
"float HPMax;//[Offset: ", "HPMax"},
{"Class:
VehicleCommonComponent.VehicleComponent.LuaActorComponent.ActorComponent.Object",
"float Fuel;//[Offset:", "Fuel"},
{"Class:
VehicleCommonComponent.VehicleComponent.LuaActorComponent.ActorComponent.Object",
"float FuelMax;//[Offset:", "FuelMax"},
{"Class: STExtraWheeledVehicle.STExtraVehicleBase.Pawn.Actor.Object",
"STExtraVehicleMovementComponent4W* VehicleMovement;//[Offset: ",
"VehicleMovement"},
{"Class: STExtraVehicleBase.Pawn.Actor.Object",
"VehicleCommonComponent* VehicleCommon;//[Offset:", "VehicleCommon"},
{"Class: STExtraVehicleBase.Pawn.Actor.Object", "float
lastForwardSpeed;//[Offset:", "lastForwardSpeed"},

{"Class:
PickUpListWrapperActor.PickUpWrapperActor.UAENetActor.LuaActor.Actor.Object",
"PickUpItemData[] PickUpDataList;//[Offset:", "PickUpDataList"}, /////

{"", "STExtraPlayerController* STPlayerController;//[Offset",


"STPlayerController"},

{"", "PlayerCameraManager* PlayerCameraManager;//[Offset:",


"PlayerCameraManager"},
{"", "HUD* MyHUD;//[Offset:", "MyHUD"},

{"", "CameraCacheEntry CameraCache;//[Offset:", "CameraCache"},

{"", "float ScopeFov;//[Offset: ", "ScopeFov"},


{"", "CameraComponent* ScopeCameraComp;//[Offset:", "ScopeCameraComp"},
{"", "bool IsFPPGameMode;//(ByteOffset: 0, ByteMask: 1, FieldMask: 255)
[Offset:", "IsFPPGameMode"},
{"", "HitPerformData HitPerform;//[Offset:", "HitPerform"},
{"", "float SwitchWeaponSpeedScale;//[Offset:",
"SwitchWeaponSpeedScale"},
{"", "CharacterParachuteComponent* ParachuteComponent",
"CharacterParachuteComponent"},
{"", "CurrentFallSpeed;//[Offset:", "CurrentFallSpeed"},

};

if (!results_1.empty()) {
string XXSDK_OUT;
cout << "Enter the output file name: ";
cin >> XXSDK_OUT;
XXSDK_OUT =XXSDK_OUT + ".h";

ofstream output(XXSDK_OUT);
if (!output) {
cerr << "Error creating output file." << endl;
return 1;
}
for (const auto& format : formats) {
vector<string> results_2;
FindSdkOffset(SdkPath, std::get<0>(format), std::get<1>(format),
results_2, std::get<2>(format));

for (const string& result : results_2) {


//output <<"//" << std::get<0>(format) << "\t -> \t" <<
std::get<1>(format) << endl;
output << result << endl /*<< endl*/;
}
}

output.close();

cout << "Results saved to: " << XXSDK_OUT << endl;
}
else {
cout << "No results found" << endl;
}
system("pause");
}

You might also like