C_far

PreviewModelDialog.inc - v4.5.1

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