File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -729,6 +729,8 @@ class PluginPlayer
729729
730730 void QueryConvar (std::string cvar_name);
731731
732+ void PerformMenuAction (std::string action, int value);
733+
732734 bool IsValid ();
733735};
734736
Original file line number Diff line number Diff line change @@ -461,4 +461,20 @@ bool PluginPlayer::IsValid()
461461 if (!pawn) return false ;
462462
463463 return true ;
464+ }
465+
466+ void PluginPlayer::PerformMenuAction (std::string action, int value)
467+ {
468+ Player* self = g_playerManager->GetPlayer (this ->playerId );
469+ if (!self) return ;
470+
471+ if (action == " useOption" ) {
472+ while (self->GetSelection () != value-1 )
473+ self->MoveSelection ();
474+
475+ self->PerformMenuAction (g_Config->FetchValue <std::string>(" core.menu.buttons.use" ));
476+ } else if (action == " scrollToOption" ) {
477+ while (self->GetSelection () != value-1 )
478+ self->MoveSelection ();
479+ }
464480}
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ LoadLuaScriptingComponent(
7979 .addFunction (" GetConnectedTime" , &PluginPlayer::GetConnectedTime)
8080 .addFunction (" GetWeaponManager" , &PluginPlayer::GetWeaponManager)
8181 .addFunction (" QueryConvar" , &PluginPlayer::QueryConvar)
82+ .addFunction (" PerformMenuAction" , &PluginPlayer::PerformMenuAction)
8283 .addFunction (" IsValid" , &PluginPlayer::IsValid)
8384 .endClass ()
8485 .addFunction (" GetPlayer" , scripting_GetPlayer);
You can’t perform that action at this time.
0 commit comments