It works correctly if i do what u said and put it in a separate file. But i tried using the code in my current project and it doesn't work. I have the two weapons, and the first line of each says this,
Code:
 action ak47
{
gun_number = 1;
...
}

action mp5
{
gun_number = 2;
...
}

Now when i start the game, the AK47 string loads along with the gun, but when i pick up the mp5, the string does not update. (the check function of mine is the same as yours).

Any ideas?