- Katılım
- 22 May 2021
- Mesajlar
- 1,473
- Beğeniler
- 333
C++ Boş Proje Oluşturun
Ayarları Yapın (altda verdim)
2 Adet dosya oluşturun main.cpp ve memory.h diye
size verdiğim kodları yapıştırın ve derleyin
işte bu kadar iyi oyunlar...(triggerbot tuşu shift)
main.cpp:
memory.h
Ayarlar:
Ayarları Yapın (altda verdim)
2 Adet dosya oluşturun main.cpp ve memory.h diye
size verdiğim kodları yapıştırın ve derleyin
işte bu kadar iyi oyunlar...(triggerbot tuşu shift)
main.cpp:
C++:
#include "memory.h"
#include <iostream>
#include <thread>
namespace offset
{
constexpr ::std::ptrdiff_t dwLocalPlayer = 0xC3F6C0;
constexpr ::std::ptrdiff_t dwEntityList = 0xC4D1EC;
constexpr ::std::ptrdiff_t dwForceAttack = 0xC6E46C;
constexpr ::std::ptrdiff_t m_iHealth = 0xA8;
constexpr ::std::ptrdiff_t m_iTeamNum = 0xB0;
constexpr ::std::ptrdiff_t m_iCrosshairId = 0x177C;
}
int main()
{
const auto memory = Memory{ "hl2.exe" };
const auto client = memory.GetModuleAddress("client.dll");
std::cout << std::hex << "client.dll -> 0x" << client << std::dec << std::endl;
while (true)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (!GetAsyncKeyState(VK_LSHIFT))
continue;
const auto& localPlayer = memory.Read<std::uintptr_t>(client + offset::dwLocalPlayer);
const auto& localHealth = memory.Read<std::int32_t>(localPlayer + offset::m_iHealth);
if (!localHealth)
continue;
const auto& crosshairId = memory.Read<std::int32_t>(localPlayer + offset::m_iCrosshairId);
if (!crosshairId || crosshairId > 64)
continue;
const auto& player = memory.Read<std::int32_t>(client + offset::dwEntityList + (crosshairId - 1) * 0x10);
if (!memory.Read<std::int32_t>(player + offset::m_iHealth))
continue;
if (memory.Read<std::int32_t>(player + offset::m_iTeamNum) ==
memory.Read<std::int32_t>(localPlayer + offset::m_iTeamNum))
continue;
memory.Write<std::uintptr_t>(client + offset::dwForceAttack, 6);
std::this_thread::sleep_for(std::chrono::milliseconds(20));
memory.Write<std::uintptr_t>(client + offset::dwForceAttack, 4);
}
return 0;
}
memory.h
C:
#pragma once
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <TlHelp32.h>
#include <cstdint>
#include <string_view>
class Memory
{
private:
std::uintptr_t processId = 0;
void* processHandle = nullptr;
public:
// Constructor that finds the process id
// and opens a handle
Memory(const std::string_view processName) noexcept
{
::PROCESSENTRY32 entry = { };
entry.dwSize = sizeof(::PROCESSENTRY32);
const auto snapShot = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
while (::Process32Next(snapShot, &entry))
{
if (!processName.compare(entry.szExeFile))
{
processId = entry.th32ProcessID;
processHandle = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId);
break;
}
}
// Free handle
if (snapShot)
::CloseHandle(snapShot);
}
// Destructor that frees the opened handle
~Memory()
{
if (processHandle)
::CloseHandle(processHandle);
}
// Returns the base address of a module by name
const std::uintptr_t GetModuleAddress(const std::string_view moduleName) const noexcept
{
::MODULEENTRY32 entry = { };
entry.dwSize = sizeof(::MODULEENTRY32);
const auto snapShot = ::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processId);
std::uintptr_t result = 0;
while (::Module32Next(snapShot, &entry))
{
if (!moduleName.compare(entry.szModule))
{
result = reinterpret_cast<std::uintptr_t>(entry.modBaseAddr);
break;
}
}
if (snapShot)
::CloseHandle(snapShot);
return result;
}
// Read process memory
template <typename T>
constexpr const T Read(const std::uintptr_t& address) const noexcept
{
T value = { };
::ReadProcessMemory(processHandle, reinterpret_cast<const void*>(address), &value, sizeof(T), NULL);
return value;
}
// Write process memory
template <typename T>
constexpr void Write(const std::uintptr_t& address, const T& value) const noexcept
{
::WriteProcessMemory(processHandle, reinterpret_cast<void*>(address), &value, sizeof(T), NULL);
}
};
Ayarlar:
C++:
multicode karakter
20 level
Release x86