File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,6 +67,14 @@ public class MenuController : BaseScript
6767 public static bool PreventExitingMenu { get ; set ; } = false ;
6868 public static bool DisableBackButton { get ; set ; } = false ;
6969 public static bool SetDrawOrder { get ; set ; } = true ;
70+ public static bool MenuToggleKeyIsValid
71+ {
72+ get
73+ {
74+ int keyInt = ( int ) MenuToggleKey ;
75+ return keyInt >= 0 && keyInt <= 402 ; // 402 is max control value allowed after TU3788
76+ }
77+ }
7078 public static Control MenuToggleKey { get ; set ; }
7179#if FIVEM
7280 = Control . InteractionMenu ;
@@ -441,6 +449,12 @@ private bool IsDownPressed()
441449 /// <returns></returns>
442450 private async Task ProcessToggleMenuButton ( )
443451 {
452+ if ( ! MenuToggleKeyIsValid )
453+ {
454+ await Delay ( 1_500 ) ;
455+ return ;
456+ }
457+
444458#if FIVEM
445459 await ProcessToggleMenuButtonFiveM ( ) ;
446460#endif
@@ -754,6 +768,11 @@ private async Task HandleMenuToggleKeyForController()
754768
755769 private void DisableMenuKeyThisFrame ( )
756770 {
771+ if ( ! MenuToggleKeyIsValid )
772+ {
773+ return ;
774+ }
775+
757776 Game . DisableControlThisFrame ( 0 , MenuToggleKey ) ;
758777 if ( Game . CurrentInputMode == InputMode . MouseAndKeyboard )
759778 {
You can’t perform that action at this time.
0 commit comments