File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed 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 @@ -338,6 +338,34 @@ private unsafe HookResult ProcessUserCmds(DynamicHook hook)
338338 return HookResult . Continue ;
339339 }
340340
341+ [ ConsoleCommand ( "menuselect" ) ]
342+ public HookResult MenuSelect ( CCSPlayerController player , CommandInfo info )
343+ {
344+ if ( player is null || ! player . IsValid )
345+ return HookResult . Continue ;
346+ var menuState = DriverInstance ? . GetMenuState ( player , create : true ) ;
347+ if ( menuState is null )
348+ return HookResult . Continue ;
349+
350+ if ( info . ArgCount < 2 )
351+ {
352+ info . ReplyToCommand ( $ "menuselect: Invalid number of arguments provided") ;
353+ return HookResult . Continue ;
354+ }
355+
356+ var valStr = info . ArgByIndex ( 1 ) ;
357+ if ( ! int . TryParse ( valStr , CultureInfo . InvariantCulture , out var val ) )
358+ {
359+ info . ReplyToCommand ( $ "menuselect: Failed to parse argument as int: { valStr } ") ;
360+ return HookResult . Continue ;
361+ }
362+
363+ var key = ( PlayerKey ) ( ( int ) PlayerKey . SelectItem1 + ( val - 1 ) ) ;
364+
365+ menuState . HandleInput ( key , info . CallingContext == CommandCallingContext . Console ) ;
366+ return HookResult . Stop ;
367+ }
368+
341369 [ ConsoleCommand ( "css_1" ) ]
342370 public void Css1 ( CCSPlayerController player , CommandInfo info )
343371 {
You can’t perform that action at this time.
0 commit comments