I don't think a detour is required. SDKHook clients SDKHook_WeaponEquip and SDKHook_WeaponDrop and modify the reserve ammo with the following code.
You could track the entity each time someone equips or drops a weapon and set the ammo value accordingly. For example have g_iAmmo[2048][2] where g_iAmmo[weapon][0] is the EntIndexToEntRef() of the weapon to verify itself is the same weapon, and [1] would be the ammo you read/set when picked up/dropped. That would work for all weapons without issue from what I can think.
PHP Code:
// Plugin start:
g_iOffsetAmmo = FindSendPropInfo("CTerrorPlayer", "m_iAmmo");
g_iPrimaryAmmoType = FindSendPropInfo("CBaseCombatWeapon", "m_iPrimaryAmmoType");
// The function
int GetOrSetPlayerAmmo(int client, int iWeapon, int iAmmo = -1)
{
int offset = GetEntData(iWeapon, g_iPrimaryAmmoType) * 4; // Thanks to "Root" or whoever for this method of not hard-coding offsets: https://github.com/zadroot/AmmoManager/blob/master/scripting/ammo_manager.sp
// Get/Set
if( offset )
{
if( iAmmo != -1 ) SetEntData(client, g_iOffsetAmmo + offset, iAmmo);
else return GetEntData(client, g_iOffsetAmmo + offset);
}
return 0;
}
__________________