0% found this document useful (0 votes)
82 views4 pages

Teleport

This C++ code implements a teleportation hack for a game, utilizing memory reading and writing techniques to manipulate player positions. It defines offsets for various game elements, reads player data, identifies enemies, and allows the user to teleport to the closest enemy when the F1 key is pressed. The teleportation can be either instant or smooth, with a loop running in a separate thread to handle the teleportation logic.

Uploaded by

xzelvo
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)
82 views4 pages

Teleport

This C++ code implements a teleportation hack for a game, utilizing memory reading and writing techniques to manipulate player positions. It defines offsets for various game elements, reads player data, identifies enemies, and allows the user to teleport to the closest enemy when the F1 key is pressed. The teleportation can be either instant or smooth, with a loop running in a separate thread to handle the teleportation logic.

Uploaded by

xzelvo
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/ 4

// Full C++ file with Offsets baked in + teleport logic

// By Faiz x Cheats - Do not share without credit! 🚩

#include <windows.h>
#include <iostream>
#include <vector>
#include <thread>
#include <cmath>
#include <float.h> // For FLT_MAX

// --------- Offsets ---------


namespace Offsets
{
constexpr uintptr_t Il2Cpp = 0x0;
constexpr uintptr_t InitBase = 0x8CA88B4;
constexpr uintptr_t StaticClass = 0x5c;

constexpr uintptr_t CurrentMatch = 0x50;


constexpr uintptr_t MatchStatus = 0x3c;
constexpr uintptr_t LocalPlayer = 0x44;
constexpr uintptr_t DictionaryEntities = 0x68;

constexpr uintptr_t Player_IsDead = 0x4c;


constexpr uintptr_t Player_Name = 0x224;
constexpr uintptr_t Player_Data = 0x44;
constexpr uintptr_t XPose = 0x78;

constexpr uintptr_t AvatarManager = 0x3f4;


constexpr uintptr_t Avatar = 0x94;
constexpr uintptr_t Avatar_IsVisible = 0x7c;
constexpr uintptr_t Avatar_Data = 0x10;
constexpr uintptr_t Avatar_Data_IsTeam = 0x51;

constexpr uintptr_t FollowCamera = 0x384;


constexpr uintptr_t Camera = 0x14;
constexpr uintptr_t AimRotation = 0x33c;
constexpr uintptr_t MainCameraTransform = 0x194;

constexpr uintptr_t Weapon = 0x330;


constexpr uintptr_t WeaponData = 0x50;
constexpr uintptr_t WeaponRecoil = 0xc;
constexpr uintptr_t ViewMatrix = 0x98 + 0x24;

constexpr uintptr_t WeaponInfo = 0x5c;


constexpr uintptr_t WeaponID = 0x8;

constexpr uintptr_t UnkPlayerWeaponInfoClass = 0x3DC;


constexpr uintptr_t WeaponOnHand = 0x4c;

constexpr uintptr_t sAim3 = 0x38;


constexpr uintptr_t sAim4 = 0x2c;

constexpr uintptr_t sAim1 = 0x474;


constexpr uintptr_t sAim2 = 0x808;
}
// -------------------------

struct Vector3
{
float x, y, z;
};

HANDLE hProcess = nullptr;


uintptr_t gameBaseAddress = 0; // Initialize with your game's base address

template<typename T>
T Read(uintptr_t address)
{
T buffer{};
ReadProcessMemory(hProcess, (LPCVOID)address, &buffer, sizeof(T), nullptr);
return buffer;
}

template<typename T>
void Write(uintptr_t address, T value)
{
WriteProcessMemory(hProcess, (LPVOID)address, &value, sizeof(T), nullptr);
}

uintptr_t GetLocalPlayer()
{
return Read<uintptr_t>(gameBaseAddress + Offsets::LocalPlayer);
}

std::vector<uintptr_t> GetEnemyList()
{
std::vector<uintptr_t> enemies;
// TODO: Implement parsing of DictionaryEntities at (gameBaseAddress +
Offsets::DictionaryEntities)
// For now, empty list.
return enemies;
}

Vector3 ReadVector3(uintptr_t base)


{
return Read<Vector3>(base);
}

void WriteVector3(uintptr_t base, Vector3 pos)


{
Write<Vector3>(base, pos);
}

bool IsEnemyAlive(uintptr_t enemy)


{
uint8_t isDead = Read<uint8_t>(enemy + Offsets::Player_IsDead);
return (isDead == 0);
}

uintptr_t FindClosestEnemy(Vector3 localPos, const std::vector<uintptr_t>& enemies)


{
uintptr_t closest = 0;
float minDist = FLT_MAX;

for (auto enemy : enemies)


{
if (!IsEnemyAlive(enemy))
continue;
Vector3 enemyPos = ReadVector3(enemy + Offsets::Player_Data +
Offsets::XPose);

float dist = sqrtf(


(enemyPos.x - localPos.x) * (enemyPos.x - localPos.x) +
(enemyPos.y - localPos.y) * (enemyPos.y - localPos.y) +
(enemyPos.z - localPos.z) * (enemyPos.z - localPos.z));

if (dist < minDist)


{
minDist = dist;
closest = enemy;
}
}
return closest;
}

void TeleportToEnemy(uintptr_t localPlayerBase, uintptr_t enemyBase)


{
Vector3 enemyPos = ReadVector3(enemyBase + Offsets::Player_Data +
Offsets::XPose);
uintptr_t localPlayerPosAddr = localPlayerBase + Offsets::Player_Data +
Offsets::XPose;
WriteVector3(localPlayerPosAddr, enemyPos);
}

void SmoothTeleport(uintptr_t localPlayerBase, Vector3 targetPos)


{
uintptr_t localPlayerPosAddr = localPlayerBase + Offsets::Player_Data +
Offsets::XPose;
Vector3 currentPos = ReadVector3(localPlayerPosAddr);

for (int i = 0; i < 50; i++)


{
currentPos.x += (targetPos.x - currentPos.x) * 0.1f;
currentPos.y += (targetPos.y - currentPos.y) * 0.1f;
currentPos.z += (targetPos.z - currentPos.z) * 0.1f;

WriteVector3(localPlayerPosAddr, currentPos);
Sleep(10);
}
}

void TeleportLoop()
{
while (true)
{
if (GetAsyncKeyState(VK_F1) & 1) // Press F1 to teleport
{
uintptr_t localPlayer = GetLocalPlayer();
if (!localPlayer)
{
std::cout << "Local player not found!" << std::endl;
continue;
}

Vector3 localPos = ReadVector3(localPlayer + Offsets::Player_Data +


Offsets::XPose);
std::vector<uintptr_t> enemies = GetEnemyList();

if (enemies.empty())
{
std::cout << "No enemies found!" << std::endl;
continue;
}

uintptr_t closestEnemy = FindClosestEnemy(localPos, enemies);


if (!closestEnemy)
{
std::cout << "No alive enemy found!" << std::endl;
continue;
}

Vector3 enemyPos = ReadVector3(closestEnemy + Offsets::Player_Data +


Offsets::XPose);

// Instant teleport:
// TeleportToEnemy(localPlayer, closestEnemy);

// Or smooth teleport:
SmoothTeleport(localPlayer, enemyPos);

std::cout << "Teleported to enemy!" << std::endl;


}
Sleep(10);
}
}

int main()
{
// TODO: Initialize hProcess and gameBaseAddress here
// Example:
// DWORD pid = GetProcessIdByName(L"HD-Player.exe");
// hProcess = OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE |
PROCESS_VM_OPERATION, FALSE, pid);
// gameBaseAddress = GetModuleBaseAddress(pid, L"HD-Player.exe");

std::cout << "Teleport hack started. Press F1 to teleport to closest enemy.\n";

std::thread teleportThread(TeleportLoop);
teleportThread.detach();

while (true)
{
Sleep(1000);
}

return 0;
}

You might also like