SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.0 KiB

  1. // Test menu functionality filterscipt
  2. #include <a_samp>
  3. #define TEST_MENU_ITEMS 6
  4. new Menu:TestMenu;
  5. new TestMenuStrings[6][16] = {"Test1", "Test2", "Test3", "Test4", "Test5", "Test6"};
  6. HandleTestMenuSelection(playerid, row)
  7. {
  8. new s[256];
  9. if(row < TEST_MENU_ITEMS) {
  10. format(s,256,"You selected item %s",TestMenuStrings[row]);
  11. SendClientMessage(playerid,0xFFFFFFFF,s);
  12. }
  13. }
  14. InitTestMenu()
  15. {
  16. TestMenu = CreateMenu("Test Menu", 1, 200.0, 150.0, 200.0, 200.0);
  17. for(new x=0; x < TEST_MENU_ITEMS; x++) {
  18. AddMenuItem(TestMenu, 0, TestMenuStrings[x]);
  19. }
  20. }
  21. public OnFilterScriptInit()
  22. {
  23. InitTestMenu();
  24. }
  25. public OnPlayerSelectedMenuRow(playerid, row)
  26. {
  27. new Menu:PlayerMenu = GetPlayerMenu(playerid);
  28. if(PlayerMenu == TestMenu) {
  29. HandleTestMenuSelection(playerid, row);
  30. }
  31. }
  32. public OnPlayerCommandText(playerid, cmdtext[])
  33. {
  34. if(!strcmp(cmdtext, "/menutest", true)) {
  35. ShowMenuForPlayer(TestMenu, playerid);
  36. return 1;
  37. }
  38. return 0;
  39. }