Restrict number of weapons by category?

Hello. Could anyone whip me up a script that will restrict the number of weapons by a category? I want players to only be able to have one weapon in Category 1, one in Category 2, and one in Category 3. Im sure its probbably very easy but I am unable to find a solution as how to code it. Thank you in advanced and any help is much appreciated

Use variables.