Results 1 to 11 of 11
  1. #1
    Gossam's Avatar
    Join Date
    Jun 2015
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    33

    spy auto backstab

    credits to gir four eighty nine

    Code:
    #include "CBackstab.h"
    
    #include "SDK.h"
    #include "CEntity.h"
    #include "Trace.h"
    #include "Util.h"
    
    const char *CBackstab::name() const { return "AUTO-BACKSTAB"; }
    
    void CBackstab::processCommand(CUserCmd *pUserCmd)
    {
        // if the hack is not enabled
        if(!enabled->getValue())
            return;
    
        // testing auto backstabb - works
        CEntity<> localPlayer(me);
    
        if(localPlayer.isNull())
            return;
    
        DWORD hActiveWeapon = *localPlayer.getPtr<DWORD>(gEntVars.hActiveWeapon);
    
        // if the handle is not valid
        if(!hActiveWeapon || hActiveWeapon == -1)
            return;
    
        // get entity index from handle
        int localWeaponIndex = hActiveWeapon & 0xFFF;
    
        // set up entity from index of handle
        CEntity<CBaseCombatWeapon> weapon(localWeaponIndex);
    
        if(weapon.isNull()) // is not null
            return;
    
        if(!CEntTag{weapon.castToPointer<CBaseEntity>()}.isMelee())
            return;
    
        //if(!weapon.get<bool>(gEntVars.bReadyToBackstab)) // is ready to backstab
        //    return false;
    
        char *name = weapon->GetName();
    
        if(name[10] == 'k' && name[11] == 'n') // check the important characters - there is only one weapon with a [k] and an [n] at pos 10 and 11
        {
            // TODO fixme
            if(!canBackstab(weapon, localPlayer))
                return;
    
            pUserCmd->buttons |= IN_ATTACK;
        }
        else
        {
            return;
        }
    
    
        return;
    }
    
    // backstab helper
    bool CBackstab::canBackstab(CEntity<CBaseCombatWeapon> &weap_entity, CEntity<> &local_entity)
    {
        trace_t trace;
    
        CEntity<CTFBaseWeaponMelee> tfweap(weap_entity.castTo<CTFBaseWeaponMelee>());
    
        bool istrace = tfweap->DoSwingTrace(trace);
    
        if(!istrace)
            return false;
    
        if(!trace.m_pEnt)
            return false;
    
        if(trace.m_pEnt->IsDormant())
            return false;
    
        CEntity<> other_entity(trace.m_pEnt->GetIndex());
    
        if(other_entity.get<BYTE>(gEntVars.iLifeState) != LIFE_ALIVE)
            return false;
    
        classId Class = other_entity->GetClientClass()->iClassID;
    
        if(Class != classId::CTFPlayer)
            return false;
    
        int other_team = other_entity.get<int>(gEntVars.iTeam); // so we dont have to get the netvar every time
    
        if(other_team == gLocalPlayerVars.team || (other_team < 2 || other_team > 3)) // check team is not our team or invalid team
            return false;
    
        if(isBehind(other_entity, local_entity))
        {
            Log::Console("Can Backstab!");
            return true;
        }
    
        return false;
    }
    // we cannot get the viewangles of another player so this function is defunct
    // maybe look into how the engine does it
    bool CBackstab::isBehind(CEntity<> &other_entity, CEntity<> &local_entity)
    {
        if(other_entity.isNull())
            return false;
    
        if(local_entity.isNull())
            return false;
    
        // Get the forward view vector of the target, ignore Z
        Vector vecVictimForward;
        AngleVectors(other_entity->GetPrevLocalAngles(), &vecVictimForward);
        vecVictimForward.z = 0.0f;
        vecVictimForward.NormalizeInPlace();
    
        // Get a vector from my origin to my targets origin
        Vector vecToTarget;
        Vector localWorldSpace;
        local_entity->GetWorldSpaceCenter(localWorldSpace);
        Vector otherWorldSpace;
        other_entity->GetWorldSpaceCenter(otherWorldSpace);
        vecToTarget = otherWorldSpace - localWorldSpace;
        vecToTarget.z = 0.0f;
        vecToTarget.NormalizeInPlace();
    
        // Get a forward vector of the attacker.
        Vector vecOwnerForward;
        AngleVectors(local_entity->GetPrevLocalAngles(), &vecOwnerForward);
        vecOwnerForward.z = 0.0f;
        vecOwnerForward.NormalizeInPlace();
    
        float flDotOwner = vecOwnerForward.Dot(vecToTarget);
        float flDotVictim = vecVictimForward.Dot(vecToTarget);
    
        // Make sure they're actually facing the target.
        // This needs to be done because lag compensation can place target slightly behind the attacker.
        if(flDotOwner > 0.5)
            return (flDotVictim > -0.1);
        
        return false;
    
        //typedef bool(__thiscall * IsBehindFn)(CBaseCombatWeapon *, CBaseEntity *);
    
        //static DWORD dwLoc = gSignatures.GetClientSignature("E8 ? ? ? ? 84 C0 74 08 5F B0 01 5E 5D C2 04 00 A1") + 0x1;
    
        //static DWORD dwIsBehind = ((*(PDWORD)(dwLoc)) + dwLoc + 4);
    
        //static IsBehindFn isBehind = (IsBehindFn)dwIsBehind;
    
        //return isBehind(local_entity.castToPointer<CBaseCombatWeapon>(), other_entity.castToPointer<CBaseEntity>());
    }
    
    bool CBackstab::engineCanBackstab(CBaseCombatWeapon *weapon, CBaseEntity *target)
    {
        typedef bool(__thiscall * BackstabFn)(CBaseCombatWeapon *, CBaseEntity *);
    
        static DWORD dwBackstabLoc = gSignatures.GetClientSignature("E8 ? ? ? ? 84 C0 74 36 80 BF") + 0x1;
    
        static DWORD dwBackstab = ((*(PDWORD)(dwBackstabLoc)) + dwBackstabLoc + 4);
    
        static BackstabFn backstab = (BackstabFn)dwBackstab;
    
        if(!weapon || !target)
            return false;
    
        CUtilMove::safeRunSimulation(gInts.Prediction.get(), target);
    
        bool r = backstab(weapon, target);
    
        return r;
    }
    
    bool CBackstab::predicts(CEntity<> &local, CEntity<> &other) { return false; }
    Last edited by Hunter; 10-23-2016 at 04:13 AM. Reason: Fixed.

  2. #2
    Chanchanbimy's Avatar
    Join Date
    Dec 2015
    Gender
    male
    Location
    7,924
    Posts
    2,283
    Reputation
    243
    Thanks
    360
    You should also put [ code] tags.
    Code:
     this is code

  3. #3
    McSpicy's Avatar
    Join Date
    Oct 2016
    Gender
    male
    Posts
    166
    Reputation
    10
    Thanks
    10
    what do u mean spy , is that TF2 ?

  4. #4
    Ally's Avatar
    Join Date
    Dec 2014
    Gender
    female
    Location
       ♥
    Posts
    8,697
    Reputation
    1610
    Thanks
    8,499
    My Mood
    Angelic
    Quote Originally Posted by TheSpotify View Post
    what do u mean spy , is that TF2 ?
    well it is a tf2 section

    Premium Member 22/4/16
    Steam Minion 22/12/2017
    OFPS Minion 5/2/2019
    MMO Minion 5/2/2019
    Minion+ 5/2/2019
    Mod 8/11/2020
    Retired 3/10/2022
    22 / Dec 7, 2001

  5. #5
    tf3hacker's Avatar
    Join Date
    Jun 2015
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    My Mood
    Amazed
    how do i use is?

  6. #6
    Earthcake's Avatar
    Join Date
    Sep 2016
    Gender
    female
    Posts
    9
    Reputation
    10
    Thanks
    0
    Im new to the hacking scene, and i am not sure what do do with this code. Do i put it in some kind of software of what?

  7. #7
    ricolaw's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    0
    My Mood
    Amazed
    Error at line1
    #Include file ""CBackstab.h""cannot be opened

    How can i fix this?

  8. #8
    LMAOBoxMidnight's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Location
    Mann Co Store
    Posts
    40
    Reputation
    10
    Thanks
    365
    Note to all new/clueless hackers: This is meant for people who CREATE hacks, if you don't know how then find another cheat.

  9. The Following 2 Users Say Thank You to LMAOBoxMidnight For This Useful Post:

    AlansXZ (01-25-2021),mindaugas70 (08-31-2020)

  10. #9
    Socht's Avatar
    Join Date
    Apr 2017
    Gender
    male
    Location
    6969 West Fag St
    Posts
    24
    Reputation
    10
    Thanks
    0
    I know how to use source code and get a cheat out of it, i just dont know if its supposed to be a dll or what.

    - - - Updated - - -

    Bump: *Sigh* nvm. I am fucking retarded, I got it now. I never knew what type fo project to make it. lol

  11. #10
    benschwahn's Avatar
    Join Date
    Sep 2016
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Thanks for the help

  12. #11
    mindaugas70's Avatar
    Join Date
    Jun 2017
    Gender
    male
    Location
    in the mistake land
    Posts
    19
    Reputation
    10
    Thanks
    30
    My Mood
    Fine
    I'd rather face-stab everybody
    thanks for the thanks bruv.

Similar Threads

  1. [Request] Auto-Backstab Spy Script
    By andre02203 in forum Team Fortress 2 Hacks
    Replies: 12
    Last Post: 05-22-2015, 04:21 PM
  2. [Request] Spy auto backstab script
    By velfraam in forum Team Fortress 2 Hacks
    Replies: 14
    Last Post: 04-27-2015, 07:18 PM
  3. [Source Code] Auto Backstab for spy script
    By 666Jizzy666 in forum Team Fortress 2 Hacks
    Replies: 86
    Last Post: 07-11-2014, 06:27 AM
  4. [Request] SPY auto backstab and pyro auto airblast script :o
    By peter_keyrouz in forum Team Fortress 2 Hacks
    Replies: 9
    Last Post: 10-03-2012, 11:31 PM
  5. super spy auto upload
    By samsam4152 in forum Combat Arms Mod Request
    Replies: 9
    Last Post: 07-08-2010, 04:55 PM