this shows you when a player is reloadnig the current weapon in there hand. you need to put "IsReloading(Weapon)" on a timer or hook "IN_RELOAD" to see if the player is reloading or not
PHP Code:
stock bool:IsReloading(Weapon)
{
//Valid Weapon:
if(Weapon != -1)
{
//Declare
new ReloadOffset = GetEntProp(Weapon, Prop_Data, "m_bInReload");
//Not Reloading:
if(ReloadOffset == 1)
{
//Return:
return true;
}
}
//Return:
return false;
}
stock bool:IsValidWeapon(Client)
{
//Declare:
decl String:WeaponName[32];
//Initialize:
GetClientWeapon(Client, WeaponName, sizeof(WeaponName));
//Valid Weapon:
if((StrEqual(WeaponName, "weapon_crowbar") || StrEqual(WeaponName, "weapon_stunstick")))
{
//Return:
return false;
}
//Return:
return true;
}
stock HasClientWeapon(Client)
{
//Declare
new Offset = FindSendPropOffs("CBasePlayer", "m_hMyWeapons");
new MaxGuns = 256;
//Loop:
for(new X = 0; X < MaxGuns; X = (X + 4))
{
//Declare:
new WeaponId = GetEntDataEnt2(Client, Offset + X);
//Valid Weapon:
if(WeaponId > 0)
{
//Declare:
decl String:ClassName[32], String:WeaponName[32];
//Initialize:
GetClientWeapon(Client, WeaponName, sizeof(WeaponName));
GetEdictClassname(WeaponId, ClassName, sizeof(ClassName));
//Valid Weapon:
if(IsValidWeapon(Client) == true)
{
//Is Current Weapon:
if(StrEqual(WeaponName, ClassName))
{
//Return:
return WeaponId;
}
}
}
}
//Return:
return -1;
}
__________________