-
Автор темы
- #1
main.cpp:
#include "memory.h"
#include <chrono>
#include <thread>
#include "offsets.h"
#include <iostream>
#include "client_dll.hpp"
namespace global {
namespace misc {
uintptr_t localPlayerController;
uintptr_t localPlayerPawn;
}
namespace module {
uintptr_t client;
uintptr_t engine;
}
}
uintptr_t entityList;
// Offsets
namespace offset {
constexpr uintptr_t m_pWeaponServices = cs2_dumper::schemas::client_dll::C_BasePlayerPawn::m_pWeaponServices;
constexpr uintptr_t m_pWeaponSize = 0x50;
constexpr uintptr_t m_pWeapons = cs2_dumper::schemas::client_dll::CPlayer_WeaponServices::m_hMyWeapons;
constexpr uintptr_t m_AttributeManager = cs2_dumper::schemas::client_dll::C_EconEntity::m_AttributeManager;
constexpr uintptr_t m_Item = cs2_dumper::schemas::client_dll::C_AttributeContainer::m_Item;
constexpr uintptr_t m_iItemDefinitionIndex = cs2_dumper::schemas::client_dll::C_EconItemView::m_iItemDefinitionIndex;
constexpr uintptr_t m_pGameSceneNode = cs2_dumper::schemas::client_dll::C_BaseEntity::m_pGameSceneNode;
constexpr uintptr_t m_MeshGroupMask = cs2_dumper::schemas::client_dll::CModelState::m_MeshGroupMask;
constexpr uintptr_t m_pViewModelServices = cs2_dumper::schemas::client_dll::C_CSPlayerPawnBase::m_pViewModelServices;
constexpr uintptr_t m_hViewModel = cs2_dumper::schemas::client_dll::CCSPlayer_ViewModelServices::m_hViewModel;
}
// CWeapon class
class CWeapon {
public:
static CWeapon GetWeaponServices() {
auto weaponServices = memory::read<uintptr_t>(global::misc::localPlayerPawn + offset::m_pWeaponServices);
return CWeapon(weaponServices);
}
int WeaponSize() const noexcept {
return memory::read<int>(weaponServices + offset::m_pWeaponSize);
}
int WeaponHandle(int i) const noexcept {
return memory::read<int>((weaponServices + offset::m_pWeapons) + 0x4 * i);
}
int WeaponID(uintptr_t weapons) const noexcept {
return memory::read<uint16_t>(weapons + offset::m_AttributeManager + offset::m_Item + offset::m_iItemDefinitionIndex);
}
private:
uintptr_t weaponServices;
explicit CWeapon(uintptr_t services) : weaponServices(services) {}
};
// CHandle class
class CHandle {
public:
static uintptr_t GetControllerFromHandle(uintptr_t entityList, int handle) {
handle &= 0x7FFF;
auto list = memory::read<uintptr_t>(entityList + 8 * (handle >> 9) + 16);
auto controller = list + 120 * (handle & 0x1FF);
return memory::read<uintptr_t>(controller);
}
static uintptr_t GameSceneNode(uintptr_t handle) {
return memory::read<uintptr_t>(handle + offset::m_pGameSceneNode);
}
static int SetMaskGroup(uintptr_t gameSceneNode) {
return memory::read<int>(gameSceneNode + 0x170 + offset::m_MeshGroupMask);
}
};
// CSkinChanger class
class CSkinChanger {
public:
static void SetWeaponSkin(int weaponID, uintptr_t weapon, uintptr_t weaponGameSceneNode, int MeshGroupMask) {
// Set Mask
if (MeshGroupMask != -1) {
memory::write<int>(weaponGameSceneNode + 0x170 + offset::m_MeshGroupMask, -1);
printf("weaponMeshGroupMask : %d\n", MeshGroupMask);
}
//std::cout << "weaponID : " << weaponID << std::endl;
// Set skin values based on weapon ID
switch (weaponID) {
case 7: // AK
memory::write<uint32_t>(weapon + 0x15F8, 180); // Paint
break;
case 1: // Deagle
memory::write<int>(weapon + 0x15F8, 37); // Paint
break;
}
// Set global fallback values
memory::write<int>(weapon + 0x15FC, 0); // Seed
memory::write<int>(weapon + 0x1604, 1337); // Stat
memory::write<float>(weapon + 0x1600, 0.00001f); // Wear
memory::write<std::string>(weapon + offset::m_AttributeManager + offset::m_Item + 0x2D0, "Alani-NU");
memory::write<int>(weapon + offset::m_AttributeManager + offset::m_Item + 0x1D4, 2);
memory::write<int>(weapon + offset::m_AttributeManager + offset::m_Item + 0x1D0, -1); // Item ID High
}
};
// CView class
class CView {
public:
static CView GetViewModelServices() {
auto viewModelServices = memory::read<uintptr_t>(global::misc::localPlayerPawn + offset::m_pViewModelServices);
return CView(viewModelServices);
}
int ViewHandle() const noexcept {
return memory::read<int>(viewModelServices + offset::m_hViewModel);
}
private:
uintptr_t viewModelServices;
explicit CView(uintptr_t services) : viewModelServices(services) {}
};
// Main logic
void ProcessWeapons() {
auto weaponService = CWeapon::GetWeaponServices();
int weaponSize = weaponService.WeaponSize();
for (int i = 0; i < weaponSize; ++i) {
int weaponHandle = weaponService.WeaponHandle(i);
if (!weaponHandle)
continue;
auto weapon = CHandle::GetControllerFromHandle(entityList, weaponHandle);
if (!weapon)
continue;
int weaponID = weaponService.WeaponID(weapon);
auto weaponGameSceneNode = CHandle::GameSceneNode(weapon);
auto weaponMeshGroupMask = CHandle::SetMaskGroup(weaponGameSceneNode);
std::cout << weaponID << std::endl;
CSkinChanger::SetWeaponSkin(weaponID, arma, weaponGameSceneNode, weaponMeshGroupMask);
}
}
void ProcessViewModel() {
auto viewModelService = CView::GetViewModelServices();
int viewModelHandle = viewModelService.ViewHandle();
auto viewModel = CHandle::GetControllerFromHandle(entityList, viewModelHandle);
auto viewGameSceneNode = CHandle::GameSceneNode(viewModel);
auto viewMeshGroupMask = CHandle::SetMaskGroup(viewGameSceneNode);
memory::write<int>(viewGameSceneNode + 0x170 + offset::m_MeshGroupMask, 2);
auto weaponModelPtr = memory::read<uintptr_t>(global::module::engine + 0x52ECE0 );
memória::write<int>(weaponModelPtr + 0x258, -1);
}
int main() {
const auto PID = memória::GetProcID(L"cs2.exe");
global::module::client = memory::GetModuleBaseAddress(PID, L"client.dll");
global::module::engine = memory::GetModuleBaseAddress(PID, L"engine2.dll");
std::cout << "Cliente:" << std::hex << global::module::client << std::endl;
std::cout << "Engine: " << std::hex << global::module::engine << std::endl;
enquanto (verdadeiro)
{
std::this_thread::sleep_for(std::chrono::milliseconds(2));
global::misc::localPlayerPawn = memory::read<uintptr_t>(global::module::client + offsets::d wLocalPlayerPawn);
entityList = memory::read<uintptr_t>(global::module::client + offsets::d wEntityList);
if (!global::misc::localPlayerPawn || !entityList)
continuar;
ProcessWeapons();
ProcessViewModel();
}
}[/CÓDIGO]