CS:S Get/Set dropped weapon's reserved ammo
These 2 stocks allow you to read and write the backpack ammo of any dropped weapon. The ammo is set as the reserved ammo of the player picking up that weapon.
PHP Code:
/**
* Gets the reserved ammo of a dropped weapon.
*
* @param weapon Weapon index.
*
* @return Reserved ammo for that weapon
* @error Weapon is not dropped, gamedata issues or offset not found.
*/
stock CS_GetDroppedWeaponAmmo(weapon);
/**
* Sets the reserved ammo of a dropped weapon.
*
* @param weapon Weapon index.
* @param ammo Amount of ammunition to set to.
*
* @return Reserved ammo for that weapon
* @error Weapon is not dropped, gamedata issues or offset not found.
*/
stock CS_SetDroppedWeaponAmmo(weapon, ammo);
Users need the gamedata file next to your plugin, if you use this snippet. If the offset should change, you only need to link to the updated gamedata. No recompiling is required.
Thanks to psychonic sharing his assembler skills and writing up this include file initially!