how would i make a weapon pickup script

heres my script for weapon switching

function Start()
{
 SwitchWeapon(0);
}

function Update()
{
if (Input.GetKeyDown("1"))
{
SwitchWeapon(0);
}
else if(Input.GetKeyDown("2"))
{
SwitchWeapon(1);
}
else if(Input.GetKeyDown("3"))
{
SwitchWeapon(2);
}
}
function SwitchWeapon(index : int)
{
for(var i = 0; i<transform.childCounti;++)
{
if(i == index)
{
transform.GetChild(i).gameObject.SetActiveRecursively(true);
}
else { transform.GetChild(i).gameObject.SetActiveRecursively(false);
}
}

Usually the weapons you pick up (as well as other pick up items) are totally fake: they are just models with trigger volumes. When you enter the pick up trigger, the fake object is destroyed and the appropriate variables in your weapon scripts are set - usually a boolean variable that tells whether you have such weapon, or the ammo clip variable is incremented etc. Take a look at this question for a simple example of a pick up code, and at this other question to see a more complete example, with pick up and weapon selection code.