Only thing I have to ask is with the code what are you trying to do? Are you trying to add ammo for 1 specific weapon or the type of weapon that is equipped at that current point in time? If you want to add ammo for 1 specific type of weapon you could do
If ( player.getEquipped NVGaussRilfe == 1 )
player.addItem Microfusioncell 1000
ENDIF
One thing i'm experimenting with form lists and what you could do is separate the weapons that use microfusion cells, electron charge packs, physical ammo, etc... . It'll be tricky for the physical ammo and figuring out how to do 1 straight line of code without doing a ton of IFs would be the challenge. As for determining if the player doesn't have anything equipped I think that would fall into the "Unarmed/Melee Weapons" which would be covered by the formlist.
This code may give you some help:
IF (player.IsWeaponInList RepairKitEnergyListPart1 == 1 || player.IsWeaponInList RepairKitEnergylistPart2 == 1 )
That basically references a formlist I created which contains energy weapons. I split it into 2 parts so the computer isn't constantly going through 30+ weapons in 1 single list which can bog it down. It's much faster to go through 2 seperate lists containing 10 to 15 weapons each.
IF (player.IsWeaponInList ProjectileList == 1 || player.IsWeaponInList FusionCell == 1 || player.IsWeaponInList SmallCell == 1 ) *insert code*ELSEShowMessage WeaponNoAmmoENDIFEND
Thing i'm not seeing is the Player.GetWeaponAmmo command/function are you using the script extender? You could even take the code and split it up so that IF (player.isweaponinlist smallcell == 1) it'll add 1000 small cells to the player's ammo count.
*Edit*
Had a quick thought OP you instead of putting the weapons in a formlist you could just check to see if the player is using the Unarmed Skill or if they are using melee weapons by doing the player.getEquipped Unarmed == 1 || player.getEquipped MeleeWeapons == 1 and if the player is unarmed it will trigger a message. If it isn't then you can do an else then put your code into the Else area.