Its actualy prety simple how i didit.
aicay i just had another float (weapon_2) and i stored the weapon id there.
Then i just made switch function that switches the weapon to weapon 2 and weapon 2 with weapon.
for weapon picking up i had 3 if statements. First one was if there is no weapon_2 then make weapon_2 from weapon and made the new weapon to replace current weapon. 2 one was that if the weapon_2 or weapon is same as picking up weapon where i just gived the player the ammo, and 3 one is that if there is weapon_2 that is not same as picking up weapon, then drop weapon and replace it with new one.
It is prety simple and works fine in vanila quake too
