Team,
How can I reliably return the weapon classname of a players active weapon when they are holding a saxxy weapon such as 'The Bat Outta Hell' or the 'Prinny Machete'
For example, if I equip 'The Bat Outta Hell' each of these functions will return a classname of 'tf_weapon_bonesaw'. How do I get a classname of 'saxxy'?
Code:
char sWeapon2[32];
GetClientWeapon(target, sWeapon2, sizeof(sWeapon2));
/**
* Gets the classname and entity index of the current/active weapon of a client.
*
* @param client Client Index.
* @param buffer String Buffer to store the weapon's classname.
* @param size Max size of String: buffer.
* @return Weapon Entity Index on success or INVALID_ENT_REFERENCE otherwise
*/
stock Client_GetActiveWeaponName(client, String:buffer[], size)
{
new weapon = Client_GetActiveWeapon(client);
if (weapon == INVALID_ENT_REFERENCE) {
buffer[0] = '\0';
return INVALID_ENT_REFERENCE;
}
Entity_GetClassName(weapon, buffer, size);
return weapon;
}
Note, these functions seem to return the correct classname on all of the other weapon classes that I tested.