Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

LegitStrafe Changes #735

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Hacks/aimbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,27 @@ void Aimbot::NoShoot(C_BaseCombatWeapon* activeWeapon, C_BasePlayer* player, CUs
if (*activeWeapon->GetItemDefinitionIndex() == ItemDefinitionIndex::WEAPON_REVOLVER)
cmd->buttons &= ~IN_ATTACK2;
else
{
//Assuming all important checks have already been done.
C_BasePlayer* localplayer = (C_BasePlayer*) entityList->GetClientEntity(engine->GetLocalPlayer());
Vector traceStart, traceEnd;
trace_t tr;
QAngle viewAngles;
engine->GetViewAngles(viewAngles);
QAngle viewAngles_rcs = viewAngles + *localplayer->GetAimPunchAngle() * 2.0f;
Math::AngleVectors(viewAngles_rcs, traceEnd);
traceStart = localplayer->GetEyePosition();
traceEnd = traceStart + (traceEnd * 8192.0f);
Ray_t ray;
ray.Init(traceStart, traceEnd);
CTraceFilter traceFilter;
traceFilter.pSkip = localplayer;
trace->TraceRay(ray, 0x46004003, &traceFilter, &tr);
C_BasePlayer* target = (C_BasePlayer*) tr.m_pEntityHit;
//if the player your aiming at is the aimbot target you can shoot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after // in comments

if(target==player)return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space before and after if parentheses

cmd->buttons &= ~IN_ATTACK;
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions src/Hacks/autostrafe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ void LegitStrafe(C_BasePlayer* localplayer, CUserCmd* cmd)
if (localplayer->GetFlags() & FL_ONGROUND)
return;

if (cmd->buttons & IN_FORWARD || cmd->buttons & IN_BACK || cmd->buttons & IN_MOVELEFT || cmd->buttons & IN_MOVERIGHT)
return;

if (cmd->mousedx <= 1 && cmd->mousedx >= -1)
return;

switch (Settings::AutoStrafe::type)
{
case AutostrafeType::AS_FORWARDS:
cmd->sidemove = cmd->mousedx < 0.f ? -450.f : 450.f;
cmd->forwardmove=0.f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

cmd->sidemove = cmd->mousedx < 0.f ? -450.f :cmd->mousedx==0?0.f: 450.f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd->sidemove = cmd->mousedx < 0.f ? -450.f : cmd->mousedx == 0 ? 0.f : 450.f;

This could also be split into separate if statements to make it more clear what is going on.

break;
case AutostrafeType::AS_BACKWARDS:
cmd->forwardmove=0.f;
cmd->sidemove = cmd->mousedx < 0.f ? 450.f : -450.f;
break;
case AutostrafeType::AS_LEFTSIDEWAYS:
cmd->sidemove=0.f;
cmd->forwardmove = cmd->mousedx < 0.f ? -450.f : 450.f;
break;
case AutostrafeType::AS_RIGHTSIDEWAYS:
cmd->sidemove=0.f;
cmd->forwardmove = cmd->mousedx < 0.f ? 450.f : -450.f;
break;
default:
Expand Down