File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ https://www.youtube.com/watch?v=Be7qop6pVpI
77When number keys are bound with the following snippet, automatically detected and the menu will look like it used to in CSS and CS:GO:
88
99```
10- bind 1 "slot1;css_1"
10+ bind 1 "slot1;css_1" // menuselect 1 is also supported
1111bind 2 "slot2;css_2"
1212...
1313bind 9 "slot9;css_9"
Original file line number Diff line number Diff line change @@ -362,6 +362,32 @@ private unsafe HookResult ProcessUserCmds(DynamicHook hook)
362362 return HookResult . Continue ;
363363 }
364364
365+ [ ConsoleCommand ( "menuselect" ) ]
366+ public void MenuSelect ( CCSPlayerController player , CommandInfo info )
367+ {
368+ if ( player is null || ! player . IsValid )
369+ return ;
370+ var menuState = DriverInstance ? . GetMenuState ( player , create : true ) ;
371+ if ( menuState is null )
372+ return ;
373+
374+ if ( info . ArgCount < 2 )
375+ {
376+ info . ReplyToCommand ( $ "menuselect: Invalid number of arguments provided") ;
377+ return ;
378+ }
379+
380+ var valStr = info . ArgByIndex ( 1 ) ;
381+ if ( ! int . TryParse ( valStr , CultureInfo . InvariantCulture , out var val ) )
382+ {
383+ info . ReplyToCommand ( $ "menuselect: Failed to parse argument as int: { valStr } ") ;
384+ return ;
385+ }
386+
387+ var key = ( PlayerKey ) ( ( int ) PlayerKey . SelectItem1 + ( val - 1 ) ) ;
388+ menuState . HandleInput ( key , info . CallingContext == CommandCallingContext . Console ) ;
389+ }
390+
365391 [ ConsoleCommand ( "css_1" ) ]
366392 public void Css1 ( CCSPlayerController player , CommandInfo info )
367393 {
You can’t perform that action at this time.
0 commit comments