OnPlayerSelectedMenuRow
From SA-MP Wiki
This callback is called when a player selects an item from a menu.
(playerid, row)
| playerid | The ID of the player that selected an item on the menu. |
| row | The row that was selected. |
| Returns | This callback does not handle returns. |
new Menu:myMenu; public OnGameModeInit() { myMenu= CreateMenu("Example Menu", 1, 50.0, 180.0, 200.0, 200.0); AddMenuItem(myMenu, 0, "Item 1"); AddMenuItem(myMenu, 0, "Item 2"); return 1; } public OnPlayerSelectedMenuRow(playerid, row) { if(GetPlayerMenu(playerid) == myMenu) { switch(row) { case 0: print("Item 1"); case 1: print("Item 2"); } } return 1; }
Related Callbacks
The following callbacks might be useful as well, as they're related to this callback in one way or another.
- OnPlayerExitedMenu: Called when a player exits a menu.
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- CreateMenu: Create a menu.
- DestroyMenu: Destroy a menu.
- AddMenuItem: Add an item to a menu.
- ShowMenuForPlayer: Show a menu for a player.
- HideMenuForPlayer: Hide a menu for a player.
