Hey, even though this worked and all, I have an even more complicated problem that I think might be able to be solved in much the same way.
(I hope the guy who helped me before can see this)
I have an entity that uses the model of a weapon. When you press E on the entity, you get the corresponding weapon (and the entity removes itself).
The SWEP you receive has a DefaultClip of 0, meaning it has no ammo when you get it. I HAD to make the SWEP that way in order to avoid potential exploitation (because if the SWEP had ammo inherently, you could shoot it empty, drop it, pick it up, and it would have ammo again).
Whenever you drop the weapon (currently the only way is by dying), it re-creates the special weapon-giving entity on the ground near you.
Problem is, if you have a full magazine in your weapon or if you have ANY ammo (PrimaryClip) in your weapon when you drop it, the entity created will still give the next person to activate it an empty SWEP. In this way it is possible to lose ammunition into oblivion (which is something I want to avoid).
There must be SOME way to get the ammo count in someone’s PrimaryClip, store it somehow in the entity that is created when the weapon is dropped, and then, when the SENT is activated, implant it into the SWEP that’s given so that the person picking it up receives a SWEP with the same amount of ammo in its magazine as the SWEP the previous person had.
I hope that made sense.
Simple example:
Bob was on his last mag and had 2 rounds left in his pistol when he got mauled by zombies. When he died, his pistol dropped to the ground. Jim came along and picked up Bob’s pistol, which had 2 rounds left in the magazine. Jim fired the two shots, at which point the pistol was empty. Jim didn’t have any pistol rounds with him, so he dropped the empty pistol and continued on his way. Later, Frank saw the pistol on the ground and picked it up, but, much to his dismay, it was empty.
EDIT:
I can think of a way to do this, but it requires that I make a SHITLOAD more SWEPs, one SWEP for each unique number of rounds in the magazine (and the ent gives you the SWEP that corresponds to the number of rounds the SWEP had when it was dropped the last time). I REALLY don’t want to do that.