Sharing my snippet that allows me to use it just like before the
4/28/2015 Patch
There is no checking for valid entities since that has been done before I call these stocks
PHP Code:
/*
* Gets the primary clip count of a weapon.
*
* @param weapon Weapon Entity.
* @return Primary Clip count.
*/
stock lib_GetPrimaryAmmo(weapon)
{
return GetEntProp(weapon, Prop_Data, "m_iClip1");
}
/*
* Sets the primary ammo count of a weapon.
*
* @param weapon Weapon Entity.
* @param value Clip Count value.
*/
stock lib_SetPrimaryAmmo(weapon,ammo)
{
SetEntProp(weapon, Prop_Data, "m_iClip1", ammo);
}
/*
* Gets the secondary clip count of a weapon.
*
* @param weapon Weapon Entity.
* @return Primary Clip count.
*/
stock lib_GetSecondaryAmmo(weapon)
{
return GetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
}
/*
* Sets the secondary ammo count of a weapon.
*
* @param weapon Weapon Entity.
* @param value Clip Count value.
*/
stock lib_SetSecondaryAmmo(weapon,ammo)
{
SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", ammo);
}
/*
* Sets the primarty and secondary ammo count of a weapon.
*
* @param weapon Weapon Entity.
* @param value Primary ammo Count value.
* @param value Primary ammo Count value.
*/
stock lib_SetWeaponAmmo(weapon,primaryammo,secondaryammo)
{
lib_SetPrimaryAmmo(weapon, primaryammo);
lib_SetSecondaryAmmo(weapon, secondaryammo);
}
/*
* Gets the primary and secondary clip count of a weapon.
*
* @param weapon Weapon Entity.
* @param primaryammo Primary Clip count.
* @param secondaryammo Secondary Clip count.
*/
stock lib_GetWeaponAmmo(weapon,&primaryammo,&secondaryammo)
{
primaryammo = lib_GetPrimaryAmmo(weapon);
secondaryammo = lib_GetSecondaryAmmo(weapon);
}
Doing lib_SetWeaponAmmo(weapon,0,0)
results into