ItsMods

Full Version: Switch To Next Weapon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Any one knows how to do such a thing?

I know theres switchToWeapon but it needs a weapon name, is there a way to just switch to next weapon?
C++ Code
  1. weaponList = self getWeaponListPrimaries();
  2. curWeapon = self getCurrentWeapon();
  3. for( i = 0; i < weaponList.size; i++ )
  4. {
  5. if( curWeapon == weaponList[i] )
  6. continue;
  7.  
  8. if( isDefined( weaponList[ i+1 ] ) )
  9. {
  10. self switchToWeapon( weaponList[ i+1 ] );
  11. break;
  12. }
  13. else
  14. {
  15. self switchToWeapon( weaponList[ i-1 ] );
  16. break;
  17. }
  18. }


?
(07-19-2011, 19:17)iAegle Wrote: [ -> ]
C++ Code
  1. weaponList = self getWeaponListPrimaries();
  2. curWeapon = self getCurrentWeapon();
  3. for( i = 0; i < weaponList.size; i++ )
  4. {
  5. if( curWeapon == weaponList[i] )
  6. continue;
  7.  
  8. if( isDefined( weaponList[ i+1 ] ) )
  9. {
  10. self switchToWeapon( weaponList[ i+1 ] );
  11. break;
  12. }
  13. else
  14. {
  15. self switchToWeapon( weaponList[ i-1 ] );
  16. break;
  17. }
  18. }


?

Looks exactly like what I need thx alot

can you just explain me how to add this as a self function? so I can do self weaponNext and it switch to the next weapon?

EDIT : I get unknown fucntion for

weaponList = self getWeaponListPrimaries();

EDIT: you forgot a s to weapon

EDIT: got it working nvm