I would encourage writing your own instead of just downloading or pasting someones code.
It’s useful to look at their code can give you the missing piece if you are confused sometimes.
You shouldn’t let other people think for you, you already have some of the correct hooks.
function GM:PlayerCanPickupWeapon(ply, weapon)
You posted all of these, which means you know how to navigate the wiki and think logically.
GM:PlayerCanPickupWeapon Is your key, if you return true the player can pickup the gun, if you return false they cannot pickup the gun.
Your limits and restrictions are up to you.
You can use the weapon class name and compare it to an array of “primary” and “secondary” weapons to check if they already have one, and if so return false.
Otherwise return true.
You could do the same thing with ammo type instead, which could simplify the length of the comparison especially if you have lots of guns, and work for every gun using “default” or “standard” ammo types.
It’s up to you to decide what works for you, you get to build the whole system. There could be even better and more clever ways to handle your weapons depending on your specific needs, which is why it’s good practice to learn to fish for yourself.