HelpExternal RCS not working

Posts 16–30 of 47 · Page 2 of 4
Quote Originally Posted by ImWhacky View Post


Lol i put that in to test it and this is what happened
Each time the function is called 'vOldPunchAngle' will overwritten to 0. Did you make this yourself? Make the variable static or move it outside.
Also, I would recommend normalizing your angles after every angle operation and clamp it in the end.
Quote Originally Posted by Epik View Post


Each time the function is called 'vOldPunchAngle' will overwritten to 0. Did you make this yourself? Make the variable static or move it outside.
Also, I would recommend normalizing your angles after every angle operation and clamp it in the end.
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 - - -

Quote Originally Posted by ImStyL View Post
This is what Epik was saying,
It should work, as i already tested it.

Code:
			Vector vAimPunch;
			Vector Fin;

			DWORD Player = Mem.Read<DWORD>(Client.dwBase + LocalPlayer);
			DWORD EngineBleh = Mem.Read<DWORD>(Engine.dwBase + 0x00610334); //0x00610334 = ClientState
			vAimPunch = Mem.Read<Vector>(Player + VectorPunch);
			Vector vOldPunchAngle;

			if (GetAsyncKeyState(VK_LBUTTON) & 0x8000)
			{
				vAimPunch.x = vAimPunch.x * 2.f;
				vAimPunch.y = vAimPunch.y * 2.f;
				Vector ViewAngles = Mem.Read<Vector>(EngineBleh + ViewAngle);
				Mem.NormalizeAngles(Fin);
				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;
ALSO THIS IS MY 69 POST, AYYLMAO
tried this, its doing the same thing as the last one
Quote Originally Posted by ImWhacky View Post
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.
It's a local variable, it does not have static storage duration, only local storage duration.

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;
}
increment_local will always return 1, increment_static will not (Only the first time it's called).
Quote Originally Posted by Yemiez View Post
It's a local variable, it does not have static storage duration, only local storage duration.
OMG DAD IS HERE, ok that makes sense but why is it making my player have turrets every time i need to shoot?
Quote Originally Posted by ImWhacky View Post
OMG DAD IS HERE, ok that makes sense but why is it making my player have turrets every time i need to shoot?
See my edit.
Code:
void RCS()
{
    Vector vOldPunchAngle;
}
Everytime RCS() is called, 'vOldPunchAngle' will be set to 0.
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.
Quote Originally Posted by Epik View Post
Everytime RCS() is called, 'vOldPunchAngle' will be set to 0.
Hehe I dont mean to be annoying but it actually depends on the constructor :P (since he did not provide a constructor the compiler will automatically create one, it depends on what compiler he is using wether or not it will be initialized to 0)
Quote Originally Posted by Yemiez View Post
Hehe I dont mean to be annoying but it actually depends on the constructor :P
Yeah, I'm making a big assumption but in this case it doesn't really matter since it will be overwritten in his function.
Edit: nvm it better be 0
Quote Originally Posted by Epik View Post


Yeah, I'm making a big assumption but in this case it doesn't really matter since it will be overwritten in his function.
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.
Quote Originally Posted by Yemiez View Post
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
Quote Originally Posted by ImWhacky View Post
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
Code:
static Vector vOldPunchAngle = Vector(0, 0, 0);
Quote Originally Posted by Epik View Post


Code:
static Vector vOldPunchAngle = Vector(0, 0, 0);
"no suitable constructor exists to convert int to vector"
Quote Originally Posted by ImWhacky View Post
"no suitable constructor exists to convert int to vector"
lol, can you show your Vector class
Quote Originally Posted by Epik View Post


lol, can you show your Vector class
struct Vector {
float x, y, z;
};
Quote Originally Posted by ImWhacky View Post
struct Vector {
float x, y, z;
};
I thought it was a class..

Code:
struct Vector {
	float x = y = z = 0;
};
Try that. No need to do Vector(0, 0, 0).
Posts 16–30 of 47 · Page 2 of 4
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?