iseekwonderful / csgoGlow

Simple macOS CSGO glow hack
111 stars 66 forks source link

Recoil Control System #164

Closed sacredgeo closed 8 years ago

sacredgeo commented 8 years ago

I now have a working RCS. With advice from aKalisch, I adapted code found on unknowncheats. Here's the link: https://www.unknowncheats.me/forum/counterstrike-global-offensive/135848-recoil-control-fixed.html

The code is shown below. You'll need to adapt it for Mac OSX.

Angle angle;
Angle m_ViewAngle ;
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;
    }
}

In the wiki you'll find a lesson from aKalisch that shows you how to find the writeable viewangles location in memory. Here is his advice for RCS:

First of you need the netvar for m_Local and m_aimPunchAngle.
Then read LocalPlayer + m_Local + m_aimPunschAngle.
Then you just need to substract those angles from your ViewAngles.
sacredgeo commented 8 years ago

@aKalisch

Do you think I should normalize the viewangles before setting them? I did a prinft to terminal of every new angle before setting it. The yaw values were always > -180 and < 180. Pitch was always in range as well, although I didn't try shooting straight down.

Also, I've seen talk about randomization. I could generate a small random number and add it to the new viewangle. Do you think that's necessary?

extrenebiibues commented 8 years ago

@sacredgeo you're not making a smooth aimbot? Everyone on this github has been fucking begging for it and @aKalisch is getting poopy

sacredgeo commented 8 years ago

@extrenebiibues I'm still working on it. It's a very difficult task.

aKalisch commented 8 years ago

@aKalisch is getting poopy

Wow. Thx for these words. You are a guy that wants all for nothing. So I'll don't release anything as there are so many guys like u. I give so many tips and hints to sacredgeo that he's able to build his own. He puts effort to it. That's why I help him. I've released a Bunnyhop source. And everybody was crying "How to implement this SHIT". sacredgeo managed to implement it with ease (I think).

So stop talking shit about me. I'll help and give something to the community. You just want to take!

aKalisch commented 8 years ago

at issue @sacredgeo your code is to complicated.

It can be more simple.

Vector3 m_viewAngle = {0, 0, 0};
bool m_rcson = false;

...
...
...

if(!LocalPlayer.ActiveWeaponRCSWeapon())
{
    return;
}

Vector3 RCSViewAngle;

if( !m_rcson )
{
    m_viewAngle = your.viewAngles;
}

if(/* isKeyPressed whateverYouWant */)
{
    RCSViewAngle = m_viewAngle - your.aimPunch * /*recoil aimount from 0.0f to 2.0f*/;

    g_pMath->ClampAngle( RCSViewAngle );
    SetViewAngles( RCSViewAngle );

    m_rcson = true;
    return;
}

m_rcson = false;
gazababon123 commented 8 years ago

@aKalisch im not proffesional, but hella you teach me alot

gazababon123 commented 8 years ago

@sacredgeo you also helped me :)

sacredgeo commented 8 years ago

@aKalisch I've got mine working pretty well, so I'm afraid to change it. All of your advice has really helped me, but this stuff isn't easy for me. Takes me hours to add any feature haha.

veb commented 8 years ago

What's next @sacredgeo? I'm keeping up with you! :-D

skoshx commented 8 years ago

@aKalish @gabsens So i was wondering what applications on mac are capable of making signatures? Or do you have to do all of that manually?

Thanks in advance.

sacredgeo commented 8 years ago

@veb Next I'd like a legit looking aimbot. I was working on it a few days ago, but I've got a long way to go.

Regarding the recoil control. When you spray normally, your gun rises with the recoil then moves back down afterwards to where your crosshair was set. Well, with the recoil control on, it works very nicely, but my gun is still moving down afterwards. I have to keep moving my mouse up after I shoot. I added some code to add the old angle back, but it does it instantly and looks very suspicious. Are you having the same problem?

extrenebiibues commented 8 years ago

@sacredgeo on my recoil controlling system my screen shakes is this visible to spectators ?

bertrand2012 commented 8 years ago

@sacredgeo Is it blatant ?

sacredgeo commented 8 years ago

@acer2245 Somewhat blatant yes. The recoil control itself looks very legit, but just trying to prevent the crosshair from moving down afterwards looks unnatural.

NexieCSGO commented 8 years ago

Anyone getting a "Expected unqualified-id" error?

aKalisch commented 8 years ago

@sacredgeo I don't understand why you don't use the Vector3 operators.

You could easily transform

                m_ViewAngle.x = m_ViewAngle.x + OldAngle.x;
                m_ViewAngle.y = m_ViewAngle.y + OldAngle.y;

to

                m_ViewAngle = m_ViewAngle + OldAngle;

It is less code what makes debugging more efficient. ;-)