Sandman still has ammo.
If you use m_iItemDefinitionIndex then you would need a list to check against (
http://wiki.alliedmods.net/Team_Fort...nition_Indexes)
Think doing something like this would work.
PHP Code:
public bool:IsActiveWeaponMelee(client)
{
//returns false when active weapon is not melee
//otherwise returns true
new iWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
//do check to see if activeweapon is in the first slot
if(GetPlayerWeaponSlot(client, 2) != iWeapon)
return false;
if(!IsValidEntity(iWeapon))
return false;
//check to see if it has ammo
new iOffset = GetEntProp(iWeapon, Prop_Send, "m_iPrimaryAmmoType", 1)*4;
new iAmmoTable = FindSendPropInfo("CTFPlayer", "m_iAmmo");
new iCurAmmo = GetEntData(client, iAmmoTable+iOffset);
//has ammo, technically not a melee weapon
if(iCurAmmo > 0)
return false;
//it's a melee weapon :D
return true;
}
__________________