@@ -559,86 +559,92 @@ private static void DisableControls()
559559 #region Disable Inputs when any menu is open.
560560 if ( IsAnyMenuOpen ( ) )
561561 {
562- var currentItem = GetCurrentMenu ( ) ? . Size > GetCurrentMenu ( ) ? . CurrentIndex ? GetCurrentMenu ( ) ? . GetMenuItems ( ) [ GetCurrentMenu ( ) . CurrentIndex ] : null ;
563- if ( currentItem != null )
562+ var currMenu = GetCurrentMenu ( ) ;
563+ if ( currMenu != null )
564564 {
565- if ( currentItem is MenuSliderItem || currentItem is MenuListItem || currentItem is MenuDynamicListItem )
565+ //var currentItem = currMenu.Size > currMenu.CurrentIndex ? currMenu.GetMenuItems()[currMenu.CurrentIndex] : null;
566+ var currentItem = currMenu . GetCurrentMenuItem ( ) ;
567+ if ( currentItem != null )
566568 {
567- if ( Game . CurrentInputMode == InputMode . GamePad )
568- Game . DisableControlThisFrame ( 0 , Control . SelectWeapon ) ;
569+ if ( currentItem is MenuSliderItem || currentItem is MenuListItem || currentItem is MenuDynamicListItem )
570+ {
571+ if ( Game . CurrentInputMode == InputMode . GamePad )
572+ Game . DisableControlThisFrame ( 0 , Control . SelectWeapon ) ;
573+ }
569574 }
570- }
571575
572- // Close all menus when the player dies.
573- if ( Game . PlayerPed . IsDead )
574- {
575- CloseAllMenus ( ) ;
576- }
576+ // Close all menus when the player dies.
577+ if ( Game . PlayerPed . IsDead )
578+ {
579+ CloseAllMenus ( ) ;
580+ }
577581
578- // Disable Gamepad/Controller Specific controls:
579- if ( Game . CurrentInputMode == InputMode . GamePad )
580- {
581- Game . DisableControlThisFrame ( 0 , Control . MultiplayerInfo ) ;
582- // when in a vehicle.
583- if ( Game . PlayerPed . IsInVehicle ( ) )
582+ // Disable Gamepad/Controller Specific controls:
583+ if ( Game . CurrentInputMode == InputMode . GamePad )
584584 {
585- Game . DisableControlThisFrame ( 0 , Control . VehicleHeadlight ) ;
586- Game . DisableControlThisFrame ( 0 , Control . VehicleDuck ) ;
585+ Game . DisableControlThisFrame ( 0 , Control . MultiplayerInfo ) ;
586+ // when in a vehicle.
587+ if ( Game . PlayerPed . IsInVehicle ( ) )
588+ {
589+ Game . DisableControlThisFrame ( 0 , Control . VehicleHeadlight ) ;
590+ Game . DisableControlThisFrame ( 0 , Control . VehicleDuck ) ;
587591
588- // toggles boost in some dlc vehicles, hence it's disabled for controllers only (pressing select in the menu would trigger this).
589- Game . DisableControlThisFrame ( 0 , Control . VehicleFlyTransform ) ;
592+ // toggles boost in some dlc vehicles, hence it's disabled for controllers only (pressing select in the menu would trigger this).
593+ Game . DisableControlThisFrame ( 0 , Control . VehicleFlyTransform ) ;
594+ }
590595 }
591- }
592- else // when not using a controller.
593- {
594- Game . DisableControlThisFrame ( 0 , Control . FrontendPauseAlternate ) ; // disable the escape key opening the pause menu, pressing P still works.
596+ else // when not using a controller.
597+ {
598+ Game . DisableControlThisFrame ( 0 , Control . FrontendPauseAlternate ) ; // disable the escape key opening the pause menu, pressing P still works.
595599
596- // Disable the scrollwheel button changing weapons while the menu is open.
597- // Only if you press TAB (to show the weapon wheel) then it will allow you to change weapons.
598- if ( ! Game . IsControlPressed ( 0 , Control . SelectWeapon ) )
600+ // Disable the scrollwheel button changing weapons while the menu is open.
601+ // Only if you press TAB (to show the weapon wheel) then it will allow you to change weapons.
602+ if ( ! Game . IsControlPressed ( 0 , Control . SelectWeapon ) )
603+ {
604+ Game . DisableControlThisFrame ( 24 , Control . SelectNextWeapon ) ;
605+ Game . DisableControlThisFrame ( 24 , Control . SelectPrevWeapon ) ;
606+ }
607+ }
608+ // Disable Shared Controls
609+
610+ // Radio Inputs
611+ Game . DisableControlThisFrame ( 0 , Control . RadioWheelLeftRight ) ;
612+ Game . DisableControlThisFrame ( 0 , Control . RadioWheelUpDown ) ;
613+ Game . DisableControlThisFrame ( 0 , Control . VehicleNextRadio ) ;
614+ Game . DisableControlThisFrame ( 0 , Control . VehicleRadioWheel ) ;
615+ Game . DisableControlThisFrame ( 0 , Control . VehiclePrevRadio ) ;
616+
617+ // Phone / Arrows Inputs
618+ Game . DisableControlThisFrame ( 0 , Control . Phone ) ;
619+ Game . DisableControlThisFrame ( 0 , Control . PhoneCancel ) ;
620+ Game . DisableControlThisFrame ( 0 , Control . PhoneDown ) ;
621+ Game . DisableControlThisFrame ( 0 , Control . PhoneLeft ) ;
622+ Game . DisableControlThisFrame ( 0 , Control . PhoneRight ) ;
623+
624+ // Attack Controls
625+ Game . DisableControlThisFrame ( 0 , Control . Attack ) ;
626+ Game . DisableControlThisFrame ( 0 , Control . Attack2 ) ;
627+ Game . DisableControlThisFrame ( 0 , Control . MeleeAttack1 ) ;
628+ Game . DisableControlThisFrame ( 0 , Control . MeleeAttack2 ) ;
629+ Game . DisableControlThisFrame ( 0 , Control . MeleeAttackAlternate ) ;
630+ Game . DisableControlThisFrame ( 0 , Control . MeleeAttackHeavy ) ;
631+ Game . DisableControlThisFrame ( 0 , Control . MeleeAttackLight ) ;
632+ Game . DisableControlThisFrame ( 0 , Control . VehicleAttack ) ;
633+ Game . DisableControlThisFrame ( 0 , Control . VehicleAttack2 ) ;
634+ Game . DisableControlThisFrame ( 0 , Control . VehicleFlyAttack ) ;
635+ Game . DisableControlThisFrame ( 0 , Control . VehiclePassengerAttack ) ;
636+ Game . DisableControlThisFrame ( 0 , Control . Aim ) ;
637+ Game . DisableControlThisFrame ( 0 , Control . VehicleAim ) ; // fires vehicle specific weapons when using right click on the mouse sometimes.
638+
639+ // When in a vehicle
640+ if ( Game . PlayerPed . IsInVehicle ( ) )
599641 {
600- Game . DisableControlThisFrame ( 24 , Control . SelectNextWeapon ) ;
601- Game . DisableControlThisFrame ( 24 , Control . SelectPrevWeapon ) ;
642+ Game . DisableControlThisFrame ( 0 , Control . VehicleSelectNextWeapon ) ;
643+ Game . DisableControlThisFrame ( 0 , Control . VehicleSelectPrevWeapon ) ;
644+ Game . DisableControlThisFrame ( 0 , Control . VehicleCinCam ) ;
602645 }
603646 }
604- // Disable Shared Controls
605-
606- // Radio Inputs
607- Game . DisableControlThisFrame ( 0 , Control . RadioWheelLeftRight ) ;
608- Game . DisableControlThisFrame ( 0 , Control . RadioWheelUpDown ) ;
609- Game . DisableControlThisFrame ( 0 , Control . VehicleNextRadio ) ;
610- Game . DisableControlThisFrame ( 0 , Control . VehicleRadioWheel ) ;
611- Game . DisableControlThisFrame ( 0 , Control . VehiclePrevRadio ) ;
612-
613- // Phone / Arrows Inputs
614- Game . DisableControlThisFrame ( 0 , Control . Phone ) ;
615- Game . DisableControlThisFrame ( 0 , Control . PhoneCancel ) ;
616- Game . DisableControlThisFrame ( 0 , Control . PhoneDown ) ;
617- Game . DisableControlThisFrame ( 0 , Control . PhoneLeft ) ;
618- Game . DisableControlThisFrame ( 0 , Control . PhoneRight ) ;
619-
620- // Attack Controls
621- Game . DisableControlThisFrame ( 0 , Control . Attack ) ;
622- Game . DisableControlThisFrame ( 0 , Control . Attack2 ) ;
623- Game . DisableControlThisFrame ( 0 , Control . MeleeAttack1 ) ;
624- Game . DisableControlThisFrame ( 0 , Control . MeleeAttack2 ) ;
625- Game . DisableControlThisFrame ( 0 , Control . MeleeAttackAlternate ) ;
626- Game . DisableControlThisFrame ( 0 , Control . MeleeAttackHeavy ) ;
627- Game . DisableControlThisFrame ( 0 , Control . MeleeAttackLight ) ;
628- Game . DisableControlThisFrame ( 0 , Control . VehicleAttack ) ;
629- Game . DisableControlThisFrame ( 0 , Control . VehicleAttack2 ) ;
630- Game . DisableControlThisFrame ( 0 , Control . VehicleFlyAttack ) ;
631- Game . DisableControlThisFrame ( 0 , Control . VehiclePassengerAttack ) ;
632- Game . DisableControlThisFrame ( 0 , Control . Aim ) ;
633- Game . DisableControlThisFrame ( 0 , Control . VehicleAim ) ; // fires vehicle specific weapons when using right click on the mouse sometimes.
634-
635- // When in a vehicle
636- if ( Game . PlayerPed . IsInVehicle ( ) )
637- {
638- Game . DisableControlThisFrame ( 0 , Control . VehicleSelectNextWeapon ) ;
639- Game . DisableControlThisFrame ( 0 , Control . VehicleSelectPrevWeapon ) ;
640- Game . DisableControlThisFrame ( 0 , Control . VehicleCinCam ) ;
641- }
647+
642648 }
643649 #endregion
644650 }
0 commit comments