This code its a mess, but just try:

function fire_bullets()
{
if (weapon2)
{
//--- code here
}
}