Problem with active weapon id.

Posts 17 of 7 · Page 1 of 1
Problem with active weapon id.
Hello, I have one question, what's wrong with this code and why always returs id 257 ??

Code:
DWORD hWeapon = Read<DWORD>(BaseAddress + DwActiveWeapon);
int weaponEntId = hWeapon & 0xFFF;
DWORD DwWeaponBase = Read<DWORD>(DwClient + DwEntityList + (weaponEntId - 1) * 0x10);
int WeaponID = Read<int>(DwWeaponBase + DwWeaponId);

return WeaponID;
//Moved to the correct section
Quote Originally Posted by damian1221 View Post
Hello, I have one question, what's wrong with this code and why always returs id 257 ??

Code:
DWORD hWeapon = Read<DWORD>(BaseAddress + DwActiveWeapon);
int weaponEntId = hWeapon & 0xFFF;
DWORD DwWeaponBase = Read<DWORD>(DwClient + DwEntityList + (weaponEntId - 1) * 0x10);
int WeaponID = Read<int>(DwWeaponBase + DwWeaponId);

return WeaponID;
Show some offsets please.
DWORD DwActiveWeapon = 0x2EE8;
DWORD DwWeaponId = 0x32EC;
DWORD DwEntityList = 0x04AC90F4;
Quote Originally Posted by damian1221 View Post
DWORD DwActiveWeapon = 0x2EE8;
DWORD DwWeaponId = 0x32EC;
DWORD DwEntityList = 0x04AC90F4;
public const Int32 dwEntityList = 0x4AC9134;
Quote Originally Posted by damian1221 View Post
DWORD DwActiveWeapon = 0x2EE8;
DWORD DwWeaponId = 0x32EC;
DWORD DwEntityList = 0x04AC90F4;
If i remember correctly, you need to use the offset of the ItemDefinitionIndex instead of the WeaponID offset. That should return what you wish.
Code:
DWORD HandleToWeapons = Mem.Read<DWORD>(Player + Game.dwActiveWeapon); //Handle to the weapon class
		int EntityID = HandleToWeapons & 0xFFF;
		DWORD WeaponBase = Mem.Read<DWORD>(Game.Client.dwAdress + Game.dwEntityList + (EntityID * 0x10) - 0x10); // Weapon's Base
		WeaponID = Mem.Read<int>(WeaponBase + Game.dwItem);
		Clip = Mem.Read<int>(WeaponBase + Game.dwClip1);
Posts 17 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?