RCS C# Again

Posts 1–6 of 6 · Page 1 of 1
RCS C# Again
First of all, I'm sorry guys to ask this almost the same way the user 555444 posted it earlier, but how do I make an RCS in C# ?
More specifically how do I read a Vector from the memory ?

I'm really sorry about the inconvenience.
How?

Stop copy pasting.

Then you know how.

However, im generous.

This example is in C++, but you should be able to translate this into C# if you are smart enough.

Vector3.h

Code:
#pragma once

class Vector3 {
public:
	float x, y, z;
};
Vector3.cpp

Code:
#include "Vector3.h"
Your Memory Class

Code:
template <class vData>
vData ReadMemory(DWORD Address)
{
	vData vReturn;
	ReadProcessMemory(hProcess, (LPVOID)Address, &vReturn, sizeof(vData), NULL);
	return vReturn;
}
Usage

Code:
//Create an Object of your Memory Class
MemoryClass Memory; //Or MemoryClass* Memory = new Memory();

Vector MyVector = Memory.ReadMemory<Vector3>(Address + Offset); //Or Vector MyVector = Memory->ReadMemory<Vector3>(Address + Offset);
Many thanks man, things like that should be sticked to the forum, it would really help out new users.

- - - Updated - - -

Sorry again for the incovinience, how should I read it in C#, cuz the method used is :

Code:
        
         public byte[] ReadMem(int pOffset, int pSize)
        {
            byte[] buffer = new byte[pSize];
            ReadProcessMemory(this.processHandle, pOffset, buffer, pSize, 0);
            return buffer;
        }
which returns me a byte array, and if I try to turn it to a object with :

Code:
        private static object ByteArrayToObject(Byte[] Buffer)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            MemoryStream stream = new MemoryStream(Buffer);
            object rval = formatter.Deserialize(stream);
            stream.Close();
            return rval;
        }
Gives me the error "End of Stream encountered before parsing was completed.". Is it the size that is wrong ? What's the size of the vector ?
Nvm, find another way. Starting using the ExternalUtils C# with supports reading memory with any object type, and then using this source given in the other thread

Code:
Angle OldAngle;
    int ShotsFired = 0;
    while(true)
    {
        if (GetAsyncKeyState(0x01)){
                ShotsFired = mem.read<int>(GetLocalPlayer() + m_iShotsFired);
                if (ShotsFired > 1){
                    m_ViewAngle = GetViewAngle();
 
                    Angle m_PunchAngle = GetPunchAngle( );
 
                    m_ViewAngle.x = m_ViewAngle.x + OldAngle.x;
                    m_ViewAngle.y = m_ViewAngle.y + OldAngle.y;
                    // Add the old "viewpunch" so we get the "center" of the screen again
 
                    angle.x = m_ViewAngle.x - m_PunchAngle.x*2;
                    angle.y = m_ViewAngle.y - m_PunchAngle.y*2 ;
                    // remove the new "viewpunch" from the viewangles
                    SetViewAngle(angle);
 
                    OldAngle.x = m_PunchAngle.x*2;
                    OldAngle.y = m_PunchAngle.y*2;
                    // save the old "viewpunch"
 
 
                }else{
                OldAngle.x = 0;
                OldAngle.y = 0;
                }
        }else{
                OldAngle.x = 0;
                OldAngle.y = 0;
        }
}
I manage to figure it out. Thanks for the attention
Quote Originally Posted by redbaty View Post
Nvm, find another way. Starting using the ExternalUtils C# with supports reading memory with any object type, and then using this source given in the other thread

Code:
Angle OldAngle;
    int ShotsFired = 0;
    while(true)
    {
        if (GetAsyncKeyState(0x01)){
                ShotsFired = mem.read<int>(GetLocalPlayer() + m_iShotsFired);
                if (ShotsFired > 1){
                    m_ViewAngle = GetViewAngle();
 
                    Angle m_PunchAngle = GetPunchAngle( );
 
                    m_ViewAngle.x = m_ViewAngle.x + OldAngle.x;
                    m_ViewAngle.y = m_ViewAngle.y + OldAngle.y;
                    // Add the old "viewpunch" so we get the "center" of the screen again
 
                    angle.x = m_ViewAngle.x - m_PunchAngle.x*2;
                    angle.y = m_ViewAngle.y - m_PunchAngle.y*2 ;
                    // remove the new "viewpunch" from the viewangles
                    SetViewAngle(angle);
 
                    OldAngle.x = m_PunchAngle.x*2;
                    OldAngle.y = m_PunchAngle.y*2;
                    // save the old "viewpunch"
 
 
                }else{
                OldAngle.x = 0;
                OldAngle.y = 0;
                }
        }else{
                OldAngle.x = 0;
                OldAngle.y = 0;
        }
}
I manage to figure it out. Thanks for the attention
might pm me the full c# script? would be awesome cause i could not get it work
Quote Originally Posted by 555444 View Post
might pm me the full c# script? would be awesome cause i could not get it work
Okay, sending it right now.
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?