Source Code [CSGO | Internal] Autostrafe

  • CSGO recently moved logic from 'client_panorama.dll' to 'client.dll', you must update all code that uses 'client_panorama.dll' and replace it with 'client.dll' or the code will not work.
Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

KF1337

*copies code from tutorials, then breaks it.*
Dank Tier Donator
Full Member
Nobleman
Jan 30, 2020
152
3,603
0
Tutorial Link
N/A
How long you been coding/hacking?
since early 2019
Coding Language
C++
Requirements:
- hooking CreateMove
- know what your UserCMD is for.


What is autostrafe?
Strafing in CSGO means pressing your left/right key when you are moving your mouse in-air. This gives you extra movement speed.
We are going to automate "pressing" your keys by manipulating the UserCMD accordingly.


Inside your CreateMove hook:
C++:
bool __stdcall hooks::hkCreateMove(float flInputSampleTime, UserCMD* cmd)
{
    if (IsOnGround) // check if FL_ONGROUND is set..
        return;

    if ((GetAsyncKeyState(VK_SPACE) & 0x8000))
    {
        if (cmd->mousedeltaX > 0)
            cmd->sidemove = 450.0f; // strafe right

        if (cmd->mousedeltaX < 0)
            cmd->sidemove = -450.0f; // strafe left
    }

    return oCreateMove(flInputSampleTime, cmd);
}
TODO:
- combine this with a nice Bhop hack
- be phoon
 
  • Love
  • Like
Reactions: Rake and obdr

Kekz

Maybe Pasting
Dank Tier Donator
Nobleman
Jan 10, 2020
166
4,118
17
Small suggestions:
Inside your UserCMD struct there is an attribute called buttons which is a bit field where each flag represents one "button" (1 => button is pressed).
So instead of
C++:
if ((GetAsyncKeyState(VK_SPACE) & 0x8000))
which would only work if the player has jump bound to spacebar, you can do:
C++:
if (cmd->buttons & IN_JUMP)
C++:
enum buttonFlags
{
    IN_ATTACK = (1 << 0),
    IN_JUMP = (1 << 1),
    IN_DUCK = (1 << 2),
    IN_FORWARD = (1 << 3),
    IN_BACK = (1 << 4),
    IN_USE = (1 << 5),
    IN_CANCEL = (1 << 6),
    IN_LEFT = (1 << 7),
    IN_RIGHT = (1 << 8),
    IN_MOVELEFT = (1 << 9),
    IN_MOVERIGHT = (1 << 10),
    IN_ATTACK2 = (1 << 11),
    IN_RUN = (1 << 12),
    IN_RELOAD = (1 << 13),
    IN_ALT1 = (1 << 14),
    IN_ALT2 = (1 << 15),
    IN_SCORE = (1 << 16),
    IN_SPEED = (1 << 17),
    IN_WALK = (1 << 18),
    IN_ZOOM = (1 << 19),
    IN_WEAPON1 = (1 << 20),
    IN_WEAPON2 = (1 << 21),
    IN_BULLRUSH = (1 << 22),
    IN_GRENADE1 = (1 << 23),
    IN_GRENADE2 = (1 << 24),
    IN_ATTACK3 = (1 << 25),
};

You'll probably also want to add a check for your movetype, in order to not strafe when on a ladder / noclipping.
Hint: Look at hazedumper's netvar m_MoveType, it is also a bit field.
C++:
// Taken from Valve's SDK, don't have a link anymore
enum MoveTypes : uint8_t
{
    MOVETYPE_NONE = 0,
    // never moves
    MOVETYPE_ISOMETRIC,
    // For players -- in TF2 commander view, etc.
    MOVETYPE_WALK,
    // player only - moving on the ground
    MOVETYPE_STEP,
    // gravity, special edge handling -- monsters use this
    MOVETYPE_FLY,
    // No gravity, but still collides with stuff
    MOVETYPE_FLYGRAVITY,
    // flies through the air + is affected by gravity
    MOVETYPE_VPHYSICS,
    // uses VPHYSICS for simulation
    MOVETYPE_PUSH,
    // no clip to world, push and crush
    MOVETYPE_NOCLIP,
    // No gravity, no collisions, still do velocity/avelocity
    MOVETYPE_LADDER,
    // Used by players only when going onto a ladder
    MOVETYPE_OBSERVER,
    // Observer movement, depends on player's observer mode
    MOVETYPE_CUSTOM,
    // Allows the entity to describe its own physics
    MOVETYPE_LAST = MOVETYPE_CUSTOM,
    // should always be defined as the last item in the list
    MOVETYPE_MAX_BITS = 4
};
 
Last edited:
  • Love
  • Like
Reactions: Rake and KF1337

KF1337

*copies code from tutorials, then breaks it.*
Dank Tier Donator
Full Member
Nobleman
Jan 30, 2020
152
3,603
0
Yeah that is the better approach of course. I just wanted to point out the code that lets you autostrafe.

In an actual hack, one definitely should check for all the things you mentioned.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods