HelpExternal RCS not working
where is it overwritten to 0? i dont ever see vOldPunchAngle being written to at all, it seems like it already has a value. I did not make this myself, @ImStyL wrote it. what variable do i make static and how do i do it.
- - - Updated - - -
tried this, its doing the same thing as the last one
- - - Updated - - -
tried this, its doing the same thing as the last one
It's a local variable, it does not have static storage duration, only local storage duration.
Example:
increment_local will always return 1, increment_static will not (Only the first time it's called).
Example:
Code:
int increment_local()
{
int i = 0;
return ++i;
}
int increment_static()
{
static int i = 0; /* thread_local will do the same, but it has a different storage location for each thread that calls it */
return ++i;
}
Code:
void RCS()
{
Vector vOldPunchAngle;
}
You don't want this to happen so make the variable static by adding the keyword 'static' behind Vector or alternately move it outside the function.
Ok this is what i have now
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
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;
}
}
}
This thread is closed for replies.
