[Zombies] Get Secondary/Next Weapon Name/ID

Topic created · 2 Posts · 83 Views
  • I tried everything to get a GSC script to get the name/ID of the secondary/next weapon in zombies and was unsuccessful. I just got the name of the current weapon and hand off. Does anyone here know how to do this?

  • I was able to find the function that does this!

    If someone is interested in using it, follow the code I made:

    changeRound()
    {
        for(;;)
        {
            level waittill( "end_of_round" ); // "start_of_round" works too
            wait 0.1;
            allWeapons = primaryWeapons();
    		
            if( level.round_number > 0 && isDefined(allWeapons) )
            {
                i = 0;
                while ( i < allWeapons.size )
                {
                    self setweaponammoclip( allWeapons[i], weaponclipsize( allWeapons[i] ) );
                    self givemaxammo( allWeapons[i] );
                    i++;
                }
                iprintln( "Voce mereceu, toma aqui seu ^2Max Ammo ^1<3" );
            }
        }
    }
    
    primaryWeapons()
    {
        primaryWeapons = self getweaponslistprimaries();
        if( primaryWeapons.size > 0 )
        {
            return primaryWeapons;
        }
        else
        {
            return;
        }
    }
    

    Basically, in this code created, at the end of the round the player get max ammo. It can be used when starting the round too, just change the "end_of_round" for "start_of_round".

    The function responsible for getting the names of the weapons is

    self getweaponslistprimaries ();
    

    returning an array with the names of weapons.

Log in to reply