I wasn't descriptive enough in my last thread so I thought I might as well make it 100% c&p.
Now I don't like using assembly, but in this case I had to, because otherwise it crashes. :(
usage:
Now I don't like using assembly, but in this case I had to, because otherwise it crashes. :(
PHP Code:
g_dwWeaponIdToString = Tools.FindPattern((DWORD)GetModuleHandle("client.dll"), 0x726000, (BYTE*)"\x55\x8B\xEC\x8B\x4D\x08\x33\xC0\xEB\x06\x8D\x9B", "xxxxxxxxxxxx");
PHP Code:
__inline const char* GetWeaponName(int weaponID)
{
const char* wpnName = 0;
_asm
{
PUSH weaponID
CALL g_dwWeaponIdToString
ADD ESP, 4
MOV wpnName, EAX
}
return wpnName;
}
Code:
C_BaseCombatWeapon *pWeapon = GetWeapon(pPlayer);
if (!pWeapon)
return;
int weaponId = GetWeaponId(pWeapon);
const char* name = GetWeaponName(weaponId);