HelpExternal RCS

Posts 1–12 of 12 · Page 1 of 1
External RCS
Been trying to make an rcs for well over an hour and i'm not sure what i'm missing. I wrote it myself and it was very imperfect. So i figured i would copy someone else's source (had to translate from C++ to C# but that's simple af). Similar result. Very imperfect. So i tried another source. And another. And i tried rewriting it again with my own logic. Still no luck. So after a ton of failed attempts i need some help.

This is in C# but anyone who know C++ could read this just as easily.

Here's what i have.
Code:
private void timerRCS_Tick(object sender, EventArgs e)//Essentially a thread for those that only know C++
        {
            shotsFired = Engine.LocalPlayer.shotsFired;
            punchVector = Engine.LocalPlayer.vecPunch;

            if (Engine.LocalPlayer.health > 0 && Engine.LocalPlayer.InGame == 6)
            {
                if (shotsFired > 1 && shotsFired > prevFired)
                {
                    prevFired = shotsFired;
                    
                    punchVector.x = punchVector.x * 2;
                    punchVector.y = punchVector.y * 2;


                    viewAngle.x = Engine.vam.ReadFloat((IntPtr)(Engine.LocalPlayer.C  lientStateBase + Offsets.oViewAngles));
                    viewAngle.y = Engine.vam.ReadFloat((IntPtr)(Engine.LocalPlayer.C  lientStateBase + Offsets.oViewAngles + 4));

                    fin.x = viewAngle.x - (punchVector.x - oldPunch.x);
                    fin.y = viewAngle.y - (punchVector.y - oldPunch.y);

                    

                    Aimbot.ClampAngles(ref fin);


                    Engine.vam.WriteFloat((IntPtr)(Engine.LocalPlayer.  ClientStateBase + Offsets.oViewAngles), fin.x);
                    Engine.vam.WriteFloat((IntPtr)(Engine.LocalPlayer.  ClientStateBase + Offsets.oViewAngles + 4), fin.y);
                    oldPunch.x = punchVector.x;
                    oldPunch.y = punchVector.y;

                }
                else if (shotsFired <= 1 || shotsFired < prevFired) //A regular else was not working.
                {
                    oldPunch.x = 0;
                    oldPunch.y = 0;
                    prevFired = 0;
                }
            }
        }
Here's a video of the result.
From it, we can conclude that timing is not the issue. Also that my current punch and old punch are being read correctly.


Thanks for helping a fat noob guys.
You can't have perfect no spray with RCS.

It would be better if you did read the ViewAngle in 1 call.

This is how I do it in my C# cheat.
Code:
                _newViewAngels = Engine.GetViewAngles();
                Vector3 punch = Core.LocalPlayer.VecPunch - LastPunch;

                if (punch.X != 0 || punch.Y != 0)
                {
                    _newViewAngels.X -= punch.X * RandomYaw;
                    _newViewAngels.Y -= punch.Y * RandomPitch;
                    _newViewAngels = _newViewAngels.NormalizeAngle();
                    Engine.SetViewAngles(_newViewAngels);
                }
Obvisoly you would change RandomYaw and RandomPitch too 2f for the 'perfect' RCS.
Use vector2 for more optimized code.
I think that your code is too slow.
Dont use timer for things like that.
1. There is no need to check if you are alive
2. There is no need to check that shotsfired is higher than prevFired
3. Punch Multiplication can be set above your shots count
4. If you are checking singnonstate then please do any reading and writing under it and not above, else there is no use for this function.
If you dont do so you can still experience crash what you actually want to avoid with signonstate full.
A faster method is to implement sanity checks on all your function calls:
Ex: Getshotsfired()
{
1. Check for Localbase
2. If Localbase
3. Do reading stuff
}
4. Why are you setting oldpunch back to punchvector after setting your angles to fin? That makes no sense
5. After Setting your angles, make a simple else{} and set oldpunch to puncvector

that should solve your problem
Quote Originally Posted by antep2727 View Post
1. There is no need to check if you are alive
2. There is no need to check that shotsfired is higher than prevFired
3. Punch Multiplication can be set above your shots count
4. If you are checking singnonstate then please do any reading and writing under it and not above, else there is no use for this function.
If you dont do so you can still experience crash what you actually want to avoid with signonstate full.
A faster method is to implement sanity checks on all your function calls:
Ex: Getshotsfired()
{
1. Check for Localbase
2. If Localbase
3. Do reading stuff
}
4. Why are you setting oldpunch back to punchvector after setting your angles to fin? That makes no sense
5. After Setting your angles, make a simple else{} and set oldpunch to puncvector

that should solve your problem
Are your trolling or ...?

If you don't check if shotfired > prevfired it will write this code 30 times in-between bullets. So if i shot 2 times and my punch was +2.0, it would get called 30+ times in that short period of time and my angle would be +60 from where it was. So yes. You need to check that to ensure it only being written once per bullet. It's in every source i looked at yesterday as well.

I check if my player is alive so i don't write angles when spectating. It's just a safety check.

I set my angles to old punch after everything else becuase i want the punch value of my last bullet. You can see it working in the video on the left hand side. If i did it before find it would be the same as doing
Code:
fin.x = viewAngle.x - (punchVector.x * 2);
which is not what i want at all.


- - - Updated - - -

Quote Originally Posted by Zaczero View Post
Use vector2 for more optimized code.
I think that your code is too slow.
Dont use timer for things like that.
My code is not too slow. Watch the video. Jesus.
Quote Originally Posted by HexMurder View Post


Are your trolling or have you just no clue what you are talking about?

If you don't check if shotfired > prevfired it will write this code 30 times in-between bullets. So if i shot 2 times and my punch was +2.0, it would get called 30+ times in that short period of time and my angle would be +60 from where it was. So yes. You need to check that to ensure it only being written once per bullet. It's in every source i looked at yesterday as well.

I check if my player is alive so i don't write angles when spectating. It's just a safety check.

I set my angles to old punch after everything else becuase i want the punch value of my last bullet. You can see it working in the video on the left hand side. If i did it before find it would be the same as doing
Code:
fin.x = viewAngle.x - (punchVector.x * 2);
which is not what i want at all.


- - - Updated - - -



My code is not too slow. Watch the video. Jesus.
The code might not be slow, but there is still room too optimize it. Such as using a vector2 or 3 and just read once.. (Which would make it faster. You have to think in the long run.)

And you don't need too check if shotfired > prevfired.

This is my RCS code and it can't get much better.

Code:
                _newViewAngels = Engine.GetViewAngles();
                Vector3 punch = Core.LocalPlayer.VecPunch - LastPunch;

                if (punch.X != 0 || punch.Y != 0)
                {
                    _newViewAngels.X -= punch.X * RandomYaw;
                    _newViewAngels.Y -= punch.Y * RandomPitch;
                    _newViewAngels = _newViewAngels.NormalizeAngle();
                    Engine.SetViewAngles(_newViewAngels);
                }
Obvisoly you would change RandomYaw and RandomPitch too 2f for the 'perfect' RCS.
Quote Originally Posted by HexMurder View Post
Are your trolling or have you just no clue what you are talking about?

If you don't check if shotfired > prevfired it will write this code 30 times in-between bullets. So if i shot 2 times and my punch was +2.0, it would get called 30+ times in that short period of time and my angle would be +60 from where it was. So yes. You need to check that to ensure it only being written once per bullet.
No, that's incorrect. What do you think the OldPunch is for? To prevent exactly that from happening by adding (or subtracting if negative value) the delta between the old punch value and the new one.
Quote Originally Posted by WasserEsser View Post
No, that's incorrect. What do you think the OldPunch is for? To prevent exactly that from happening by adding (or subtracting if negative value) the delta between the old punch value and the new one.
So what is the problem? Thanks for clarifying.
Quote Originally Posted by HexMurder View Post


Are your trolling or ...?

If you don't check if shotfired > prevfired it will write this code 30 times in-between bullets. So if i shot 2 times and my punch was +2.0, it would get called 30+ times in that short period of time and my angle would be +60 from where it was. So yes. You need to check that to ensure it only being written once per bullet. It's in every source i looked at yesterday as well.

I check if my player is alive so i don't write angles when spectating. It's just a safety check.

I set my angles to old punch after everything else becuase i want the punch value of my last bullet. You can see it working in the video on the left hand side. If i did it before find it would be the same as doing
Code:
fin.x = viewAngle.x - (punchVector.x * 2);
which is not what i want at all.


- - - Updated - - -



My code is not too slow. Watch the video. Jesus.
I don't see any other way
Your code is unoptimized. It works fine but time read->fix->write makes it like fixing 19-shot while you are doing 20-shot already.
Quote Originally Posted by HexMurder View Post


Are your trolling or ...?

If you don't check if shotfired > prevfired it will write this code 30 times in-between bullets. So if i shot 2 times and my punch was +2.0, it would get called 30+ times in that short period of time and my angle would be +60 from where it was. So yes. You need to check that to ensure it only being written once per bullet. It's in every source i looked at yesterday as well.

I check if my player is alive so i don't write angles when spectating. It's just a safety check.

I set my angles to old punch after everything else becuase i want the punch value of my last bullet. You can see it working in the video on the left hand side. If i did it before find it would be the same as doing
Code:
fin.x = viewAngle.x - (punchVector.x * 2);
which is not what i want at all.


- - - Updated - - -



My code is not too slow. Watch the video. Jesus.
You didnt understand the function shotsfired. Shotsfired is counting your latest shots for a few second. You cannot shoot while in Spectator so there is absolutely no use of checking if you are a live or not. Just do what i wrote its the correct way of doing rcs
Get rid of the shotsFired > prevFired check. Your recoil ain't static for each shot, it changes slowly.
With this logic, your aim would be stepping 30 times when spraying, which is not the case, it's a smooth spray.

Also, remove the else if and make it a regular if.
Quote Originally Posted by WasserEsser View Post
Get rid of the shotsFired > prevFired check. Your recoil ain't static for each shot, it changes slowly.
With this logic, your aim would be stepping 30 times when spraying, which is not the case, it's a smooth spray.

Also, remove the else if and make it a regular if.
Wow thanks so much. I have been mislead to believe that i needed to check if shotsFired > prevFired. Your logic makes perfect sense and it works great now. Thanks for the help man.
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us