Originally Posted by
Yamiez
Yea but he didn't actually create a default constructor, so one will be created automatically, assuming he is using VC compiler it'll be initialized to 0, otherwise unknown. But yea that is the problem, a new instance is constructed everytime the function is called.
Ok this is what i have now
Code:
#pragma once
#include "Offsets.h"
#include <math.h>
#include <iostream>
#include <string>
#include <ios>
#include <iomanip>
struct Vector {
float x, y, z;
};
Vector NormalizeAngles(Vector angle)
{
if (!std::isfinite(angle.x)) {
angle.x = 0;
}
if (!std::isfinite(angle.y)) {
angle.y = 0;
}
while (angle.y < -180.0f) angle.y += 360.0f;
while (angle.y > 180.0f) angle.y -= 360.0f;
if (angle.x > 89.0f) angle.x = 89.0f;
if (angle.x < -89.0f) angle.x = -89.0f;
angle.z = 0;
return angle;
}
void RCS()
{
if (RCSEnabled)
{
Vector vAimPunch;
Vector Fin;
static Vector vOldPunchAngle;
DWORD Player = Mem.Read<DWORD>(Client + LocalPlayer);
DWORD EngineBleh = Mem.Read<DWORD>(Engine + ClientState); //Engine is "Engine.dll"
if (GetAsyncKeyState(VK_LBUTTON))
{
vAimPunch = Mem.Read<Vector>(Player + Punch);
vAimPunch.x = vAimPunch.x * 2.f;
vAimPunch.y = vAimPunch.y * 2.f;
Vector ViewAngles = Mem.Read<Vector>(EngineBleh + ViewAngle);
Fin.x = ViewAngles.x - (vAimPunch.x - vOldPunchAngle.x);
Fin.y = ViewAngles.y - (vAimPunch.y - vOldPunchAngle.y);
NormalizeAngles(Fin);
Mem.Write<Vector>(EngineBleh + ViewAngle, Fin);
vOldPunchAngle = vAimPunch;
}
else
{
vOldPunchAngle.x = 0;
vOldPunchAngle.y = 0;
Fin.x = 0;
Fin.y = 0;
}
}
}
and now its not doing anything again. its like the function isnt running but when i make it "un-static" it does the spaz thing again