Guest User

PreviewModelDialog - add zoom

a guest
Feb 8th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 51.35 KB | None | 0 0
  1. #if defined previewmodel_dialog_included
  2.     #endinput
  3. #endif
  4. #define previewmodel_dialog_included
  5.  
  6. /**************************************/
  7. // PreviewModelDialog.inc - v4.4 - Last Updated: 8 Feb, 2018 - By Gammix
  8. /***************************************/
  9.  
  10. // by BigETI
  11. #include <memory.inc>
  12.  
  13. // definitions
  14. #if !defined MAX_DIALOG_PREVIEW_MODELS
  15.     #define MAX_DIALOG_PREVIEW_MODELS 350
  16. #endif
  17.  
  18. #if !defined MAX_DIALOG_PREVIEW_TEXTSIZE
  19.     #define MAX_DIALOG_PREVIEW_TEXTSIZE 64
  20. #endif
  21.  
  22. #define DIALOG_STYLE_PREVIEW_MODEL 6 // new dialog id definition
  23. #define DIALOG_STYLE_PREVMODEL DIALOG_STYLE_PREVIEW_MODEL
  24.  
  25. #define MAX_DIALOG_PREVIEW_ROWS 2
  26. #define MAX_DIALOG_PREVIEW_COLUMNS 6
  27.  
  28. #define DIALOG_PREVIEW_HORIZONTAL_GAP 56.5
  29. #define DIALOG_PREVIEW_VERTICAL_GAP 63.5
  30.  
  31. #define DIALOG_PREVIEW_SELECT_COLOR 0xFF0000FF
  32. #define DIALOG_PREVIEW_UNSELECT_COLOR 0x464646FF
  33.  
  34. #define SCROLL_BAR_UP_TEXTDRAW Prev@FrameTD[4]
  35. #define SCROLL_BAR_DOWN_TEXTDRAW Prev@FrameTD[6]
  36.  
  37. #define LEFT_BUTTON_TEXTDRAW Prev@LeftButtonTD[0]
  38. #define RIGHT_BUTTON_TEXTDRAW Prev@RightButtonTD[0]
  39. #define CENTER_BUTTON_TEXTDRAW Prev@CenterButtonTD[0]
  40.  
  41. #define LISTITEM_TEXTDRAW<%0> Prev@ModelTD[%0][0]
  42. #define LISTITEM_ROTATE_LEFT_TEXTDRAW<%0> Prev@ModelTD[%0][2]
  43. #define LISTITEM_ROTATE_RIGHT_TEXTDRAW<%0> Prev@ModelTD[%0][3]
  44.  
  45. #define LISTITEM_ZOOM_UP_TEXTDRAW<%0> Prev@ModelTD[%0][4]
  46. #define LISTITEM_ZOOM_DOWN_TEXTDRAW<%0> Prev@ModelTD[%0][5]
  47.  
  48. // variables
  49. static Text:Prev@FrameTD[8];
  50. static Text:Prev@LeftButtonTD[2];
  51. static Text:Prev@RightButtonTD[2];
  52. static Text:Prev@CenterButtonTD[2];
  53. static Text:Prev@ModelTD[MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS][6];
  54.  
  55. static PlayerText:Prev@HeaderPTD[MAX_PLAYERS];
  56. static PlayerText:Prev@LeftButtonPTD[MAX_PLAYERS];
  57. static PlayerText:Prev@RightButtonPTD[MAX_PLAYERS];
  58. static PlayerText:Prev@CenterButtonPTD[MAX_PLAYERS];
  59. static PlayerText:Prev@PageNumberPTD[MAX_PLAYERS];
  60. static PlayerText:Prev@ScrollBarPTD[MAX_PLAYERS];
  61. static PlayerText:Prev@ModelTextPTD[MAX_PLAYERS][MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS][2];
  62.  
  63. static bool:Prev@CancelSelection[MAX_PLAYERS];
  64.  
  65. static Prev@PlayerDialogID[MAX_PLAYERS];
  66. static Prev@PlayerDialogListitem[MAX_PLAYERS];
  67. static Prev@PlayerDialogNumListitems[MAX_PLAYERS];
  68. static Prev@PlayerDialogPage[MAX_PLAYERS];
  69. static Prev@PlayerDialogTickCount[MAX_PLAYERS];
  70.  
  71. static Pointer:Prev@PlayerModelsPointer[MAX_PLAYERS];
  72. static Pointer:Prev@PlayerModelRotsPointer[MAX_PLAYERS][4];
  73. static Pointer:Prev@PlayerModelNamesPointer[MAX_PLAYERS][MAX_DIALOG_PREVIEW_MODELS];
  74.  
  75. // public function decleration
  76. ShowPreviewModelDialog(playerid, dialogid, caption[], models[], labels[][], button1[], button2[], size = sizeof models);
  77. SetDialogPreviewRotation(playerid, listitem, Float:rx, Float:ry, Float:rz, Float:zoom);
  78.  
  79. // internal functions
  80. static Prev_GetNumPages(playerid) {
  81.     new SIZE = Prev@PlayerDialogNumListitems[playerid];
  82.     new PAGESIZE = (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS);
  83.     return ((SIZE / PAGESIZE) + ((SIZE % PAGESIZE) ? 1 : 0));
  84. }
  85.  
  86. static Prev_CancelSelectTextDraw(playerid) {
  87.     Prev@CancelSelection[playerid] = true;
  88.     return CancelSelectTextDraw(playerid);
  89. }
  90.  
  91. static Prev_CreateTextDraws() {
  92.     /*
  93.     * FRAME
  94.     */
  95.     Prev@FrameTD[0] = TextDrawCreate(144.0000, 154.0000, "CONTENT_BOX");
  96.     TextDrawFont(Prev@FrameTD[0], 2);
  97.     TextDrawLetterSize(Prev@FrameTD[0], 0.0000, 18.2000);
  98.     TextDrawColor(Prev@FrameTD[0], -1);
  99.     TextDrawSetShadow(Prev@FrameTD[0], 0);
  100.     TextDrawSetOutline(Prev@FrameTD[0], 0);
  101.     TextDrawBackgroundColor(Prev@FrameTD[0], 255);
  102.     TextDrawSetProportional(Prev@FrameTD[0], 1);
  103.     TextDrawUseBox(Prev@FrameTD[0], 1);
  104.     TextDrawBoxColor(Prev@FrameTD[0], 150);
  105.     TextDrawTextSize(Prev@FrameTD[0], 501.0000, 0.0000);
  106.  
  107.     Prev@FrameTD[1] = TextDrawCreate(146.5000, 155.5000, "LD_SPAC:WHITE");
  108.     TextDrawFont(Prev@FrameTD[1], 4);
  109.     TextDrawLetterSize(Prev@FrameTD[1], 0.0000, 18.2000);
  110.     TextDrawColor(Prev@FrameTD[1], -1);
  111.     TextDrawSetShadow(Prev@FrameTD[1], 0);
  112.     TextDrawSetOutline(Prev@FrameTD[1], 0);
  113.     TextDrawBackgroundColor(Prev@FrameTD[1], 255);
  114.     TextDrawSetProportional(Prev@FrameTD[1], 1);
  115.     TextDrawUseBox(Prev@FrameTD[1], 1);
  116.     TextDrawBoxColor(Prev@FrameTD[1], 150);
  117.     TextDrawTextSize(Prev@FrameTD[1], 351.5000, 130.0000);
  118.  
  119.     Prev@FrameTD[2] = TextDrawCreate(147.0000, 156.0000, "LD_SPAC:BLACK");
  120.     TextDrawFont(Prev@FrameTD[2], 4);
  121.     TextDrawLetterSize(Prev@FrameTD[2], 0.0000, 18.2000);
  122.     TextDrawColor(Prev@FrameTD[2], -1);
  123.     TextDrawSetShadow(Prev@FrameTD[2], 0);
  124.     TextDrawSetOutline(Prev@FrameTD[2], 0);
  125.     TextDrawBackgroundColor(Prev@FrameTD[2], 255);
  126.     TextDrawSetProportional(Prev@FrameTD[2], 1);
  127.     TextDrawUseBox(Prev@FrameTD[2], 1);
  128.     TextDrawBoxColor(Prev@FrameTD[2], 150);
  129.     TextDrawTextSize(Prev@FrameTD[2], 340.5000, 129.0000);
  130.  
  131.     Prev@FrameTD[3] = TextDrawCreate(488.0000, 156.0000, "LD_SPAC:BLACK");
  132.     TextDrawFont(Prev@FrameTD[3], 4);
  133.     TextDrawLetterSize(Prev@FrameTD[3], 0.0000, 18.2000);
  134.     TextDrawColor(Prev@FrameTD[3], -1);
  135.     TextDrawSetShadow(Prev@FrameTD[3], 0);
  136.     TextDrawSetOutline(Prev@FrameTD[3], 0);
  137.     TextDrawBackgroundColor(Prev@FrameTD[3], 255);
  138.     TextDrawSetProportional(Prev@FrameTD[3], 1);
  139.     TextDrawUseBox(Prev@FrameTD[3], 1);
  140.     TextDrawBoxColor(Prev@FrameTD[3], 150);
  141.     TextDrawTextSize(Prev@FrameTD[3], 9.5000, 129.0000);
  142.  
  143.     // button for scrolling up
  144.     Prev@FrameTD[4] = TextDrawCreate(488.0000, 156.0000, "LD_POOL:BALL");
  145.     TextDrawFont(Prev@FrameTD[4], 4);
  146.     TextDrawLetterSize(Prev@FrameTD[4], 0.0000, 18.2000);
  147.     TextDrawColor(Prev@FrameTD[4], -1);
  148.     TextDrawSetShadow(Prev@FrameTD[4], 0);
  149.     TextDrawSetOutline(Prev@FrameTD[4], 0);
  150.     TextDrawBackgroundColor(Prev@FrameTD[4], 255);
  151.     TextDrawSetProportional(Prev@FrameTD[4], 1);
  152.     TextDrawUseBox(Prev@FrameTD[4], 1);
  153.     TextDrawBoxColor(Prev@FrameTD[4], 150);
  154.     TextDrawTextSize(Prev@FrameTD[4], 9.5000, 9.5000);
  155.     TextDrawSetSelectable(Prev@FrameTD[4], 1);
  156.     //
  157.  
  158.     Prev@FrameTD[5] = TextDrawCreate(489.0000, 156.5000, "LD_BEAT:UP");
  159.     TextDrawFont(Prev@FrameTD[5], 4);
  160.     TextDrawLetterSize(Prev@FrameTD[5], 0.0000, 18.2000);
  161.     TextDrawColor(Prev@FrameTD[5], 255);
  162.     TextDrawSetShadow(Prev@FrameTD[5], 0);
  163.     TextDrawSetOutline(Prev@FrameTD[5], 0);
  164.     TextDrawBackgroundColor(Prev@FrameTD[5], 255);
  165.     TextDrawSetProportional(Prev@FrameTD[5], 1);
  166.     TextDrawUseBox(Prev@FrameTD[5], 1);
  167.     TextDrawBoxColor(Prev@FrameTD[5], 150);
  168.     TextDrawTextSize(Prev@FrameTD[5], 7.5000, 7.5000);
  169.  
  170.     // button for scrolling down
  171.     Prev@FrameTD[6] = TextDrawCreate(488.0000, 275.5000, "LD_POOL:BALL");
  172.     TextDrawFont(Prev@FrameTD[6], 4);
  173.     TextDrawLetterSize(Prev@FrameTD[6], 0.0000, 18.2000);
  174.     TextDrawColor(Prev@FrameTD[6], -1);
  175.     TextDrawSetShadow(Prev@FrameTD[6], 0);
  176.     TextDrawSetOutline(Prev@FrameTD[6], 0);
  177.     TextDrawBackgroundColor(Prev@FrameTD[6], 255);
  178.     TextDrawSetProportional(Prev@FrameTD[6], 1);
  179.     TextDrawUseBox(Prev@FrameTD[6], 1);
  180.     TextDrawBoxColor(Prev@FrameTD[6], 150);
  181.     TextDrawTextSize(Prev@FrameTD[6], 9.5000, 9.5000);
  182.     TextDrawSetSelectable(Prev@FrameTD[6], 1);
  183.     //
  184.  
  185.     Prev@FrameTD[7] = TextDrawCreate(489.0000, 277.0000, "LD_BEAT:DOWN");
  186.     TextDrawFont(Prev@FrameTD[7], 4);
  187.     TextDrawLetterSize(Prev@FrameTD[7], 0.0000, 18.2000);
  188.     TextDrawColor(Prev@FrameTD[7], 255);
  189.     TextDrawSetShadow(Prev@FrameTD[7], 0);
  190.     TextDrawSetOutline(Prev@FrameTD[7], 0);
  191.     TextDrawBackgroundColor(Prev@FrameTD[7], 255);
  192.     TextDrawSetProportional(Prev@FrameTD[7], 1);
  193.     TextDrawUseBox(Prev@FrameTD[7], 1);
  194.     TextDrawBoxColor(Prev@FrameTD[7], 150);
  195.     TextDrawTextSize(Prev@FrameTD[7], 7.5000, 7.5000);
  196.  
  197.     /*
  198.     * LEFT BUTTON (button1)
  199.     */
  200.     // left button for response type "1"
  201.     Prev@LeftButtonTD[0] = TextDrawCreate(260.0000, 293.0000, "LD_SPAC:WHITE");
  202.     TextDrawFont(Prev@LeftButtonTD[0], 4);
  203.     TextDrawLetterSize(Prev@LeftButtonTD[0], 0.5000, 1.0000);
  204.     TextDrawColor(Prev@LeftButtonTD[0], -1);
  205.     TextDrawSetShadow(Prev@LeftButtonTD[0], 0);
  206.     TextDrawSetOutline(Prev@LeftButtonTD[0], 0);
  207.     TextDrawBackgroundColor(Prev@LeftButtonTD[0], 255);
  208.     TextDrawSetProportional(Prev@LeftButtonTD[0], 1);
  209.     TextDrawTextSize(Prev@LeftButtonTD[0], 55.0000, 18.0000);
  210.     TextDrawSetSelectable(Prev@LeftButtonTD[0], 1);
  211.     //
  212.  
  213.     Prev@LeftButtonTD[1] = TextDrawCreate(260.5000, 293.5000, "LD_SPAC:BLACK");
  214.     TextDrawFont(Prev@LeftButtonTD[1], 4);
  215.     TextDrawLetterSize(Prev@LeftButtonTD[1], 0.5000, 1.0000);
  216.     TextDrawColor(Prev@LeftButtonTD[1], -1);
  217.     TextDrawSetShadow(Prev@LeftButtonTD[1], 0);
  218.     TextDrawSetOutline(Prev@LeftButtonTD[1], 0);
  219.     TextDrawBackgroundColor(Prev@LeftButtonTD[1], 255);
  220.     TextDrawSetProportional(Prev@LeftButtonTD[1], 1);
  221.     TextDrawTextSize(Prev@LeftButtonTD[1], 54.0000, 17.0000);
  222.  
  223.     /*
  224.     * RIGHT BUTTON (button2)
  225.     */
  226.     // right button for response type "0"
  227.     Prev@RightButtonTD[0] = TextDrawCreate(325.0000, 293.0000, "LD_SPAC:WHITE");
  228.     TextDrawFont(Prev@RightButtonTD[0], 4);
  229.     TextDrawLetterSize(Prev@RightButtonTD[0], 0.5000, 1.0000);
  230.     TextDrawColor(Prev@RightButtonTD[0], -1);
  231.     TextDrawSetShadow(Prev@RightButtonTD[0], 0);
  232.     TextDrawSetOutline(Prev@RightButtonTD[0], 0);
  233.     TextDrawBackgroundColor(Prev@RightButtonTD[0], 255);
  234.     TextDrawSetProportional(Prev@RightButtonTD[0], 1);
  235.     TextDrawTextSize(Prev@RightButtonTD[0], 55.0000, 18.0000);
  236.     TextDrawSetSelectable(Prev@RightButtonTD[0], 1);
  237.     //
  238.  
  239.     Prev@RightButtonTD[1] = TextDrawCreate(325.5000, 293.5000, "LD_SPAC:BLACK");
  240.     TextDrawFont(Prev@RightButtonTD[1], 4);
  241.     TextDrawLetterSize(Prev@RightButtonTD[1], 0.5000, 1.0000);
  242.     TextDrawColor(Prev@RightButtonTD[1], -1);
  243.     TextDrawSetShadow(Prev@RightButtonTD[1], 0);
  244.     TextDrawSetOutline(Prev@RightButtonTD[1], 0);
  245.     TextDrawBackgroundColor(Prev@RightButtonTD[1], 255);
  246.     TextDrawSetProportional(Prev@RightButtonTD[1], 1);
  247.     TextDrawTextSize(Prev@RightButtonTD[1], 54.0000, 17.0000);
  248.  
  249.     /*
  250.     * CENTER BUTTON (button3)
  251.     */
  252.     // right button for response type "0"
  253.     Prev@CenterButtonTD[0] = TextDrawCreate(290.5000, 293.0000, "LD_SPAC:WHITE");
  254.     TextDrawFont(Prev@CenterButtonTD[0], 4);
  255.     TextDrawLetterSize(Prev@CenterButtonTD[0], 0.5000, 1.0000);
  256.     TextDrawColor(Prev@CenterButtonTD[0], -1);
  257.     TextDrawSetShadow(Prev@CenterButtonTD[0], 0);
  258.     TextDrawSetOutline(Prev@CenterButtonTD[0], 0);
  259.     TextDrawBackgroundColor(Prev@CenterButtonTD[0], 255);
  260.     TextDrawSetProportional(Prev@CenterButtonTD[0], 1);
  261.     TextDrawTextSize(Prev@CenterButtonTD[0], 55.0000, 18.0000);
  262.     TextDrawSetSelectable(Prev@CenterButtonTD[0], 1);
  263.     //
  264.  
  265.     Prev@CenterButtonTD[1] = TextDrawCreate(291.0000, 293.5000, "LD_SPAC:BLACK");
  266.     TextDrawFont(Prev@CenterButtonTD[1], 4);
  267.     TextDrawLetterSize(Prev@CenterButtonTD[1], 0.5000, 1.0000);
  268.     TextDrawColor(Prev@CenterButtonTD[1], -1);
  269.     TextDrawSetShadow(Prev@CenterButtonTD[1], 0);
  270.     TextDrawSetOutline(Prev@CenterButtonTD[1], 0);
  271.     TextDrawBackgroundColor(Prev@CenterButtonTD[1], 255);
  272.     TextDrawSetProportional(Prev@CenterButtonTD[1], 1);
  273.     TextDrawTextSize(Prev@CenterButtonTD[1], 54.0000, 17.0000);
  274.  
  275.     /*
  276.     * PREVIEW MODEL LISTITEMS
  277.     */
  278.     new textdrawid;
  279.  
  280.     for (new a = 0; a < MAX_DIALOG_PREVIEW_ROWS; a++) {
  281.         for (new b = 0; b < MAX_DIALOG_PREVIEW_COLUMNS; b++) {
  282.             textdrawid = ((a * MAX_DIALOG_PREVIEW_COLUMNS) + b);
  283.  
  284.             // listitem border button to select item
  285.             Prev@ModelTD[textdrawid][0] = TextDrawCreate((148.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (157.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_SPAC:WHITE");
  286.             TextDrawFont(Prev@ModelTD[textdrawid][0], 4);
  287.             TextDrawLetterSize(Prev@ModelTD[textdrawid][0], 0.5000, 1.0000);
  288.             TextDrawColor(Prev@ModelTD[textdrawid][0], -16776961);
  289.             TextDrawSetShadow(Prev@ModelTD[textdrawid][0], 0);
  290.             TextDrawSetOutline(Prev@ModelTD[textdrawid][0], 0);
  291.             TextDrawBackgroundColor(Prev@ModelTD[textdrawid][0], 255);
  292.             TextDrawSetProportional(Prev@ModelTD[textdrawid][0], 1);
  293.             TextDrawTextSize(Prev@ModelTD[textdrawid][0], 55.0000, 62.0000);
  294.             TextDrawSetSelectable(Prev@ModelTD[textdrawid][0], 1);
  295.             //
  296.  
  297.             Prev@ModelTD[textdrawid][1] = TextDrawCreate((149.0000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (158.0000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "MODEL");
  298.             TextDrawFont(Prev@ModelTD[textdrawid][1], 5);
  299.             TextDrawLetterSize(Prev@ModelTD[textdrawid][1], 0.5000, 1.0000);
  300.             TextDrawColor(Prev@ModelTD[textdrawid][1], -1);
  301.             TextDrawSetShadow(Prev@ModelTD[textdrawid][1], 0);
  302.             TextDrawSetOutline(Prev@ModelTD[textdrawid][1], 0);
  303.             TextDrawBackgroundColor(Prev@ModelTD[textdrawid][1], 842150655);
  304.             TextDrawSetProportional(Prev@ModelTD[textdrawid][1], 1);
  305.             TextDrawTextSize(Prev@ModelTD[textdrawid][1], 54.0000, 61.0000);
  306.             TextDrawSetPreviewModel(Prev@ModelTD[textdrawid][1], 132);
  307.             TextDrawSetPreviewRot(Prev@ModelTD[textdrawid][1], 0.0000, 0.0000, -50.0000, 1.0000);
  308.  
  309.             // listitem rotation button (left)
  310.             Prev@ModelTD[textdrawid][2] = TextDrawCreate((159.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (205.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:LEFT");
  311.             TextDrawFont(Prev@ModelTD[textdrawid][2], 4);
  312.             TextDrawLetterSize(Prev@ModelTD[textdrawid][2], 0.25000, 0.50000);
  313.             TextDrawColor(Prev@ModelTD[textdrawid][2], -156);
  314.             TextDrawSetShadow(Prev@ModelTD[textdrawid][2], 0);
  315.             TextDrawSetOutline(Prev@ModelTD[textdrawid][2], 0);
  316.             TextDrawBackgroundColor(Prev@ModelTD[textdrawid][2], 255);
  317.             TextDrawSetProportional(Prev@ModelTD[textdrawid][2], 1);
  318.             TextDrawTextSize(Prev@ModelTD[textdrawid][2], 7.50000, 7.50000);
  319.             TextDrawSetSelectable(Prev@ModelTD[textdrawid][2], 1);
  320.             //
  321.  
  322.             // listitem rotation button (right)
  323.             Prev@ModelTD[textdrawid][3] = TextDrawCreate((185.0000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (205.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:RIGHT");
  324.             TextDrawFont(Prev@ModelTD[textdrawid][3], 4);
  325.             TextDrawLetterSize(Prev@ModelTD[textdrawid][3], 0.25000, 0.50000);
  326.             TextDrawColor(Prev@ModelTD[textdrawid][3], -156);
  327.             TextDrawSetShadow(Prev@ModelTD[textdrawid][3], 0);
  328.             TextDrawSetOutline(Prev@ModelTD[textdrawid][3], 0);
  329.             TextDrawBackgroundColor(Prev@ModelTD[textdrawid][3], 255);
  330.             TextDrawSetProportional(Prev@ModelTD[textdrawid][3], 1);
  331.             TextDrawTextSize(Prev@ModelTD[textdrawid][3], 7.50000, 7.50000);
  332.             TextDrawSetSelectable(Prev@ModelTD[textdrawid][3], 1);
  333.             //
  334.            
  335.             // listitem zoom button (+)
  336.             Prev@ModelTD[textdrawid][4] = TextDrawCreate((188.0000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (180.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:UP");
  337.             TextDrawFont(Prev@ModelTD[textdrawid][4], 4);
  338.             TextDrawLetterSize(Prev@ModelTD[textdrawid][4], 0.25000, 0.50000);
  339.             TextDrawColor(Prev@ModelTD[textdrawid][4], -156);
  340.             TextDrawSetShadow(Prev@ModelTD[textdrawid][4], 0);
  341.             TextDrawSetOutline(Prev@ModelTD[textdrawid][4], 0);
  342.             TextDrawBackgroundColor(Prev@ModelTD[textdrawid][4], 255);
  343.             TextDrawSetProportional(Prev@ModelTD[textdrawid][4], 1);
  344.             TextDrawTextSize(Prev@ModelTD[textdrawid][4], 7.50000, 7.50000);
  345.             TextDrawSetSelectable(Prev@ModelTD[textdrawid][4], 1);
  346.            
  347.             // listitem zoom button (-)
  348.             Prev@ModelTD[textdrawid][5] = TextDrawCreate((188.0000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (190.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:DOWN");
  349.             TextDrawFont(Prev@ModelTD[textdrawid][5], 4);
  350.             TextDrawLetterSize(Prev@ModelTD[textdrawid][5], 0.25000, 0.50000);
  351.             TextDrawColor(Prev@ModelTD[textdrawid][5], -156);
  352.             TextDrawSetShadow(Prev@ModelTD[textdrawid][5], 0);
  353.             TextDrawSetOutline(Prev@ModelTD[textdrawid][5], 0);
  354.             TextDrawBackgroundColor(Prev@ModelTD[textdrawid][5], 255);
  355.             TextDrawSetProportional(Prev@ModelTD[textdrawid][5], 1);
  356.             TextDrawTextSize(Prev@ModelTD[textdrawid][5], 7.50000, 7.50000);
  357.             TextDrawSetSelectable(Prev@ModelTD[textdrawid][5], 1);
  358.         }
  359.     }
  360. }
  361.  
  362. static Prev_DestroyTextDraws() {
  363.     /*
  364.     * FRAME
  365.     */
  366.     for (new i = 0; i < sizeof Prev@FrameTD; i++) {
  367.         TextDrawDestroy(Prev@FrameTD[i]);
  368.     }
  369.  
  370.     /*
  371.     * LEFT BUTTON (button1)
  372.     */
  373.     TextDrawDestroy(Prev@LeftButtonTD[0]);
  374.     TextDrawDestroy(Prev@LeftButtonTD[1]);
  375.  
  376.     /*
  377.     * RIGHT BUTTON (button2)
  378.     */
  379.     TextDrawDestroy(Prev@RightButtonTD[0]);
  380.     TextDrawDestroy(Prev@RightButtonTD[1]);
  381.  
  382.     /*
  383.     * CENTER BUTTON (button1)
  384.     */
  385.     TextDrawDestroy(Prev@CenterButtonTD[0]);
  386.     TextDrawDestroy(Prev@CenterButtonTD[1]);
  387.  
  388.     /*
  389.     * PREVIEW MODEL LISTITEMS
  390.     */
  391.     for (new i = 0; i < (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS); i++) {
  392.         for(new x = 0; x < 6; x++)
  393.             TextDrawDestroy(Prev@ModelTD[i][x]);
  394.     }
  395. }
  396.  
  397. static Prev_CreatePlayerTextDraws(playerid, header[], button1[], button2[], button3[], totalItems) {
  398.     /*
  399.     * HEADER
  400.     */
  401.     Prev@HeaderPTD[playerid] = CreatePlayerTextDraw(playerid, 144.0000, 143.0000, header);
  402.     PlayerTextDrawFont(playerid, Prev@HeaderPTD[playerid], 2);
  403.     PlayerTextDrawLetterSize(playerid, Prev@HeaderPTD[playerid], 0.1399, 0.8999);
  404.     PlayerTextDrawColor(playerid, Prev@HeaderPTD[playerid], -1);
  405.     PlayerTextDrawSetShadow(playerid, Prev@HeaderPTD[playerid], 0);
  406.     PlayerTextDrawSetOutline(playerid, Prev@HeaderPTD[playerid], 0);
  407.     PlayerTextDrawBackgroundColor(playerid, Prev@HeaderPTD[playerid], 255);
  408.     PlayerTextDrawSetProportional(playerid, Prev@HeaderPTD[playerid], 1);
  409.     PlayerTextDrawUseBox(playerid, Prev@HeaderPTD[playerid], 1);
  410.     PlayerTextDrawBoxColor(playerid, Prev@HeaderPTD[playerid], 255);
  411.     PlayerTextDrawTextSize(playerid, Prev@HeaderPTD[playerid], 501.0000, 0.0000);
  412.  
  413.     /*
  414.     * LEFT BUTTON (button1)
  415.     */
  416.     if (button1[0] != EOS) {
  417.         Prev@LeftButtonPTD[playerid] = CreatePlayerTextDraw(playerid, 287.5000, 297.0000, button1);
  418.         PlayerTextDrawFont(playerid, Prev@LeftButtonPTD[playerid], 2);
  419.         PlayerTextDrawLetterSize(playerid, Prev@LeftButtonPTD[playerid], 0.1399, 0.8999);
  420.         PlayerTextDrawAlignment(playerid, Prev@LeftButtonPTD[playerid], 2);
  421.         PlayerTextDrawColor(playerid, Prev@LeftButtonPTD[playerid], -1);
  422.         PlayerTextDrawSetShadow(playerid, Prev@LeftButtonPTD[playerid], 0);
  423.         PlayerTextDrawSetOutline(playerid, Prev@LeftButtonPTD[playerid], 0);
  424.         PlayerTextDrawBackgroundColor(playerid, Prev@LeftButtonPTD[playerid], 255);
  425.         PlayerTextDrawSetProportional(playerid, Prev@LeftButtonPTD[playerid], 1);
  426.         PlayerTextDrawTextSize(playerid, Prev@LeftButtonPTD[playerid], 0.0000, 480.0000);
  427.     } else {
  428.         Prev@LeftButtonPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  429.     }
  430.  
  431.     /*
  432.     * RIGHT BUTTON (button2)
  433.     */
  434.     if (button2[0] != EOS) {
  435.         Prev@RightButtonPTD[playerid] = CreatePlayerTextDraw(playerid, 352.5000, 297.0000, button2);
  436.         PlayerTextDrawFont(playerid, Prev@RightButtonPTD[playerid], 2);
  437.         PlayerTextDrawLetterSize(playerid, Prev@RightButtonPTD[playerid], 0.1399, 0.8999);
  438.         PlayerTextDrawAlignment(playerid, Prev@RightButtonPTD[playerid], 2);
  439.         PlayerTextDrawColor(playerid, Prev@RightButtonPTD[playerid], -1);
  440.         PlayerTextDrawSetShadow(playerid, Prev@RightButtonPTD[playerid], 0);
  441.         PlayerTextDrawSetOutline(playerid, Prev@RightButtonPTD[playerid], 0);
  442.         PlayerTextDrawBackgroundColor(playerid, Prev@RightButtonPTD[playerid], 255);
  443.         PlayerTextDrawSetProportional(playerid, Prev@RightButtonPTD[playerid], 1);
  444.         PlayerTextDrawTextSize(playerid, Prev@RightButtonPTD[playerid], 0.0000, 480.0000);
  445.     } else {
  446.         Prev@RightButtonPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  447.     }
  448.  
  449.     /*
  450.     * CENTER BUTTON (button3)
  451.     */
  452.     if (button3[0] != EOS) {
  453.         Prev@CenterButtonPTD[playerid] = CreatePlayerTextDraw(playerid, 318.0000, 297.0000, button3);
  454.         PlayerTextDrawFont(playerid, Prev@CenterButtonPTD[playerid], 2);
  455.         PlayerTextDrawLetterSize(playerid, Prev@CenterButtonPTD[playerid], 0.1399, 0.8999);
  456.         PlayerTextDrawAlignment(playerid, Prev@CenterButtonPTD[playerid], 2);
  457.         PlayerTextDrawColor(playerid, Prev@CenterButtonPTD[playerid], -1);
  458.         PlayerTextDrawSetShadow(playerid, Prev@CenterButtonPTD[playerid], 0);
  459.         PlayerTextDrawSetOutline(playerid, Prev@CenterButtonPTD[playerid], 0);
  460.         PlayerTextDrawBackgroundColor(playerid, Prev@CenterButtonPTD[playerid], 255);
  461.         PlayerTextDrawSetProportional(playerid, Prev@CenterButtonPTD[playerid], 1);
  462.         PlayerTextDrawTextSize(playerid, Prev@CenterButtonPTD[playerid], 0.0000, 480.0000);
  463.     } else {
  464.         Prev@CenterButtonPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  465.     }
  466.  
  467.     /*
  468.     * PAGE NUMBER
  469.     */
  470.     if (totalItems > (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) { // if there are more than "12" listitems, create page textdraw
  471.         Prev@PageNumberPTD[playerid] = CreatePlayerTextDraw(playerid, 501.5000, 143.0000, "Page: 1");
  472.         PlayerTextDrawFont(playerid, Prev@PageNumberPTD[playerid], 2);
  473.         PlayerTextDrawLetterSize(playerid, Prev@PageNumberPTD[playerid], 0.1399, 0.8999);
  474.         PlayerTextDrawAlignment(playerid, Prev@PageNumberPTD[playerid], 3);
  475.         PlayerTextDrawColor(playerid, Prev@PageNumberPTD[playerid], -1);
  476.         PlayerTextDrawSetShadow(playerid, Prev@PageNumberPTD[playerid], 0);
  477.         PlayerTextDrawSetOutline(playerid, Prev@PageNumberPTD[playerid], 0);
  478.         PlayerTextDrawBackgroundColor(playerid, Prev@PageNumberPTD[playerid], 255);
  479.         PlayerTextDrawSetProportional(playerid, Prev@PageNumberPTD[playerid], 1);
  480.         PlayerTextDrawTextSize(playerid, Prev@PageNumberPTD[playerid], 501.0000, 0.0000);
  481.     } else {
  482.         Prev@PageNumberPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  483.     }
  484.  
  485.     /*
  486.     * PREVIEW MODEL LISTITEMS
  487.     */
  488.     new textdrawid;
  489.  
  490.     for (new a = 0; a < MAX_DIALOG_PREVIEW_ROWS; a++) {
  491.         for (new b = 0; b < MAX_DIALOG_PREVIEW_COLUMNS; b++) {
  492.             textdrawid = ((a * MAX_DIALOG_PREVIEW_COLUMNS) + b);
  493.  
  494.             if (textdrawid >= totalItems) {
  495.                 Prev@ModelTextPTD[playerid][textdrawid][0] = PlayerText:INVALID_TEXT_DRAW;
  496.                 Prev@ModelTextPTD[playerid][textdrawid][1] = PlayerText:INVALID_TEXT_DRAW;
  497.                 continue;
  498.             }
  499.  
  500.             Prev@ModelTextPTD[playerid][textdrawid][0] = CreatePlayerTextDraw(playerid, (153.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (161.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "");
  501.             PlayerTextDrawFont(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 2);
  502.             PlayerTextDrawLetterSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 0.1399, 0.8999);
  503.             PlayerTextDrawColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], -1);
  504.             PlayerTextDrawSetShadow(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 0);
  505.             PlayerTextDrawSetOutline(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 0);
  506.             PlayerTextDrawBackgroundColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 255);
  507.             PlayerTextDrawSetProportional(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 1);
  508.             PlayerTextDrawTextSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 640.0000, 480.0000);
  509.  
  510.             Prev@ModelTextPTD[playerid][textdrawid][1] = CreatePlayerTextDraw(playerid, (176.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (204.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "0.0");
  511.             PlayerTextDrawFont(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 2);
  512.             PlayerTextDrawLetterSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 0.1399, 0.8999);
  513.             PlayerTextDrawAlignment(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 2);
  514.             PlayerTextDrawColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], -156);
  515.             PlayerTextDrawSetShadow(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 0);
  516.             PlayerTextDrawSetOutline(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 0);
  517.             PlayerTextDrawBackgroundColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 255);
  518.             PlayerTextDrawSetProportional(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 1);
  519.             PlayerTextDrawTextSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 640.0000, 480.0000);
  520.         }
  521.     }
  522.  
  523.     /*
  524.     * SCROLLBAR
  525.     */
  526.     Prev@ScrollBarPTD[playerid] = PlayerText:INVALID_TEXT_DRAW; // we will create this later if needed in dialog
  527. }
  528.  
  529. static Prev_DestroyPlayerTextDraws(playerid) {
  530.     /*
  531.     * HEADER
  532.     */
  533.     PlayerTextDrawDestroy(playerid, Prev@HeaderPTD[playerid]);
  534.  
  535.     /*
  536.     * LEFT BUTTON (button1)
  537.     */
  538.     PlayerTextDrawDestroy(playerid, Prev@LeftButtonPTD[playerid]);
  539.  
  540.     /*
  541.     * RIGHT BUTTON (button2)
  542.     */
  543.     PlayerTextDrawDestroy(playerid, Prev@RightButtonPTD[playerid]);
  544.  
  545.     /*
  546.     * CENTER BUTTON (button3)
  547.     */
  548.     PlayerTextDrawDestroy(playerid, Prev@CenterButtonPTD[playerid]);
  549.  
  550.     /*
  551.     * PAGE NUMBER
  552.     */
  553.     PlayerTextDrawDestroy(playerid, Prev@PageNumberPTD[playerid]);
  554.  
  555.     /*
  556.     * SCROLLBAR
  557.     */
  558.     PlayerTextDrawDestroy(playerid, Prev@ScrollBarPTD[playerid]);
  559.  
  560.     /*
  561.     * PREVIEW MODEL LISTITEMS
  562.     */
  563.     for (new i = 0; i < (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS); i++) {
  564.         PlayerTextDrawDestroy(playerid, Prev@ModelTextPTD[playerid][i][0]);
  565.         PlayerTextDrawDestroy(playerid, Prev@ModelTextPTD[playerid][i][1]);
  566.     }
  567. }
  568.  
  569. static Prev_UpdateScrollBar(playerid, page, totalPages) {
  570.     PlayerTextDrawDestroy(playerid, Prev@ScrollBarPTD[playerid]);
  571.  
  572.     const Float:MAX_HEIGHT = 108.0000;
  573.     new Float:height = (MAX_HEIGHT / totalPages);
  574.     new Float:y = 166.5000;
  575.     y += (height * page);
  576.  
  577.     Prev@ScrollBarPTD[playerid] = CreatePlayerTextDraw(playerid, 489.0000, y, "LD_SPAC:WHITE");
  578.     PlayerTextDrawFont(playerid, Prev@ScrollBarPTD[playerid], 4);
  579.     PlayerTextDrawLetterSize(playerid, Prev@ScrollBarPTD[playerid], 0.0000, 18.2000);
  580.     PlayerTextDrawColor(playerid, Prev@ScrollBarPTD[playerid], -16776961);
  581.     PlayerTextDrawSetShadow(playerid, Prev@ScrollBarPTD[playerid], 0);
  582.     PlayerTextDrawSetOutline(playerid, Prev@ScrollBarPTD[playerid], 0);
  583.     PlayerTextDrawBackgroundColor(playerid, Prev@ScrollBarPTD[playerid], 255);
  584.     PlayerTextDrawSetProportional(playerid, Prev@ScrollBarPTD[playerid], 1);
  585.     PlayerTextDrawUseBox(playerid, Prev@ScrollBarPTD[playerid], 1);
  586.     PlayerTextDrawBoxColor(playerid, Prev@ScrollBarPTD[playerid], 150);
  587.     PlayerTextDrawTextSize(playerid, Prev@ScrollBarPTD[playerid], 7.5000, height);
  588.  
  589.     PlayerTextDrawShow(playerid, Prev@ScrollBarPTD[playerid]);
  590. }
  591.  
  592. static Prev_UpdateListitems(playerid, page, selected, totalItems) {
  593.     new textdrawid;
  594.     new listitem;
  595.  
  596.     new name[MAX_DIALOG_PREVIEW_TEXTSIZE];
  597.  
  598.     for (new a = 0; a < MAX_DIALOG_PREVIEW_ROWS; a++) {
  599.         for (new b = 0; b < MAX_DIALOG_PREVIEW_COLUMNS; b++) {
  600.             textdrawid = ((a * MAX_DIALOG_PREVIEW_COLUMNS) + b);
  601.             listitem = ((page * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + textdrawid);
  602.  
  603.             if (listitem >= totalItems) {
  604.                 for(new x=0; x < 6; x++)
  605.                     TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][x]);
  606.  
  607.                 PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][0]);
  608.                 PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][1]);
  609.                 continue;
  610.             }
  611.  
  612.             TextDrawSetPreviewModel(Prev@ModelTD[textdrawid][1], MEM_get_val(Prev@PlayerModelsPointer[playerid], listitem));
  613.             TextDrawSetPreviewRot(Prev@ModelTD[textdrawid][1], Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][0], listitem), Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][1], listitem), Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][2], listitem), Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][3], listitem));
  614.             TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][1]);
  615.  
  616.             if (textdrawid == selected) {
  617.                 TextDrawColor(Prev@ModelTD[textdrawid][0], DIALOG_PREVIEW_SELECT_COLOR);
  618.                 TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][0]);
  619.  
  620.                 TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][2]);
  621.                 TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][3]);
  622.                
  623.                 TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][4]);
  624.                 TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][5]);
  625.  
  626.                 new string[16];
  627.                 format(string, sizeof string, "%0.1f", Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][3], listitem));
  628.                 PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], string);
  629.                 PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][textdrawid][1]);
  630.             } else {
  631.                 TextDrawColor(Prev@ModelTD[textdrawid][0], DIALOG_PREVIEW_UNSELECT_COLOR);
  632.                 TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][0]);
  633.  
  634.                 TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][2]);
  635.                 TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][3]);
  636.                
  637.                 TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][4]);
  638.                 TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][5]);
  639.  
  640.  
  641.                 PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][1]);
  642.             }
  643.  
  644.             if (MEM_get_arr(Prev@PlayerModelNamesPointer[playerid][listitem], 0, name, MEM_get_size(Prev@PlayerModelNamesPointer[playerid][listitem])) != MEM_NULLFEPTR) {
  645.                 PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], name);
  646.                 PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][textdrawid][0]);
  647.             } else {
  648.                 PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][0]);
  649.             }
  650.         }
  651.     }
  652.  
  653.     new string[16];
  654.     format(string, sizeof string, "PAGE: %i/%i", (page + 1), Prev_GetNumPages(playerid));
  655.     PlayerTextDrawSetString(playerid, Prev@PageNumberPTD[playerid], string);
  656. }
  657.  
  658. static Prev_HidePlayerDialog(playerid) {
  659.     /*
  660.     * FRAME
  661.     */
  662.     for (new i = 0; i < sizeof Prev@FrameTD; i++) {
  663.         TextDrawHideForPlayer(playerid, Prev@FrameTD[i]);
  664.     }
  665.  
  666.     /*
  667.     * LEFT BUTTON
  668.     */
  669.     TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[0]);
  670.     TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[1]);
  671.  
  672.     /*
  673.     * RIGHT BUTTON
  674.     */
  675.     TextDrawHideForPlayer(playerid, Prev@RightButtonTD[0]);
  676.     TextDrawHideForPlayer(playerid, Prev@RightButtonTD[1]);
  677.  
  678.     /*
  679.     * CENTER BUTTON
  680.     */
  681.     TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[0]);
  682.     TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[1]);
  683.  
  684.     /*
  685.     * PREVIEW MODEL LISTITEMS
  686.     */
  687.     for (new i = 0; i < (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS); i++) {
  688.         for(new x = 0; x < 6;  x++)
  689.             TextDrawHideForPlayer(playerid, Prev@ModelTD[i][x]);
  690.     }
  691.  
  692.     /*
  693.     * DESTROY DIALOG PLAYER TEXTDRAWS
  694.     */
  695.     Prev_DestroyPlayerTextDraws(playerid);
  696.  
  697.     // reset player data
  698.     MEM_delete(Prev@PlayerModelsPointer[playerid]);
  699.     Prev@PlayerModelsPointer[playerid] = MEM_NULLPTR;
  700.  
  701.     for (new i = 0; i < Prev@PlayerDialogNumListitems[playerid]; i++) {
  702.         MEM_delete(Prev@PlayerModelNamesPointer[playerid][i]);
  703.         Prev@PlayerModelNamesPointer[playerid][i] = MEM_NULLPTR;
  704.     }
  705.  
  706.     Prev@PlayerDialogID[playerid] = -1;
  707.  
  708.     return Prev_CancelSelectTextDraw(playerid);
  709. }
  710.  
  711. // hooked methods
  712. public OnGameModeInit() {
  713.     Prev_CreateTextDraws();
  714.  
  715.     #if defined PDialog_OnGameModeInit
  716.         return PDialog_OnGameModeInit();
  717.     #else
  718.         return 1;
  719.     #endif
  720. }
  721. #if defined _ALS_OnGameModeInit
  722.     #undef OnGameModeInit
  723. #else
  724.     #define _ALS_OnGameModeInit
  725. #endif
  726. #define OnGameModeInit PDialog_OnGameModeInit
  727. #if defined PDialog_OnGameModeInit
  728.     forward PDialog_OnGameModeInit();
  729. #endif
  730.  
  731. public OnGameModeExit() {
  732.     Prev_DestroyTextDraws();
  733.  
  734.     #if defined PDialog_OnGameModeExit
  735.         return PDialog_OnGameModeExit();
  736.     #else
  737.         return 1;
  738.     #endif
  739. }
  740. #if defined _ALS_OnGameModeExit
  741.     #undef OnGameModeExit
  742. #else
  743.     #define _ALS_OnGameModeExit
  744. #endif
  745. #define OnGameModeExit PDialog_OnGameModeExit
  746. #if defined PDialog_OnGameModeExit
  747.     forward PDialog_OnGameModeExit();
  748. #endif
  749.  
  750. public OnFilterScriptInit() {
  751.     Prev_CreateTextDraws();
  752.  
  753.     #if defined PDialog_OnFilterScriptInit
  754.         return PDialog_OnFilterScriptInit();
  755.     #else
  756.         return 1;
  757.     #endif
  758. }
  759. #if defined _ALS_OnFilterScriptInit
  760.     #undef OnFilterScriptInit
  761. #else
  762.     #define _ALS_OnFilterScriptInit
  763. #endif
  764. #define OnFilterScriptInit PDialog_OnFilterScriptInit
  765. #if defined PDialog_OnFilterScriptInit
  766.     forward PDialog_OnFilterScriptInit();
  767. #endif
  768.  
  769. public OnFilterScriptExit() {
  770.     Prev_DestroyTextDraws();
  771.  
  772.     #if defined PDialog_OnFilterScriptExit
  773.         return PDialog_OnFilterScriptExit();
  774.     #else
  775.         return 1;
  776.     #endif
  777. }
  778. #if defined _ALS_OnFilterScriptExit
  779.     #undef OnFilterScriptExit
  780. #else
  781.     #define _ALS_OnFilterScriptExit
  782. #endif
  783. #define OnFilterScriptExit PDialog_OnFilterScriptExit
  784. #if defined PDialog_OnFilterScriptExit
  785.     forward PDialog_OnFilterScriptExit();
  786. #endif
  787.  
  788. public OnPlayerConnect(playerid) {
  789.     Prev@CancelSelection[playerid] = false;
  790.  
  791.     Prev@PlayerDialogID[playerid] = -1;
  792.  
  793.     static const Float:__ROTATIONS[MAX_DIALOG_PREVIEW_MODELS] = {0.0, ...};
  794.     Prev@PlayerModelRotsPointer[playerid][0] = MEM_new_arr(_:__ROTATIONS, MAX_DIALOG_PREVIEW_MODELS);
  795.     Prev@PlayerModelRotsPointer[playerid][1] = MEM_new_arr(_:__ROTATIONS, MAX_DIALOG_PREVIEW_MODELS);
  796.     Prev@PlayerModelRotsPointer[playerid][2] = MEM_new_arr(_:__ROTATIONS, MAX_DIALOG_PREVIEW_MODELS);
  797.  
  798.     static const Float:__ZOOM[MAX_DIALOG_PREVIEW_MODELS] = {1.0, ...};
  799.     Prev@PlayerModelRotsPointer[playerid][3] = MEM_new_arr(_:__ZOOM, MAX_DIALOG_PREVIEW_MODELS);
  800.  
  801.     #if defined PDialog_OnPlayerConnect
  802.         return PDialog_OnPlayerConnect(playerid);
  803.     #else
  804.         return 1;
  805.     #endif
  806. }
  807. #if defined _ALS_OnPlayerConnect
  808.     #undef OnPlayerConnect
  809. #else
  810.     #define _ALS_OnPlayerConnect
  811. #endif
  812. #define OnPlayerConnect PDialog_OnPlayerConnect
  813. #if defined PDialog_OnPlayerConnect
  814.     forward PDialog_OnPlayerConnect(playerid);
  815. #endif
  816.  
  817. public OnPlayerDisconnect(playerid, reason) {
  818.     MEM_delete(Prev@PlayerModelsPointer[playerid]);
  819.     Prev@PlayerModelsPointer[playerid] = MEM_NULLPTR;
  820.  
  821.     MEM_delete(Prev@PlayerModelRotsPointer[playerid][0]);
  822.     MEM_delete(Prev@PlayerModelRotsPointer[playerid][1]);
  823.     MEM_delete(Prev@PlayerModelRotsPointer[playerid][2]);
  824.     MEM_delete(Prev@PlayerModelRotsPointer[playerid][3]);
  825.     Prev@PlayerModelRotsPointer[playerid][0] = MEM_NULLPTR;
  826.     Prev@PlayerModelRotsPointer[playerid][1] = MEM_NULLPTR;
  827.     Prev@PlayerModelRotsPointer[playerid][2] = MEM_NULLPTR;
  828.     Prev@PlayerModelRotsPointer[playerid][3] = MEM_NULLPTR;
  829.  
  830.     for (new i = 0; i < Prev@PlayerDialogNumListitems[playerid]; i++) {
  831.         MEM_delete(Prev@PlayerModelNamesPointer[playerid][i]);
  832.         Prev@PlayerModelNamesPointer[playerid][i] = MEM_NULLPTR;
  833.     }
  834.  
  835.     #if defined PDialog_OnPlayerDisconnect
  836.         return PDialog_OnPlayerDisconnect(playerid, reason);
  837.     #else
  838.         return 1;
  839.     #endif
  840. }
  841. #if defined _ALS_OnPlayerDisconnect
  842.     #undef OnPlayerDisconnect
  843. #else
  844.     #define _ALS_OnPlayerDisconnect
  845. #endif
  846. #define OnPlayerDisconnect PDialog_OnPlayerDisconnect
  847. #if defined PDialog_OnPlayerDisconnect
  848.     forward PDialog_OnPlayerDisconnect(playerid, reason);
  849. #endif
  850.  
  851. public OnPlayerClickTextDraw(playerid, Text:clickedid) {
  852.     if (Prev@CancelSelection[playerid]) {
  853.         Prev@CancelSelection[playerid] = false;
  854.  
  855.         #if defined PDialog_OnPlayerClickTextDraw
  856.             return PDialog_OnPlayerClickTextDraw(playerid, Text:clickedid);
  857.         #else
  858.             return 1;
  859.         #endif
  860.     }
  861.  
  862.     if (Prev@PlayerDialogID[playerid] != -1) {
  863.         if (clickedid == Text:INVALID_TEXT_DRAW || clickedid == RIGHT_BUTTON_TEXTDRAW) {
  864.             new dialogid = Prev@PlayerDialogID[playerid];
  865.             new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
  866.             new inputtext[16];
  867.             valstr(inputtext, MEM_get_val(Prev@PlayerModelsPointer[playerid], listitem));
  868.  
  869.             Prev_HidePlayerDialog(playerid);
  870.  
  871.             CallLocalFunction("OnDialogResponse", "iiiis", playerid, dialogid, 0, listitem, inputtext);
  872.  
  873.         } else if (clickedid == SCROLL_BAR_UP_TEXTDRAW) {
  874.             if (Prev@PlayerDialogPage[playerid] > 0) {
  875.                 Prev_UpdateListitems(playerid, --Prev@PlayerDialogPage[playerid], 0, Prev@PlayerDialogNumListitems[playerid]);
  876.                 Prev_UpdateScrollBar(playerid, Prev@PlayerDialogPage[playerid], Prev_GetNumPages(playerid));
  877.  
  878.                 Prev@PlayerDialogListitem[playerid] = 0;
  879.             }
  880.  
  881.         } else if (clickedid == SCROLL_BAR_DOWN_TEXTDRAW) {
  882.             if ((Prev@PlayerDialogPage[playerid] + 1) < Prev_GetNumPages(playerid)) {
  883.                 Prev_UpdateListitems(playerid, ++Prev@PlayerDialogPage[playerid], 0, Prev@PlayerDialogNumListitems[playerid]);
  884.                 Prev_UpdateScrollBar(playerid, Prev@PlayerDialogPage[playerid], Prev_GetNumPages(playerid));
  885.  
  886.                 Prev@PlayerDialogListitem[playerid] = 0;
  887.             }
  888.  
  889.         } else if (clickedid == LEFT_BUTTON_TEXTDRAW || clickedid == CENTER_BUTTON_TEXTDRAW) {
  890.             new dialogid = Prev@PlayerDialogID[playerid];
  891.             new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
  892.             new inputtext[16];
  893.             valstr(inputtext, MEM_get_val(Prev@PlayerModelsPointer[playerid], listitem));
  894.  
  895.             Prev_HidePlayerDialog(playerid);
  896.  
  897.             CallLocalFunction("OnDialogResponse", "iiiis", playerid, dialogid, 1, listitem, inputtext);
  898.  
  899.         } else if (clickedid == LISTITEM_ROTATE_LEFT_TEXTDRAW<Prev@PlayerDialogListitem[playerid]>) {
  900.             new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
  901.  
  902.             new Float:rx, Float:ry, Float:rz, Float:rzoom;
  903.             rx = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][0], listitem);
  904.             ry = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][1], listitem);
  905.             rz = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][2], listitem);
  906.             rzoom = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][3], listitem);
  907.  
  908.             rz -= 10.0;
  909.             MEM_set_val(Prev@PlayerModelRotsPointer[playerid][2], listitem, _:rz);
  910.  
  911.             TextDrawSetPreviewRot(Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1], rx, ry, rz, rzoom);
  912.             TextDrawShowForPlayer(playerid, Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1]);
  913.  
  914.             new string[16];
  915.             format(string, sizeof string, "%0.1f", rz);
  916.             PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][Prev@PlayerDialogListitem[playerid]][1], string);
  917.             PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][Prev@PlayerDialogListitem[playerid]][1]);
  918.  
  919.         } else if (clickedid == LISTITEM_ROTATE_RIGHT_TEXTDRAW<Prev@PlayerDialogListitem[playerid]>) {
  920.             new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
  921.  
  922.             new Float:rx, Float:ry, Float:rz, Float:rzoom;
  923.             rx = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][0], listitem);
  924.             ry = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][1], listitem);
  925.             rz = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][2], listitem);
  926.             rzoom = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][3], listitem);
  927.  
  928.             rz += 10.0;
  929.             MEM_set_val(Prev@PlayerModelRotsPointer[playerid][2], listitem, _:rz);
  930.  
  931.             TextDrawSetPreviewRot(Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1], rx, ry, rz, rzoom);
  932.             TextDrawShowForPlayer(playerid, Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1]);
  933.  
  934.             new string[16];
  935.             format(string, sizeof string, "%0.1f", rz);
  936.             PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][Prev@PlayerDialogListitem[playerid]][1], string);
  937.             PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][Prev@PlayerDialogListitem[playerid]][1]);
  938.  
  939.         }
  940.         else if (clickedid == LISTITEM_ZOOM_DOWN_TEXTDRAW<Prev@PlayerDialogListitem[playerid]>) {
  941.             new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
  942.  
  943.             new Float:rx, Float:ry, Float:rz, Float:rzoom;
  944.             rx = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][0], listitem);
  945.             ry = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][1], listitem);
  946.             rz = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][2], listitem);
  947.             rzoom = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][3], listitem);
  948.  
  949.             rzoom -= 0.1;
  950.             MEM_set_val(Prev@PlayerModelRotsPointer[playerid][3], listitem, _:rzoom);
  951.  
  952.             TextDrawSetPreviewRot(Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1], rx, ry, rz, rzoom);
  953.             TextDrawShowForPlayer(playerid, Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1]);
  954.  
  955.         } else if (clickedid == LISTITEM_ZOOM_UP_TEXTDRAW<Prev@PlayerDialogListitem[playerid]>) {
  956.             new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
  957.  
  958.             new Float:rx, Float:ry, Float:rz, Float:rzoom;
  959.             rx = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][0], listitem);
  960.             ry = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][1], listitem);
  961.             rz = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][2], listitem);
  962.             rzoom = Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][3], listitem);
  963.  
  964.             rzoom += 0.1;
  965.             MEM_set_val(Prev@PlayerModelRotsPointer[playerid][3], listitem, _:rzoom);
  966.  
  967.             TextDrawSetPreviewRot(Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1], rx, ry, rz, rzoom);
  968.             TextDrawShowForPlayer(playerid, Prev@ModelTD[Prev@PlayerDialogListitem[playerid]][1]);          
  969.  
  970.         } else {
  971.             for (new i = 0; i < (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS); i++) {
  972.                 if (clickedid == LISTITEM_TEXTDRAW<i>) {
  973.  
  974.                     if (Prev@PlayerDialogListitem[playerid] == i && (GetTickCount() - Prev@PlayerDialogTickCount[playerid]) <= 200) {
  975.                         new dialogid = Prev@PlayerDialogID[playerid];
  976.                         new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
  977.                         new inputtext[16];
  978.                         valstr(inputtext, MEM_get_val(Prev@PlayerModelsPointer[playerid], listitem));
  979.  
  980.                         Prev_HidePlayerDialog(playerid);
  981.  
  982.                         CallLocalFunction("OnDialogResponse", "iiiis", playerid, dialogid, 1, listitem, inputtext);
  983.  
  984.                     } else {
  985.                         // reset previous listitem
  986.                         new previous = Prev@PlayerDialogListitem[playerid];
  987.  
  988.                         TextDrawColor(Prev@ModelTD[previous][0], DIALOG_PREVIEW_UNSELECT_COLOR);
  989.                         TextDrawShowForPlayer(playerid, Prev@ModelTD[previous][0]);
  990.  
  991.                         TextDrawHideForPlayer(playerid, Prev@ModelTD[previous][2]);
  992.                         TextDrawHideForPlayer(playerid, Prev@ModelTD[previous][3]);
  993.                        
  994.                         TextDrawHideForPlayer(playerid, Prev@ModelTD[previous][4]);
  995.                         TextDrawHideForPlayer(playerid, Prev@ModelTD[previous][5]);
  996.  
  997.                         PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][previous][1]);
  998.  
  999.                         // update new selected listitem
  1000.                         TextDrawColor(Prev@ModelTD[i][0], DIALOG_PREVIEW_SELECT_COLOR);
  1001.                         TextDrawShowForPlayer(playerid, Prev@ModelTD[i][0]);
  1002.  
  1003.                         TextDrawShowForPlayer(playerid, Prev@ModelTD[i][2]);
  1004.                         TextDrawShowForPlayer(playerid, Prev@ModelTD[i][3]);
  1005.                        
  1006.                         TextDrawShowForPlayer(playerid, Prev@ModelTD[i][4]);
  1007.                         TextDrawShowForPlayer(playerid, Prev@ModelTD[i][5]);
  1008.  
  1009.                         new string[16];
  1010.                         format(string, sizeof string, "%0.1f", Float:MEM_get_val(Prev@PlayerModelRotsPointer[playerid][2], ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + i)));
  1011.                         PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][i][1], string);
  1012.                         PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][i][1]);
  1013.  
  1014.                         Prev@PlayerDialogListitem[playerid] = i;
  1015.                         Prev@PlayerDialogTickCount[playerid] = GetTickCount();
  1016.                     }
  1017.  
  1018.                     break;
  1019.                 }
  1020.             }
  1021.         }
  1022.     }
  1023.  
  1024.     #if defined PDialog_OnPlayerClickTextDraw
  1025.         return PDialog_OnPlayerClickTextDraw(playerid, Text:clickedid);
  1026.     #else
  1027.         return 1;
  1028.     #endif
  1029. }
  1030. #if defined _ALS_OnPlayerClickTextDraw
  1031.     #undef OnPlayerClickTextDraw
  1032. #else
  1033.     #define _ALS_OnPlayerClickTextDraw
  1034. #endif
  1035. #define OnPlayerClickTextDraw PDialog_OnPlayerClickTextDraw
  1036. #if defined PDialog_OnPlayerClickTextDraw
  1037.     forward PDialog_OnPlayerClickTextDraw(playerid, Text:clickedid);
  1038. #endif
  1039.  
  1040. stock Prev_ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]) {
  1041.     if (playerid < 0 || playerid >= MAX_PLAYERS) {
  1042.         return 0;
  1043.     }
  1044.  
  1045.     if (Prev@PlayerDialogID[playerid] != -1) {
  1046.         Prev_HidePlayerDialog(playerid);
  1047.     }
  1048.  
  1049.     if (style != DIALOG_STYLE_PREVIEW_MODEL) {
  1050.         return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
  1051.     }
  1052.  
  1053.     if (dialogid < 0) {
  1054.         if (style == DIALOG_STYLE_PREVIEW_MODEL) {
  1055.             return 1;
  1056.         }
  1057.  
  1058.         return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
  1059.     }
  1060.  
  1061.     new modelstr[8];
  1062.     new listitem[sizeof(modelstr) + 2 + MAX_DIALOG_PREVIEW_TEXTSIZE];
  1063.     new pos = 0;
  1064.     new next;
  1065.     new end;
  1066.     new count = 0;
  1067.     new bool:valid;
  1068.     new models[MAX_DIALOG_PREVIEW_MODELS];
  1069.  
  1070.     do {
  1071.         // split "info" to indvidual listitems
  1072.         next = strfind(info, "\n", false, pos);
  1073.         end = (next == -1) ? strlen(info) : next;
  1074.  
  1075.         strmid(listitem, info, pos, end, sizeof(listitem));
  1076.  
  1077.         pos = (next == -1) ? -1 : (next + 1);
  1078.  
  1079.         // split "listitem" from '\t' delim
  1080.         next = strfind(listitem, "\t");
  1081.         if (next == -1) {
  1082.             modelstr[0] = EOS;
  1083.             strcat(modelstr, listitem);
  1084.         }
  1085.         else {
  1086.             strmid(modelstr, listitem, 0, pos);
  1087.         }
  1088.  
  1089.         // model validity check
  1090.         valid = false;
  1091.         for (new i = 0; modelstr[i] != EOS; i++) {
  1092.             if (modelstr[i] >= '0' && modelstr[i] <= '9') {
  1093.                 valid = true;
  1094.                 break;
  1095.             }
  1096.         }
  1097.  
  1098.         if (!valid)
  1099.             continue;
  1100.  
  1101.         models[count] = strval(modelstr);
  1102.  
  1103.         // listitem text validity check
  1104.         valid = false;
  1105.         for (new i = next + 1; listitem[i] != EOS; i++) {
  1106.             if (listitem[i] != ' ') {
  1107.                 valid = true;
  1108.                 break;
  1109.             }
  1110.         }
  1111.  
  1112.         Prev@PlayerModelNamesPointer[playerid][count] = valid ? MEM_new_arr(listitem[next + 1], strlen(listitem[next + 1])) : MEM_NULLPTR;
  1113.  
  1114.         // check if number of models doesnt exceed the array size
  1115.         if (++count == MAX_DIALOG_PREVIEW_MODELS) {
  1116.             printf("[PreviewModelDialog.inc] - Warning: You have more than \"MAX_DIALOG_PREVIEW_MODELS\" ("#MAX_DIALOG_PREVIEW_MODELS") listitems in your dialog, only the first "#MAX_DIALOG_PREVIEW_MODELS" listitems were loaded.");
  1117.             break;
  1118.         }
  1119.  
  1120.     } while (pos != -1);
  1121.  
  1122.     if (count == 0) {
  1123.         return 0;
  1124.     }
  1125.  
  1126.     // set player data
  1127.     Prev@PlayerDialogID[playerid] = dialogid;
  1128.     Prev@PlayerDialogListitem[playerid] = 0;
  1129.     Prev@PlayerDialogNumListitems[playerid] = count;
  1130.     Prev@PlayerDialogPage[playerid] = 0;
  1131.     Prev@PlayerDialogTickCount[playerid] = 0;
  1132.  
  1133.     Prev@PlayerModelsPointer[playerid] = MEM_new_arr(models, Prev@PlayerDialogNumListitems[playerid]);
  1134.  
  1135.     /*
  1136.     * FRAME
  1137.     */
  1138.     for (new i = 0; i < sizeof Prev@FrameTD; i++) {
  1139.         TextDrawShowForPlayer(playerid, Prev@FrameTD[i]);
  1140.     }
  1141.  
  1142.     /*
  1143.     * BUTTONS AND PLAYER DIALOG TEXTDRAWS
  1144.     */
  1145.     if (button2[0] == EOS) { // only one center button
  1146.         TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[0]);
  1147.         TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[1]);
  1148.  
  1149.         TextDrawHideForPlayer(playerid, Prev@RightButtonTD[0]);
  1150.         TextDrawHideForPlayer(playerid, Prev@RightButtonTD[1]);
  1151.  
  1152.         TextDrawShowForPlayer(playerid, Prev@CenterButtonTD[0]);
  1153.         TextDrawShowForPlayer(playerid, Prev@CenterButtonTD[1]);
  1154.  
  1155.         Prev_CreatePlayerTextDraws(playerid, caption, "", "", button1, Prev@PlayerDialogNumListitems[playerid]);
  1156.         PlayerTextDrawShow(playerid, Prev@CenterButtonPTD[playerid]);
  1157.     } else { // dual buttons
  1158.         TextDrawShowForPlayer(playerid, Prev@LeftButtonTD[0]);
  1159.         TextDrawShowForPlayer(playerid, Prev@LeftButtonTD[1]);
  1160.  
  1161.         TextDrawShowForPlayer(playerid, Prev@RightButtonTD[0]);
  1162.         TextDrawShowForPlayer(playerid, Prev@RightButtonTD[1]);
  1163.  
  1164.         TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[0]);
  1165.         TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[1]);
  1166.  
  1167.         Prev_CreatePlayerTextDraws(playerid, caption, button1, button2, "", Prev@PlayerDialogNumListitems[playerid]);
  1168.         PlayerTextDrawShow(playerid, Prev@LeftButtonPTD[playerid]);
  1169.         PlayerTextDrawShow(playerid, Prev@RightButtonPTD[playerid]);
  1170.     }
  1171.  
  1172.     /*
  1173.     * HEADER
  1174.     */
  1175.     PlayerTextDrawShow(playerid, Prev@HeaderPTD[playerid]);
  1176.  
  1177.     /*
  1178.     * PAGE NUMBER
  1179.     */
  1180.     PlayerTextDrawShow(playerid, Prev@PageNumberPTD[playerid]);
  1181.  
  1182.     /*
  1183.     * SCROLLBAR
  1184.     */
  1185.     Prev@ScrollBarPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  1186.     if (Prev@PlayerDialogNumListitems[playerid] > (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) {
  1187.         Prev_UpdateScrollBar(playerid, 0, Prev_GetNumPages(playerid));
  1188.     }
  1189.  
  1190.     /*
  1191.     * PREVIEW MODEL LISTITEMS
  1192.     */
  1193.     Prev_UpdateListitems(playerid, 0, 0, Prev@PlayerDialogNumListitems[playerid]);
  1194.  
  1195.     return SelectTextDraw(playerid, DIALOG_PREVIEW_SELECT_COLOR);
  1196. }
  1197. #if defined _ALS_ShowPlayerDialog
  1198.     #undef ShowPlayerDialog
  1199. #else
  1200.     #define _ALS_ShowPlayerDialog
  1201. #endif
  1202. #define ShowPlayerDialog Prev_ShowPlayerDialog
  1203.  
  1204. stock ShowPreviewModelDialog(playerid, dialogid, caption[], models[], labels[][], button1[], button2[], size = sizeof models) {
  1205.     if (playerid < 0 || playerid >= MAX_PLAYERS) {
  1206.         return 0;
  1207.     }
  1208.  
  1209.     if (Prev@PlayerDialogID[playerid] != -1) {
  1210.         Prev_HidePlayerDialog(playerid);
  1211.     }
  1212.  
  1213.     if (dialogid < 0 || size <= 0) {
  1214.         return 0;
  1215.     }
  1216.  
  1217.     if (size >= MAX_DIALOG_PREVIEW_MODELS) {
  1218.         size = MAX_DIALOG_PREVIEW_MODELS;
  1219.         printf("[PreviewModelDialog.inc] - Warning: You have more than \"MAX_DIALOG_PREVIEW_MODELS\" ("#MAX_DIALOG_PREVIEW_MODELS") listitems in your dialog, only the first "#MAX_DIALOG_PREVIEW_MODELS" listitems were loaded.");
  1220.     }
  1221.  
  1222.     Prev@PlayerModelsPointer[playerid] = MEM_new_arr(models, size);
  1223.  
  1224.     for (new i = 0; i < size; i++) {
  1225.         Prev@PlayerModelNamesPointer[playerid][i] = MEM_new_arr(labels[i], strlen(labels[i]));
  1226.     }
  1227.  
  1228.     /*
  1229.     * FRAME
  1230.     */
  1231.     for (new i = 0; i < sizeof Prev@FrameTD; i++) {
  1232.         TextDrawShowForPlayer(playerid, Prev@FrameTD[i]);
  1233.     }
  1234.  
  1235.     // set player data
  1236.     Prev@PlayerDialogID[playerid] = dialogid;
  1237.     Prev@PlayerDialogListitem[playerid] = 0;
  1238.     Prev@PlayerDialogNumListitems[playerid] = size;
  1239.     Prev@PlayerDialogPage[playerid] = 0;
  1240.     Prev@PlayerDialogTickCount[playerid] = 0;
  1241.  
  1242.     /*
  1243.     * BUTTONS AND PLAYER DIALOG TEXTDRAWS
  1244.     */
  1245.     if (button2[0] == EOS) { // only one center button
  1246.         TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[0]);
  1247.         TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[1]);
  1248.  
  1249.         TextDrawHideForPlayer(playerid, Prev@RightButtonTD[0]);
  1250.         TextDrawHideForPlayer(playerid, Prev@RightButtonTD[1]);
  1251.  
  1252.         TextDrawShowForPlayer(playerid, Prev@CenterButtonTD[0]);
  1253.         TextDrawShowForPlayer(playerid, Prev@CenterButtonTD[1]);
  1254.  
  1255.         Prev_CreatePlayerTextDraws(playerid, caption, "", "", button1, Prev@PlayerDialogNumListitems[playerid]);
  1256.         PlayerTextDrawShow(playerid, Prev@CenterButtonPTD[playerid]);
  1257.     } else { // dual buttons
  1258.         TextDrawShowForPlayer(playerid, Prev@LeftButtonTD[0]);
  1259.         TextDrawShowForPlayer(playerid, Prev@LeftButtonTD[1]);
  1260.  
  1261.         TextDrawShowForPlayer(playerid, Prev@RightButtonTD[0]);
  1262.         TextDrawShowForPlayer(playerid, Prev@RightButtonTD[1]);
  1263.  
  1264.         TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[0]);
  1265.         TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[1]);
  1266.  
  1267.         Prev_CreatePlayerTextDraws(playerid, caption, button1, button2, "", Prev@PlayerDialogNumListitems[playerid]);
  1268.         PlayerTextDrawShow(playerid, Prev@LeftButtonPTD[playerid]);
  1269.         PlayerTextDrawShow(playerid, Prev@RightButtonPTD[playerid]);
  1270.     }
  1271.  
  1272.     /*
  1273.     * HEADER
  1274.     */
  1275.     PlayerTextDrawShow(playerid, Prev@HeaderPTD[playerid]);
  1276.  
  1277.     /*
  1278.     * PAGE NUMBER
  1279.     */
  1280.     PlayerTextDrawShow(playerid, Prev@PageNumberPTD[playerid]);
  1281.  
  1282.     /*
  1283.     * SCROLLBAR
  1284.     */
  1285.     Prev@ScrollBarPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  1286.     if (Prev@PlayerDialogNumListitems[playerid] > (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) {
  1287.         Prev_UpdateScrollBar(playerid, 0, Prev_GetNumPages(playerid));
  1288.     }
  1289.  
  1290.     /*
  1291.     * PREVIEW MODEL LISTITEMS
  1292.     */
  1293.     Prev_UpdateListitems(playerid, 0, 0, Prev@PlayerDialogNumListitems[playerid]);
  1294.  
  1295.     return SelectTextDraw(playerid, DIALOG_PREVIEW_SELECT_COLOR);
  1296. }
  1297.  
  1298. #define Dialog_ShowPreviewModelDialog \
  1299.     ShowPreviewModelDialog
  1300.  
  1301. #define ShowPlayerPreviewModelDialog \
  1302.     ShowPreviewModelDialog
  1303.  
  1304. stock SetDialogPreviewRotation(playerid, listitem, Float:rx, Float:ry, Float:rz, Float:zoom) {
  1305.     if (playerid < 0 || playerid >= MAX_PLAYERS) {
  1306.         return 0;
  1307.     }
  1308.  
  1309.     if (listitem < 0 || listitem >= MAX_DIALOG_PREVIEW_MODELS) {
  1310.         return 0;
  1311.     }
  1312.  
  1313.     MEM_set_val(Prev@PlayerModelRotsPointer[playerid][0], listitem, _:rx);
  1314.     MEM_set_val(Prev@PlayerModelRotsPointer[playerid][1], listitem, _:ry);
  1315.     MEM_set_val(Prev@PlayerModelRotsPointer[playerid][2], listitem, _:rz);
  1316.     MEM_set_val(Prev@PlayerModelRotsPointer[playerid][3], listitem, _:zoom);
  1317.     return 1;
  1318. }
  1319.  
  1320. #define Dialog_SetListitemPreviewRot \
  1321.     SetDialogPreviewRotation
  1322.  
  1323. #define Dialog_SetModelRot \
  1324.     Dialog_SetListitemPreviewRot
Add Comment
Please, Sign In to add comment