Results 1 to 4 of 4
  1. #1
    Doctorate's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Location
    127.0.0.1
    Posts
    212
    Reputation
    10
    Thanks
    30
    My Mood
    Amused

    Exclamation Which Weapon is the Player Wielding?

    Hey!

    I've just recently started to make CS:GO hacks. I have a basic understanding of C++.

    I've successfully managed to add an autopistol feature to my hack, but I can't figure out which offset to use in order to check whether the player is holding a pistol or rifle.

    Would appreciate some help, thanks!

    Incase I was too vague,

    What my source looks like:
    Code:
    if(toggleAutoPistol is true) {
    
       if(user is holding down leftmousebutton) {
    
           loop +attack -attack
    
       }
    
    }

    What I want my source to look like
    Code:
    if(toggleAutoPistol is true) {
    
       if(user is wielding a pistol) {
    
          if(user is holding down leftmousebutton) {
    
             loop +attack -attack
    
          }
    
       }
    
    }
    Last edited by Doctorate; 05-15-2016 at 11:35 AM.

  2. #2
    WasserEsser's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    735
    Reputation
    174
    Thanks
    677
    My Mood
    Busy
    Since you didn't specify whether you are internal or external, i'm going to provide you an example internally ( without using the engine functions, so you can easily translate it into external usage ).

    The entitylist contains a list of pointers to each entity in the game. This means that it also contains a pointer to your weapon. To get the right index to locate the weapon in the entitylist, you can get the m_hActiveWeapon handle and bitmask it with 0xFFF.

    Code:
    auto LocalPlayer = *reinterpret_cast< DWORD >( Client + 0x4F3336C ); // LocalPlayer
    auto WeaponHandle = *reinterpret_cast< DWORD >( LocalPlayer + 0x2EE8 ); // m_hActiveWeapon
    auto WeaponBase = *reinterpret_cast< DWORD >( Client + 0x4A9F8C4 + ( WeaponHandle & 0xFFF ) * sizeof( CEntInfo ) ); // sizeof( CEntInfo ) == 0x10
    
    auto WeaponID = *reinterpret_cast< int* >( WeaponBase + 2F88 ); // m_iItemDefinitionIndex
    Now you can compare it to the economy id's listed here: https://tf2b.com/itemlist.php?gid=730

  3. The Following User Says Thank You to WasserEsser For This Useful Post:

    Doctorate (05-17-2016)

  4. #3
    Doctorate's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Location
    127.0.0.1
    Posts
    212
    Reputation
    10
    Thanks
    30
    My Mood
    Amused
    Last edited by Doctorate; 05-17-2016 at 08:02 AM.

  5. #4
    Hunter's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Location
    Depths Of My Mind.
    Posts
    17,468
    Reputation
    3771
    Thanks
    6,159
    My Mood
    Cheerful
    /Solved & closed.

Similar Threads

  1. Expecting which weapons in the Halloween Patch...?
    By ahmedell in forum CrossFire Discussions
    Replies: 36
    Last Post: 10-17-2012, 08:01 AM
  2. Which Weapon Is The Best To Buy ?!
    By ._[S]corpion- in forum CrossFire Discussions
    Replies: 12
    Last Post: 03-27-2012, 04:18 PM
  3. [Discussion] Which Weapon is the best?
    By Selling/Trading in forum CrossFire Discussions
    Replies: 27
    Last Post: 03-17-2012, 06:34 AM
  4. [Help] Find out which Team the player is on
    By Arnibold in forum C++/C Programming
    Replies: 5
    Last Post: 09-01-2011, 05:20 PM
  5. Which client is the best for Indian players?
    By unihood in forum CrossFire Discussions
    Replies: 11
    Last Post: 09-05-2010, 04:39 AM