Начинающий
-
Автор темы
- #1
C++:
typedef void(__fastcall* oCreateMoveFn)(int*, int, char, UserCmd*);
inline oCreateMoveFn oCreateMove = nullptr;
void __fastcall CreateMoveHook(int* ecx, int edx, char a2, UserCmd *cmd)
{
if (bhoprea)
{
uintptr_t base = (uintptr_t)GetModuleHandle("client.dll");
uintptr_t localPlayerPawn = *(uintptr_t*)(base + o::dwLocalPlayerPawn);
uint32_t flags = *(uint32_t*)(localPlayerPawn + o::m_fFlags);
if (localPlayerPawn != NULL) {
if (GetAsyncKeyState(VK_SPACE) && (flags) & 1)
{
cmd->buttons &= ~IN_JUMP;
}
}
}
if (hitsound) {
uintptr_t client = (uintptr_t)GetModuleHandle("client.dll");
uintptr_t localPlayerPawn = *(uintptr_t*)(client + o::dwLocalPlayerPawn);
if (localPlayerPawn != NULL) {
Vec3 fallvel = *(Vec3*)(localPlayerPawn + o::m_vecVelocity);
}
}
oCreateMove(ecx, edx, a2, cmd);
}
Код:
#include "../../src/math/math.h"
enum CommandButtons : int
{
IN_ATTACK = (1 << 0),
IN_JUMP = (1 << 1),
IN_DUCK = (1 << 2),
IN_FORWARD = (1 << 3),
IN_BACK = (1 << 4),
IN_USE = (1 << 5),
IN_CANCEL = (1 << 6),
IN_LEFT = (1 << 7),
IN_RIGHT = (1 << 8),
IN_MOVELEFT = (1 << 9),
IN_MOVERIGHT = (1 << 10),
IN_SECOND_ATTACK = (1 << 11),
IN_RUN = (1 << 12),
IN_RELOAD = (1 << 13),
IN_LEFT_ALT = (1 << 14),
IN_RIGHT_ALT = (1 << 15),
IN_SCORE = (1 << 16),
IN_SPEED = (1 << 17),
IN_WALK = (1 << 18),
IN_ZOOM = (1 << 19),
IN_FIRST_WEAPON = (1 << 20),
IN_SECOND_WEAPON = (1 << 21),
IN_BULLRUSH = (1 << 22),
IN_FIRST_GRENADE = (1 << 23),
IN_SECOND_GRENADE = (1 << 24),
IN_MIDDLE_ATTACK = (1 << 25)
};
struct UserCmd
{
void* vmt;
int commandNumber;
int tickCount;
Vec3 viewPoint;
Vec3 aimDirection;
float forwardMove;
float sideMove;
float upMove;
uint64_t buttons;
char impulse;
int weaponSelect;
int weaponSubType;
int randomSeed;
short mouseDeltaX;
short mouseDeltaY;
bool hasBeenPredicted;
Vec3 headAngles;
Vec3 headOffset;
};