Advertisement
Guest User

Untitled

a guest
Nov 6th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 151.58 KB | None | 0 0
  1. #pragma compat 1
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <easyDialog>
  8. #include <timestamptodate>
  9. #include <dini2>
  10. #include <sscanf2>
  11.  
  12. #define PATH_PROJECT_FILES      "TDEditor/Projects/"
  13. #define PATH_EXPORT_FILES       "TDEditor/Exports/"
  14. #define PATH_RECORD_FILE        "TDEditor/Records.txt"
  15. #define PATH_OBJECTS_FILE       "TDEditor/ObjectsData.db"
  16.  
  17. #define MAX_PROJECTS            32
  18. #define MAX_PROJECT_NAME        64
  19.  
  20. #define MAX_GROUPS              32
  21. #define MAX_GROUP_NAME          16
  22. #define MAX_GROUP_TEXTDRAWS     64
  23. #define MAX_GROUP_TEXTDRAW_TEXT 256
  24.  
  25. #define MAX_GROUP_TEXTDRAW_PREVIEW_CHARS 16
  26.  
  27. #define MESSAGE_COLOR           (0xfffd91ff)
  28.  
  29. #define COL_WHITE               "{ffffff}"
  30. #define COL_GREEN               "{93ffbc}"
  31. #define COL_RED                 "{ff7f7f}"
  32. #define COL_ORANGE              "{ffa172}"
  33. #define COL_BLUE                "{96ceff}"
  34. #define COL_YELLOW              "{f1ff96}"
  35. #define COL_GREY                "{c4c4c4}"
  36.  
  37. enum {
  38.     EDITING_NONE,
  39.     EDITING_POS,
  40.     EDITING_LETTER_SIZE,
  41.     EDITING_TEXT_SIZE,
  42.     EDITING_SHADOW_SIZE,
  43.     EDITING_OUTLINE_SIZE,
  44.     EDITING_PREVIEW_ROT,
  45.     EDITING_BACKGROUND_COLOR,
  46.     EDITING_TEXTDRAW_COLOR,
  47.     EDITING_BOX_COLOR,
  48.     EDITING_GROUP_POS
  49. };
  50.  
  51. enum {
  52.     COLOR_ELEMENT_TEXTDRAW,
  53.     COLOR_ELEMENT_BOX,
  54.     COLOR_ELEMENT_BACKGROUND
  55. };
  56.  
  57. enum E_GROUP {
  58.     E_GROUP_NAME[MAX_GROUP_NAME],
  59.     E_GROUP_TEXTDRAWS_COUNT,
  60.     bool:E_GROUP_VISIBLE
  61. };
  62.  
  63. enum E_TEXTDRAW {
  64.     E_TEXTDRAW_SQLID,
  65.     Text:E_TEXTDRAW_ID,
  66.     E_TEXTDRAW_TEXT[MAX_GROUP_TEXTDRAW_TEXT],
  67.     Float:E_TEXTDRAW_X,
  68.     Float:E_TEXTDRAW_Y,
  69.     Float:E_TEXTDRAW_LETTERSIZE_X,
  70.     Float:E_TEXTDRAW_LETTERSIZE_Y,
  71.     Float:E_TEXTDRAW_TEXTSIZE_X,
  72.     Float:E_TEXTDRAW_TEXTSIZE_Y,
  73.     E_TEXTDRAW_ALIGNMENT,
  74.     E_TEXTDRAW_COLOR,
  75.     bool:E_TEXTDRAW_USE_BOX,
  76.     E_TEXTDRAW_BOX_COLOR,
  77.     E_TEXTDRAW_SHADOW,
  78.     E_TEXTDRAW_OUTLINE,
  79.     E_TEXTDRAW_BACKGROUND_COLOR,
  80.     E_TEXTDRAW_FONT,
  81.     bool:E_TEXTDRAW_PROPORTIONAL,
  82.     bool:E_TEXTDRAW_SELECTABLE,
  83.     E_TEXTDRAW_PREVIEW_MODEL,
  84.     Float:E_TEXTDRAW_PREVIEW_ROT_X,
  85.     Float:E_TEXTDRAW_PREVIEW_ROT_Y,
  86.     Float:E_TEXTDRAW_PREVIEW_ROT_Z,
  87.     Float:E_TEXTDRAW_PREVIEW_ROT_ZOOM,
  88.     E_TEXTDRAW_PREVIEW_VEH_COLOR1,
  89.     E_TEXTDRAW_PREVIEW_VEH_COLOR2,
  90.     bool:E_TEXTDRAW_TYPE_PLAYER
  91. };
  92.  
  93. enum E_COLOR {
  94.     E_COLOR_NAME[32],
  95.     E_COLOR_CODE
  96. };
  97.  
  98. new const COLORS[][E_COLOR] = {
  99.     {"AntiqueWhite",    0xFAEBD7FF},
  100.     {"Aqua",            0x00FFFFFF},
  101.     {"Aquamarine",      0x7FFFD4FF},
  102.     {"Azure",           0xF0FFFFFF},
  103.     {"Beige",           0xF5F5DCFF},
  104.     {"Bisque",          0xFFE4C4FF},
  105.     {"Black",           0x000000FF},
  106.     {"BlanchedAlmond",  0xFFEBCDFF},
  107.     {"Blue",            0x0000FFFF},
  108.     {"BlueViolet",      0x8A2BE2FF},
  109.     {"Brown",           0xA52A2AFF},
  110.     {"BurlyWood",       0xDEB887FF},
  111.     {"CadetBlue",       0x5F9EA0FF},
  112.     {"Chartreuse",      0x7FFF00FF},
  113.     {"Chocolate",       0xD2691EFF},
  114.     {"Coral",           0xFF7F50FF},
  115.     {"CornflowerBlue",  0x6495EDFF},
  116.     {"Cornsilk",        0xFFF8DCFF},
  117.     {"Crimson",         0xDC143CFF},
  118.     {"Cyan",            0x00FFFFFF},
  119.     {"DarkBlue",        0x00008BFF},
  120.     {"DarkCyan",        0x008B8BFF},
  121.     {"DarkGoldenRod",   0xB8860BFF},
  122.     {"DarkGray",        0xA9A9A9FF},
  123.     {"DarkGrey",        0xA9A9A9FF},
  124.     {"DarkGreen",       0x006400FF},
  125.     {"DarkKhaki",       0xBDB76BFF},
  126.     {"DarkMagenta",     0x8B008BFF},
  127.     {"DarkOliveGreen",  0x556B2FFF},
  128.     {"DarkOrange",      0xFF8C00FF},
  129.     {"DarkOrchid",      0x9932CCFF},
  130.     {"DarkRed",         0x8B0000FF},
  131.     {"DarkSalmon",      0xE9967AFF},
  132.     {"DarkSeaGreen",    0x8FBC8FFF},
  133.     {"DarkSlateBlue",   0x483D8BFF},
  134.     {"DarkSlateGray",   0x2F4F4FFF},
  135.     {"DarkSlateGrey",   0x2F4F4FFF},
  136.     {"DarkTurquoise",   0x00CED1FF},
  137.     {"DarkViolet",      0x9400D3FF},
  138.     {"DeepPink",        0xFF1493FF},
  139.     {"DeepSkyBlue",     0x00BFFFFF},
  140.     {"DimGray",         0x696969FF},
  141.     {"DimGrey",         0x696969FF},
  142.     {"DodgerBlue",      0x1E90FFFF},
  143.     {"FireBrick",       0xB22222FF},
  144.     {"FloralWhite",     0xFFFAF0FF},
  145.     {"ForestGreen",     0x228B22FF},
  146.     {"Fuchsia",         0xFF00FFFF},
  147.     {"Gainsboro",       0xDCDCDCFF},
  148.     {"GhostWhite",      0xF8F8FFFF},
  149.     {"Gold",            0xFFD700FF},
  150.     {"GoldenRod",       0xDAA520FF},
  151.     {"Gray",            0x808080FF},
  152.     {"Grey",            0x808080FF},
  153.     {"Green",           0x008000FF},
  154.     {"GreenYellow",     0xADFF2FFF},
  155.     {"HoneyDew",        0xF0FFF0FF},
  156.     {"HotPink",         0xFF69B4FF},
  157.     {"IndianRed ",      0xCD5C5CFF},
  158.     {"Indigo ",         0x4B0082FF},
  159.     {"Ivory",           0xFFFFF0FF},
  160.     {"Khaki",           0xF0E68CFF},
  161.     {"Lavender",        0xE6E6FAFF},
  162.     {"LavenderBlush",   0xFFF0F5FF},
  163.     {"LawnGreen",       0x7CFC00FF},
  164.     {"LemonChiffon",    0xFFFACDFF},
  165.     {"LightBlue",       0xADD8E6FF},
  166.     {"LightCoral",      0xF08080FF},
  167.     {"LightCyan",       0xE0FFFFFF},
  168.     {"LightGoldenRodYellow", 0xFAFAD2FF},
  169.     {"LightGray",       0xD3D3D3FF},
  170.     {"LightGrey",       0xD3D3D3FF},
  171.     {"LightGreen",      0x90EE90FF},
  172.     {"LightPink",       0xFFB6C1FF},
  173.     {"LightSalmon",     0xFFA07AFF},
  174.     {"LightSeaGreen",   0x20B2AAFF},
  175.     {"LightSkyBlue",    0x87CEFAFF},
  176.     {"LightSlateGray",  0x778899FF},
  177.     {"LightSlateGrey",  0x778899FF},
  178.     {"LightSteelBlue",  0xB0C4DEFF},
  179.     {"LightYellow",     0xFFFFE0FF},
  180.     {"Lime",            0x00FF00FF},
  181.     {"LimeGreen",       0x32CD32FF},
  182.     {"Linen",           0xFAF0E6FF},
  183.     {"Magenta",         0xFF00FFFF},
  184.     {"Maroon",          0x800000FF},
  185.     {"MediumAquaMarine",0x66CDAAFF},
  186.     {"MediumBlue",      0x0000CDFF},
  187.     {"MediumOrchid",    0xBA55D3FF},
  188.     {"MediumPurple",    0x9370DBFF},
  189.     {"MediumSeaGreen",  0x3CB371FF},
  190.     {"MediumSlateBlue", 0x7B68EEFF},
  191.     {"MediumSpringGreen",0x00FA9AFF},
  192.     {"MediumTurquoise", 0x48D1CCFF},
  193.     {"MediumVioletRed", 0xC71585FF},
  194.     {"MidnightBlue",    0x191970FF},
  195.     {"MintCream",       0xF5FFFAFF},
  196.     {"MistyRose",       0xFFE4E1FF},
  197.     {"Moccasin",        0xFFE4B5FF},
  198.     {"NavajoWhite",     0xFFDEADFF},
  199.     {"Navy",            0x000080FF},
  200.     {"OldLace",         0xFDF5E6FF},
  201.     {"Olive",           0x808000FF},
  202.     {"OliveDrab",       0x6B8E23FF},
  203.     {"Orange",          0xFFA500FF},
  204.     {"OrangeRed",       0xFF4500FF},
  205.     {"Orchid",          0xDA70D6FF},
  206.     {"PaleGoldenRod",   0xEEE8AAFF},
  207.     {"PaleGreen",       0x98FB98FF},
  208.     {"PaleTurquoise",   0xAFEEEEFF},
  209.     {"PaleVioletRed",   0xDB7093FF},
  210.     {"PapayaWhip",      0xFFEFD5FF},
  211.     {"PeachPuff",       0xFFDAB9FF},
  212.     {"Peru",            0xCD853FFF},
  213.     {"Pink",            0xFFC0CBFF},
  214.     {"Plum",            0xDDA0DDFF},
  215.     {"PowderBlue",      0xB0E0E6FF},
  216.     {"Purple",          0x800080FF},
  217.     {"RebeccaPurple",   0x663399FF},
  218.     {"Red",             0xFF0000FF},
  219.     {"RosyBrown",       0xBC8F8FFF},
  220.     {"RoyalBlue",       0x4169E1FF},
  221.     {"SaddleBrown",     0x8B4513FF},
  222.     {"Salmon",          0xFA8072FF},
  223.     {"SandyBrown",      0xF4A460FF},
  224.     {"SeaGreen",        0x2E8B57FF},
  225.     {"SeaShell",        0xFFF5EEFF},
  226.     {"Sienna",          0xA0522DFF},
  227.     {"Silver",          0xC0C0C0FF},
  228.     {"SkyBlue",         0x87CEEBFF},
  229.     {"SlateBlue",       0x6A5ACDFF},
  230.     {"SlateGray",       0x708090FF},
  231.     {"SlateGrey",       0x708090FF},
  232.     {"Snow",            0xFFFAFAFF},
  233.     {"SpringGreen",     0x00FF7FFF},
  234.     {"SteelBlue",       0x4682B4FF},
  235.     {"Tan",             0xD2B48CFF},
  236.     {"Teal",            0x008080FF},
  237.     {"Thistle",         0xD8BFD8FF},
  238.     {"Tomato",          0xFF6347FF},
  239.     {"Turquoise",       0x40E0D0FF},
  240.     {"Violet",          0xEE82EEFF},
  241.     {"Wheat",           0xF5DEB3FF},
  242.     {"White",           0xFFFFFFFF},
  243.     {"WhiteSmoke",      0xF5F5F5FF},
  244.     {"Yellow",          0xFFFF00FF},
  245.     {"YellowGreen",     0x9ACD32FF}
  246. };
  247.  
  248. new projectName[MAX_PROJECT_NAME];
  249. new DB:projectDB;
  250. new bool:showTextDrawCmds;
  251.  
  252. new playerEditing[MAX_PLAYERS];
  253. new playerEditingTimer[MAX_PLAYERS];
  254. new PlayerText:playerEditingTextDraw[MAX_PLAYERS];
  255. new playerCurrentGroup[MAX_PLAYERS];
  256. new playerCurrentTextDraw[MAX_PLAYERS];
  257.  
  258. new groupData[MAX_GROUPS][E_GROUP];
  259. new groupTextDrawData[MAX_GROUPS][MAX_GROUP_TEXTDRAWS][E_TEXTDRAW];
  260. new groupsCount;
  261.  
  262. ReturnDate(timestamp)
  263. {
  264.     new year, month, day, unused;
  265.     TimestampToDate(timestamp, year, month, day, unused, unused, unused, 0);
  266.     #pragma unused unused
  267.  
  268.     static const MONTH_NAMES[][] = {
  269.         "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
  270.     };
  271.  
  272.     new date[32];
  273.     if (month < 1 || month > sizeof (MONTH_NAMES)) {
  274.         format(date, sizeof (date), "%i/%i/%i", day, month, year);
  275.     }
  276.     else {
  277.         format(date, sizeof (date), "%i %s, %i", day, MONTH_NAMES[(month - 1)], year);
  278.     }
  279.     return date;
  280. }
  281.  
  282. ResetGroupData(groupid) {
  283.     for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  284.         TextDrawDestroy(groupTextDrawData[groupid][i][E_TEXTDRAW_ID]);
  285.         groupTextDrawData[groupid][i][E_TEXTDRAW_ID] = Text:INVALID_TEXT_DRAW;
  286.     }
  287.  
  288.     groupData[groupid][E_GROUP_NAME][0] = EOS;
  289.     groupData[groupid][E_GROUP_TEXTDRAWS_COUNT] = 0;
  290.     groupData[groupid][E_GROUP_VISIBLE] = true;
  291. }
  292.  
  293. CreateGroupTextDraw(groupid, textdrawid) {
  294.     #define this(%0) \
  295.         groupTextDrawData[groupid][textdrawid][%0]
  296.  
  297.     if (this(E_TEXTDRAW_ID) != Text:INVALID_TEXT_DRAW) {
  298.         TextDrawDestroy(this(E_TEXTDRAW_ID));
  299.     }
  300.     this(E_TEXTDRAW_ID) = TextDrawCreate(this(E_TEXTDRAW_X), this(E_TEXTDRAW_Y), this(E_TEXTDRAW_TEXT));
  301.  
  302.     TextDrawLetterSize(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_LETTERSIZE_X), this(E_TEXTDRAW_LETTERSIZE_Y));
  303.     TextDrawTextSize(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_TEXTSIZE_X), this(E_TEXTDRAW_TEXTSIZE_Y));
  304.     TextDrawAlignment(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_ALIGNMENT));
  305.     TextDrawColor(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_COLOR));
  306.     TextDrawUseBox(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_USE_BOX));
  307.     TextDrawBoxColor(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_BOX_COLOR));
  308.     TextDrawSetShadow(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_SHADOW));
  309.     TextDrawSetOutline(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_OUTLINE));
  310.     TextDrawBackgroundColor(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_BACKGROUND_COLOR));
  311.     TextDrawFont(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_FONT));
  312.     TextDrawSetProportional(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_PROPORTIONAL));
  313.     TextDrawSetSelectable(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_SELECTABLE));
  314.     TextDrawSetPreviewModel(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_PREVIEW_MODEL));
  315.     TextDrawSetPreviewRot(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_PREVIEW_ROT_X), this(E_TEXTDRAW_PREVIEW_ROT_Y), this(E_TEXTDRAW_PREVIEW_ROT_Z), this(E_TEXTDRAW_PREVIEW_ROT_ZOOM));
  316.     TextDrawSetPreviewVehCol(this(E_TEXTDRAW_ID), this(E_TEXTDRAW_PREVIEW_VEH_COLOR1), this(E_TEXTDRAW_PREVIEW_VEH_COLOR2));
  317.  
  318.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  319.         TextDrawShowForAll(this(E_TEXTDRAW_ID));
  320.     }
  321.  
  322.     #undef this
  323. }
  324.  
  325. RGBA(red, green, blue, alpha) {
  326.     return ((red * 16777216) + (green * 65536) + (blue * 256) + alpha);
  327. }
  328.  
  329. HexToInt(string[]) {
  330.     new cur = 1;
  331.     new res = 0;
  332.     for (new i = strlen(string); i > 0; i--) {
  333.         if (string[i - 1] < 58) {
  334.             res = res + cur * (string[i - 1] - 48);
  335.         }
  336.         else {
  337.             res = res + cur * (string[i - 1] - 65 + 10);
  338.         }
  339.  
  340.         cur = cur * 16;
  341.     }
  342.     return res;
  343. }
  344.  
  345. forward ShowPlayerGroupDialog(playerid, groupid);
  346. public ShowPlayerGroupDialog(playerid, groupid) {
  347.     static string[512 + (MAX_GROUP_TEXTDRAWS * (MAX_GROUP_TEXTDRAW_TEXT + 32))];
  348.     string = ""COL_GREEN"Create New Textdraw\t"COL_GREY"Add a textdraw to group list (max textdraws you can add per group: "#MAX_GROUP_TEXTDRAWS")\n\
  349.         "COL_YELLOW"Edit Group Position\t"COL_GREY"Modify all group textdraws position at the same time\n";
  350.  
  351.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  352.         strcat(string, ""COL_YELLOW"Edit Group Visiblity\t"COL_GREY"Current: "COL_GREEN"ON\n");
  353.     }
  354.     else {
  355.         strcat(string, ""COL_YELLOW"Edit Group Visiblity\t"COL_GREY"Current: "COL_RED"OFF\n");
  356.     }
  357.  
  358.     strcat(string, ""COL_YELLOW"Edit Group Name\t"COL_GREY"Current: '"COL_GREEN"");
  359.     strcat(string, groupData[groupid][E_GROUP_NAME]);
  360.     strcat(string, ""COL_GREY"'\n");
  361.  
  362.     strcat(string, ""COL_ORANGE"Duplicate Group\t"COL_GREY"Copy group properties to a new empty group\n\
  363.         "COL_RED"Delete Group\t"COL_GREY"Delete the complete group with textdraws in it\n");
  364.  
  365.     new previewChars[MAX_GROUP_TEXTDRAW_PREVIEW_CHARS + 4];
  366.     for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  367.         strmid(previewChars, groupTextDrawData[groupid][i][E_TEXTDRAW_TEXT], 0, MAX_GROUP_TEXTDRAW_PREVIEW_CHARS);
  368.         if (strlen(groupTextDrawData[groupid][i][E_TEXTDRAW_TEXT]) > MAX_GROUP_TEXTDRAW_PREVIEW_CHARS) {
  369.             strcat(previewChars, "...");
  370.         }
  371.  
  372.         switch (groupTextDrawData[groupid][i][E_TEXTDRAW_FONT]) {
  373.             case 0, 1, 2, 3: {
  374.                 format(string, sizeof (string), "%sText #%i: '%s'\n", string, i, previewChars);
  375.             }
  376.  
  377.             case 4: {
  378.                 format(string, sizeof (string), "%sSprite #%i: '%s'\n", string, i, previewChars);
  379.             }
  380.  
  381.             case 5: {
  382.                 format(string, sizeof (string), "%sPreviewModel #%i: '%s'\n", string, i, previewChars);
  383.             }
  384.         }
  385.     }
  386.  
  387.     playerCurrentGroup[playerid] = groupid;
  388.     return Dialog_Show(playerid, GROUP_MENU, DIALOG_STYLE_TABLIST, "TDEditor: Group menu", string, "Select", "Back");
  389. }
  390.  
  391. forward ShowPlayerTextDrawDialog(playerid, textdrawid);
  392. public ShowPlayerTextDrawDialog(playerid, textdrawid) {
  393.     new groupid = playerCurrentGroup[playerid];
  394.  
  395.     static string[1024];
  396.     string = "Property\tValue\n";
  397.  
  398.     new previewChars[MAX_GROUP_TEXTDRAW_PREVIEW_CHARS + 4];
  399.     strmid(previewChars, groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], 0, MAX_GROUP_TEXTDRAW_PREVIEW_CHARS);
  400.     if (strlen(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT]) > MAX_GROUP_TEXTDRAW_PREVIEW_CHARS) {
  401.         strcat(previewChars, "...");
  402.     }
  403.  
  404.     format(string, sizeof (string),
  405.         "%s\
  406.         Text & Position\t'%s'\n",
  407.     string,
  408.     previewChars,
  409.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y]);
  410.  
  411.     switch (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_FONT]) {
  412.         case 0, 1, 2, 3: {
  413.             format(string, sizeof (string), "%sFont\t"COL_GREY"%i (Text)\n", string, groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_FONT]);
  414.         }
  415.  
  416.         case 4: {
  417.             strcat(string, "Font\t"COL_GREY"4 (Sprite)\n");
  418.         }
  419.  
  420.         case 5: {
  421.             strcat(string, "Font\t"COL_GREY"5 (PreviewModel)\n");
  422.         }
  423.  
  424.         default: {
  425.             strcat(string, "Font\t"COL_GREY"Unknown\n");
  426.         }
  427.     }
  428.  
  429.     switch (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ALIGNMENT]) {
  430.         case 1: {
  431.             strcat(string, "Alignment\t"COL_GREY"1 (Left)\n");
  432.         }
  433.  
  434.         case 2: {
  435.             strcat(string, "Alignment\t"COL_GREY"2 (Center)\n");
  436.         }
  437.  
  438.         case 3: {
  439.             strcat(string, "Alignment\t"COL_GREY"3 (Right)\n");
  440.         }
  441.  
  442.         default: {
  443.             strcat(string, "Alignment\t"COL_GREY"Unknown\n");
  444.         }
  445.     }
  446.  
  447.     if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PROPORTIONAL]) {
  448.         strcat(string, "Proportional\t"COL_GREEN"ON\n");
  449.     }
  450.     else {
  451.         strcat(string, "Proportional\t"COL_RED"OFF\n");
  452.     }
  453.  
  454.     format(string, sizeof (string),
  455.         "%s\
  456.         Shadow\t"COL_GREY"Size: %i\n\
  457.         Outline\t"COL_GREY"Size: %i\n\
  458.         Outline/Shadow Color\t{%06x}Preview\n",
  459.     string,
  460.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW],
  461.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE],
  462.     (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] >>> 8));
  463.  
  464.     format(string, sizeof (string),
  465.         "%s\
  466.         Letter Size\t"COL_GREY"%0.4f, %0.4f\n\
  467.         Letter/Textdraw Color\t{%06x}Preview\n",
  468.     string,
  469.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y],
  470.     (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR] >>> 8));
  471.  
  472.     if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_USE_BOX]) {
  473.         strcat(string, "Use Box\t"COL_GREEN"ON\n");
  474.     }
  475.     else {
  476.         strcat(string, "Use Box\t"COL_RED"OFF\n");
  477.     }
  478.  
  479.     format(string, sizeof (string),
  480.         "%s\
  481.         Box Size\t"COL_GREY"%0.4f, %0.4f\n\
  482.         Box Color\t{%06x}Preview\n",
  483.     string,
  484.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y],
  485.     (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR] >>> 8));
  486.  
  487.     if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SELECTABLE]) {
  488.         strcat(string, "Selectable\t"COL_GREEN"ON\n");
  489.     }
  490.     else {
  491.         strcat(string, "Selectable\t"COL_RED"OFF\n");
  492.     }
  493.  
  494.     strcat(string, "Preview Model Options\n");
  495.  
  496.     if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TYPE_PLAYER]) {
  497.         strcat(string, "TextDraw Type\t"COL_BLUE"PLAYER\n");
  498.     }
  499.     else {
  500.         strcat(string, "TextDraw Type\t"COL_YELLOW"GLOBAL\n");
  501.     }
  502.  
  503.     strcat(string,
  504.         ""COL_ORANGE"Duplicate TextDraw\n\
  505.         "COL_RED"Delete TextDraw\n");
  506.  
  507.     playerCurrentTextDraw[playerid] = textdrawid;
  508.     return Dialog_Show(playerid, TEXTDRAW_MENU, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Textdraw menu", string, "Select", "Back");
  509. }
  510.  
  511. ExportProject(const filename[]) {
  512.     new File:h = fopen(filename, io_write);
  513.     if (!h) {
  514.         return 0;
  515.     }
  516.  
  517.     new string[1024];
  518.     new globalTextdrawsCount;
  519.     new playerTextdrawsCount;
  520.     new bool:isThereAnyGlobalTextDraws;
  521.     new bool:isThereAnyPlayerTextDraws;
  522.  
  523.     fwrite(h, "// TextDraw(s) developed using Gammix's TextDraw editor 1.0\r\n\r\n");
  524.     fwrite(h, "#include <a_samp>\r\n\r\n");
  525.  
  526.     fwrite(h, "// Variable decleration on top of script\r\n");
  527.     for (new i; i < groupsCount; i++) {
  528.         format(string, sizeof (string), "// TextDraw Group: '%s'\r\n", groupData[i][E_GROUP_NAME]);
  529.         fwrite(h, string);
  530.  
  531.         globalTextdrawsCount = 0;
  532.         playerTextdrawsCount = 0;
  533.         for (new x; x < groupData[i][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  534.             if (!groupTextDrawData[i][x][E_TEXTDRAW_TYPE_PLAYER]) {
  535.                 globalTextdrawsCount++;
  536.  
  537.                 isThereAnyGlobalTextDraws = true;
  538.             }
  539.             else {
  540.                 playerTextdrawsCount++;
  541.  
  542.                 isThereAnyPlayerTextDraws = true;
  543.             }
  544.         }
  545.  
  546.         if (globalTextdrawsCount == 1) {
  547.             format(string, sizeof (string), "new Text:%sTD;\r\n", groupData[i][E_GROUP_NAME]);
  548.             fwrite(h, string);
  549.         }
  550.         else if (globalTextdrawsCount > 1) {
  551.             format(string, sizeof (string), "new Text:%sTD[%i];\r\n", groupData[i][E_GROUP_NAME], globalTextdrawsCount);
  552.             fwrite(h, string);
  553.         }
  554.  
  555.         if (playerTextdrawsCount == 1) {
  556.             format(string, sizeof (string), "new PlayerText:%sPTD[MAX_PLAYERS];\r\n", groupData[i][E_GROUP_NAME]);
  557.             fwrite(h, string);
  558.         }
  559.         else if (playerTextdrawsCount > 1) {
  560.             format(string, sizeof (string), "new PlayerText:%sPTD[MAX_PLAYERS][%i];\r\n", groupData[i][E_GROUP_NAME], playerTextdrawsCount);
  561.             fwrite(h, string);
  562.         }
  563.     }
  564.  
  565.     fwrite(h, "\r\n");
  566.  
  567.     if (isThereAnyGlobalTextDraws) {
  568.         fwrite(h, "// Creating global textdraw(s) under \"OnGameModeInit\" preferably\r\n");
  569.         fwrite(h, "public OnGameModeInit()\r\n");
  570.         fwrite(h, "{\r\n");
  571.        
  572.         new lastGlobalIndex;
  573.        
  574.         for (new i; i < groupsCount; i++) {
  575.             globalTextdrawsCount = 0;
  576.             for (new x; x < groupData[i][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  577.                 if (!groupTextDrawData[i][x][E_TEXTDRAW_TYPE_PLAYER]) {
  578.                     globalTextdrawsCount++;
  579.                     lastGlobalIndex = x;
  580.                    
  581.                 }
  582.             }
  583.            
  584.             if (globalTextdrawsCount == 0) {
  585.                 continue;
  586.             }
  587.  
  588.             format(string, sizeof (string), "\t// TextDraw Group: '%s'\r\n", groupData[i][E_GROUP_NAME]);
  589.             fwrite(h, string);
  590.            
  591.             if (globalTextdrawsCount == 1) {
  592.                 format(string, sizeof (string), "\t%sTD = TextDrawCreate(%0.4f, %0.4f, \"%s\");\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_X], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_Y], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_TEXT]);
  593.                 fwrite(h, string);
  594.                 format(string, sizeof (string), "\tTextDrawFont(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_FONT]);
  595.                 fwrite(h, string);
  596.                 format(string, sizeof (string), "\tTextDrawLetterSize(%sTD, %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_LETTERSIZE_Y]);
  597.                 fwrite(h, string);
  598.                 if (groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_ALIGNMENT] != 1) {
  599.                     format(string, sizeof (string), "\tTextDrawAlignment(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_ALIGNMENT]);
  600.                     fwrite(h, string);
  601.                 }
  602.                 format(string, sizeof (string), "\tTextDrawColor(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_COLOR]);
  603.                 fwrite(h, string);
  604.                 if (groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_SHADOW] != 0) {
  605.                     format(string, sizeof (string), "\tTextDrawSetShadow(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_SHADOW]);
  606.                     fwrite(h, string);
  607.                 }
  608.                 if (groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_OUTLINE] != 0) {
  609.                     format(string, sizeof (string), "\tTextDrawSetOutline(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_OUTLINE]);
  610.                     fwrite(h, string);
  611.                 }
  612.                 format(string, sizeof (string), "\tTextDrawBackgroundColor(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_BACKGROUND_COLOR]);
  613.                 fwrite(h, string);
  614.                 format(string, sizeof (string), "\tTextDrawSetProportional(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_PROPORTIONAL]);
  615.                 fwrite(h, string);
  616.                 format(string, sizeof (string), "\tTextDrawSetProportional(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_PROPORTIONAL]);
  617.                 fwrite(h, string);
  618.                 if (groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_USE_BOX]) {
  619.                     format(string, sizeof (string), "\tTextDrawUseBox(%sTD, 1);\r\n", groupData[i][E_GROUP_NAME]);
  620.                     fwrite(h, string);
  621.                     format(string, sizeof (string), "\tTextDrawBoxColor(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_BOX_COLOR]);
  622.                     fwrite(h, string);
  623.                     format(string, sizeof (string), "\tTextDrawTextSize(%sTD, %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_TEXTSIZE_Y]);
  624.                     fwrite(h, string);
  625.                 }
  626.                 if (groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_FONT] == 5) {
  627.                     format(string, sizeof (string), "\tTextDrawSetPreviewModel(%sTD, %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_PREVIEW_MODEL]);
  628.                     fwrite(h, string);
  629.                     format(string, sizeof (string), "\tTextDrawSetPreviewRot(%sTD, %0.4f, %0.4f, %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  630.                     fwrite(h, string);
  631.                 }
  632.                 if (groupTextDrawData[i][lastGlobalIndex][E_TEXTDRAW_SELECTABLE]) {
  633.                     format(string, sizeof (string), "\tTextDrawSetSelectable(%sTD, 1);\r\n", groupData[i][E_GROUP_NAME]);
  634.                     fwrite(h, string);
  635.                 }
  636.                
  637.                 fwrite(h, "\r\n");
  638.             }
  639.             else if (globalTextdrawsCount > 1) {
  640.                 new indx;
  641.                 for (new x; x < groupData[i][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  642.                     if(groupTextDrawData[i][x][E_TEXTDRAW_TYPE_PLAYER]) continue;
  643.                     format(string, sizeof (string), "\t%sTD[%i] = TextDrawCreate(%0.4f, %0.4f, \"%s\");\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_X], groupTextDrawData[i][x][E_TEXTDRAW_Y], groupTextDrawData[i][x][E_TEXTDRAW_TEXT]);
  644.                     fwrite(h, string);
  645.                     format(string, sizeof (string), "\tTextDrawFont(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_FONT]);
  646.                     fwrite(h, string);
  647.                     format(string, sizeof (string), "\tTextDrawLetterSize(%sTD[%i], %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[i][x][E_TEXTDRAW_LETTERSIZE_Y]);
  648.                     fwrite(h, string);
  649.                     if (groupTextDrawData[i][x][E_TEXTDRAW_ALIGNMENT] != 1) {
  650.                         format(string, sizeof (string), "\tTextDrawAlignment(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_ALIGNMENT]);
  651.                         fwrite(h, string);
  652.                     }
  653.                     format(string, sizeof (string), "\tTextDrawColor(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_COLOR]);
  654.                     fwrite(h, string);
  655.                     if (groupTextDrawData[i][x][E_TEXTDRAW_SHADOW] != 0) {
  656.                         format(string, sizeof (string), "\tTextDrawSetShadow(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_SHADOW]);
  657.                         fwrite(h, string);
  658.                     }
  659.                     if (groupTextDrawData[i][x][E_TEXTDRAW_OUTLINE] != 0) {
  660.                         format(string, sizeof (string), "\tTextDrawSetOutline(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_OUTLINE]);
  661.                         fwrite(h, string);
  662.                     }
  663.                     format(string, sizeof (string), "\tTextDrawBackgroundColor(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_BACKGROUND_COLOR]);
  664.                     fwrite(h, string);
  665.                     format(string, sizeof (string), "\tTextDrawSetProportional(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PROPORTIONAL]);
  666.                     fwrite(h, string);
  667.                     format(string, sizeof (string), "\tTextDrawSetProportional(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PROPORTIONAL]);
  668.                     fwrite(h, string);
  669.                     if (groupTextDrawData[i][x][E_TEXTDRAW_USE_BOX]) {
  670.                         format(string, sizeof (string), "\tTextDrawUseBox(%sTD[%i], 1);\r\n", groupData[i][E_GROUP_NAME], indx);
  671.                         fwrite(h, string);
  672.                         format(string, sizeof (string), "\tTextDrawBoxColor(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_BOX_COLOR]);
  673.                         fwrite(h, string);
  674.                         format(string, sizeof (string), "\tTextDrawTextSize(%sTD[%i], %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[i][x][E_TEXTDRAW_TEXTSIZE_Y]);
  675.                         fwrite(h, string);
  676.                     }
  677.                     if (groupTextDrawData[i][x][E_TEXTDRAW_FONT] == 5) {
  678.                         format(string, sizeof (string), "\tTextDrawSetPreviewModel(%sTD[%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_MODEL]);
  679.                         fwrite(h, string);
  680.                         format(string, sizeof (string), "\tTextDrawSetPreviewRot(%sTD[%i], %0.4f, %0.4f, %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  681.                         fwrite(h, string);
  682.                     }
  683.                     if (groupTextDrawData[i][x][E_TEXTDRAW_SELECTABLE]) {
  684.                         format(string, sizeof (string), "\tTextDrawSetSelectable(%sTD[%i], 1);\r\n", groupData[i][E_GROUP_NAME], indx);
  685.                         fwrite(h, string);
  686.                     }
  687.                    
  688.                     fwrite(h, "\r\n");
  689.                     indx++;
  690.                 }
  691.             }
  692.         }
  693.        
  694.         fwrite(h, "\treturn 1;\r\n");
  695.         fwrite(h, "}\r\n\r\n");
  696.     }
  697.    
  698.     if (isThereAnyPlayerTextDraws) {
  699.         fwrite(h, "// Creating player textdraw(s) under \"OnPlayerConnect\" preferably\r\n");
  700.         fwrite(h, "public OnPlayerConnect(playerid)\r\n");
  701.         fwrite(h, "{\r\n");
  702.        
  703.         new lastPTXIndex;
  704.        
  705.         for (new i; i < groupsCount; i++) {
  706.             playerTextdrawsCount = 0;
  707.             for (new x; x < groupData[i][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  708.                 if (groupTextDrawData[i][x][E_TEXTDRAW_TYPE_PLAYER]) {
  709.                     playerTextdrawsCount++;
  710.                     lastPTXIndex = x;
  711.                 }
  712.             }
  713.            
  714.             if (playerTextdrawsCount == 0) {
  715.                 continue;
  716.             }
  717.  
  718.             format(string, sizeof (string), "\t// TextDraw Group: '%s'\r\n", groupData[i][E_GROUP_NAME]);
  719.             fwrite(h, string);
  720.  
  721.             if (playerTextdrawsCount == 1) {
  722.                 format(string, sizeof (string), "\t%sPTD[playerid] = CreatePlayerTextDraw(playerid, %0.4f, %0.4f, \"%s\");\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_X], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_Y], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_TEXT]);
  723.                 fwrite(h, string);
  724.                 format(string, sizeof (string), "\tPlayerTextDrawFont(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_FONT]);
  725.                 fwrite(h, string);
  726.                 format(string, sizeof (string), "\tPlayerTextDrawLetterSize(playerid, %sPTD[playerid], %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_LETTERSIZE_Y]);
  727.                 fwrite(h, string);
  728.                 if (groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_ALIGNMENT] != 1) {
  729.                     format(string, sizeof (string), "\tPlayerTextDrawAlignment(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_ALIGNMENT]);
  730.                     fwrite(h, string);
  731.                 }
  732.                 format(string, sizeof (string), "\tPlayerTextDrawColor(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_COLOR]);
  733.                 fwrite(h, string);
  734.                 if (groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_SHADOW] != 0) {
  735.                     format(string, sizeof (string), "\tPlayerTextDrawSetShadow(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_SHADOW]);
  736.                     fwrite(h, string);
  737.                 }
  738.                 if (groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_OUTLINE] != 0) {
  739.                     format(string, sizeof (string), "\tPlayerTextDrawSetOutline(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_OUTLINE]);
  740.                     fwrite(h, string);
  741.                 }
  742.                 format(string, sizeof (string), "\tPlayerTextDrawBackgroundColor(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_BACKGROUND_COLOR]);
  743.                 fwrite(h, string);
  744.                 format(string, sizeof (string), "\tPlayerTextDrawSetProportional(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_PROPORTIONAL]);
  745.                 fwrite(h, string);
  746.                 format(string, sizeof (string), "\tPlayerTextDrawSetProportional(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_PROPORTIONAL]);
  747.                 fwrite(h, string);
  748.                 if (groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_USE_BOX]) {
  749.                     format(string, sizeof (string), "\tPlayerTextDrawUseBox(playerid, %sPTD[playerid], 1);\r\n", groupData[i][E_GROUP_NAME]);
  750.                     fwrite(h, string);
  751.                     format(string, sizeof (string), "\tPlayerTextDrawBoxColor(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_BOX_COLOR]);
  752.                     fwrite(h, string);
  753.                     format(string, sizeof (string), "\tPlayerTextDrawTextSize(playerid, %sPTD[playerid], %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_TEXTSIZE_Y]);
  754.                     fwrite(h, string);
  755.                 }
  756.                 if (groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_FONT] == 5) {
  757.                     format(string, sizeof (string), "\tPlayerTextDrawSetPreviewModel(playerid, %sPTD[playerid], %i);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_PREVIEW_MODEL]);
  758.                     fwrite(h, string);
  759.                     format(string, sizeof (string), "\tPlayerTextDrawSetPreviewRot(playerid, %sPTD[playerid], %0.4f, %0.4f, %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  760.                     fwrite(h, string);
  761.                 }
  762.                 if (groupTextDrawData[i][lastPTXIndex][E_TEXTDRAW_SELECTABLE]) {
  763.                     format(string, sizeof (string), "\tPlayerTextDrawSetSelectable(playerid, %sPTD[playerid], 1);\r\n", groupData[i][E_GROUP_NAME]);
  764.                     fwrite(h, string);
  765.                 }
  766.                
  767.                 fwrite(h, "\r\n");
  768.             }
  769.             else if (playerTextdrawsCount > 1) {
  770.                 new indx;
  771.                 for (new x; x < groupData[i][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  772.                     if(!groupTextDrawData[i][x][E_TEXTDRAW_TYPE_PLAYER]) continue;
  773.                     format(string, sizeof (string), "\t%sPTD[playerid][%i] = CreatePlayerTextDraw(playerid, %0.4f, %0.4f, \"%s\");\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_X], groupTextDrawData[i][x][E_TEXTDRAW_Y], groupTextDrawData[i][x][E_TEXTDRAW_TEXT]);
  774.                     fwrite(h, string);
  775.                     format(string, sizeof (string), "\tPlayerTextDrawFont(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_FONT]);
  776.                     fwrite(h, string);
  777.                     format(string, sizeof (string), "\tPlayerTextDrawLetterSize(playerid, %sPTD[playerid][%i], %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[i][x][E_TEXTDRAW_LETTERSIZE_Y]);
  778.                     fwrite(h, string);
  779.                     if (groupTextDrawData[i][x][E_TEXTDRAW_ALIGNMENT] != 1) {
  780.                         format(string, sizeof (string), "\tPlayerTextDrawAlignment(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_ALIGNMENT]);
  781.                         fwrite(h, string);
  782.                     }
  783.                     format(string, sizeof (string), "\tPlayerTextDrawColor(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_COLOR]);
  784.                     fwrite(h, string);
  785.                     if (groupTextDrawData[i][x][E_TEXTDRAW_SHADOW] != 0) {
  786.                         format(string, sizeof (string), "\tPlayerTextDrawSetShadow(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_SHADOW]);
  787.                         fwrite(h, string);
  788.                     }
  789.                     if (groupTextDrawData[i][x][E_TEXTDRAW_OUTLINE] != 0) {
  790.                         format(string, sizeof (string), "\tPlayerTextDrawSetOutline(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_OUTLINE]);
  791.                         fwrite(h, string);
  792.                     }
  793.                     format(string, sizeof (string), "\tPlayerTextDrawBackgroundColor(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_BACKGROUND_COLOR]);
  794.                     fwrite(h, string);
  795.                     format(string, sizeof (string), "\tPlayerTextDrawSetProportional(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PROPORTIONAL]);
  796.                     fwrite(h, string);
  797.                     format(string, sizeof (string), "\tPlayerTextDrawSetProportional(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PROPORTIONAL]);
  798.                     fwrite(h, string);
  799.                     if (groupTextDrawData[i][x][E_TEXTDRAW_USE_BOX]) {
  800.                         format(string, sizeof (string), "\tPlayerTextDrawUseBox(playerid, %sPTD[playerid][%i], 1);\r\n", groupData[i][E_GROUP_NAME], indx);
  801.                         fwrite(h, string);
  802.                         format(string, sizeof (string), "\tPlayerTextDrawBoxColor(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_BOX_COLOR]);
  803.                         fwrite(h, string);
  804.                         format(string, sizeof (string), "\tPlayerTextDrawTextSize(playerid, %sPTD[playerid][%i], %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[i][x][E_TEXTDRAW_TEXTSIZE_Y]);
  805.                         fwrite(h, string);
  806.                     }
  807.                     if (groupTextDrawData[i][x][E_TEXTDRAW_FONT] == 5) {
  808.                         format(string, sizeof (string), "\tPlayerTextDrawSetPreviewModel(playerid, %sPTD[playerid][%i], %i);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_MODEL]);
  809.                         fwrite(h, string);
  810.                         format(string, sizeof (string), "\tPlayerTextDrawSetPreviewRot(playerid, %sPTD[playerid][%i], %0.4f, %0.4f, %0.4f, %0.4f);\r\n", groupData[i][E_GROUP_NAME], indx, groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  811.                         fwrite(h, string);
  812.                     }
  813.                     if (groupTextDrawData[i][x][E_TEXTDRAW_SELECTABLE]) {
  814.                         format(string, sizeof (string), "\tPlayerTextDrawSetSelectable(playerid, %sPTD[playerid][%i], 1);\r\n", groupData[i][E_GROUP_NAME], indx);
  815.                         fwrite(h, string);
  816.                     }
  817.                    
  818.                     fwrite(h, "\r\n");
  819.                     indx++;
  820.                 }
  821.             }
  822.         }
  823.  
  824.         fwrite(h, "\treturn 1;\r\n");
  825.         fwrite(h, "}\r\n\r\n");
  826.     }
  827.  
  828.     fwrite(h, "// End of export!");
  829.     fclose(h);
  830.     return 1;
  831. }
  832.  
  833. public OnFilterScriptInit() {
  834.     printf("\n==========================================\n");
  835.    
  836.     if (!fexist(PATH_PROJECT_FILES)) {
  837.         printf("[TDEditor.pwn] - Error: Path \"%s\" doesn't exists. Your projects won't be saved/loaded.", PATH_PROJECT_FILES);
  838.     }
  839.    
  840.     if (!fexist(PATH_EXPORT_FILES)) {
  841.         printf("[TDEditor.pwn] - Error: Path \"%s\" doesn't exists. Your projects won't be exported.", PATH_EXPORT_FILES);
  842.     }
  843.  
  844.     if (!fexist(PATH_RECORD_FILE)) {
  845.         new File:h = fopen(PATH_RECORD_FILE, io_write);
  846.         if (!h) {
  847.             printf("[TDEditor.pwn] - Error: Path \"%s\" doesn't exists. Your projects list won't save/load projects names as history.", PATH_RECORD_FILE);
  848.         }
  849.         else {
  850.             fclose(h);
  851.         }
  852.     }
  853.  
  854.     if (!fexist(PATH_OBJECTS_FILE)) {
  855.         printf("[TDEditor.pwn] - Warning: Path \"%s\" doesn't exists. You cannot search object models in Preview Model Option; only modelids accepted.", PATH_OBJECTS_FILE);
  856.     }
  857.  
  858.     printf("[TDEditor.pwn] - Loaded v1.0 - By Gammix");
  859.    
  860.     printf("\n==========================================\n");
  861.  
  862.     projectDB = DB:0;
  863.     showTextDrawCmds = true;
  864.  
  865.     for (new i; i < MAX_GROUPS; i++) {
  866.         for (new x; x < MAX_GROUP_TEXTDRAWS; x++) {
  867.             groupTextDrawData[i][x][E_TEXTDRAW_ID] = Text:INVALID_TEXT_DRAW;
  868.         }
  869.  
  870.         ResetGroupData(i);
  871.     }
  872.     groupsCount = 0;
  873.  
  874.     for (new i; i < MAX_PLAYERS; i++) {
  875.         playerEditing[i] = EDITING_NONE;
  876.         playerEditingTimer[i] = -1;
  877.     }
  878.     return 1;
  879. }
  880.  
  881. public OnFilterScriptExit() {
  882.     if (projectDB) {
  883.         new string[1024];
  884.         for (new i; i < groupsCount; i++) {
  885.             for (new x; x < groupData[i][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  886.                 string = "UPDATE %s SET \
  887.                         text = '%q', \
  888.                         x = '%f', y = '%f', \
  889.                         letter_x = '%f', letter_y = '%f', \
  890.                         text_x = '%f', text_y = '%f', \
  891.                         alignment = '%i', \
  892.                         color = '%i', \
  893.                         usebox = '%i', \
  894.                         box_color = '%i', \
  895.                         shadow = '%i', \
  896.                         outline = '%i', \
  897.                         background_color = '%i', \
  898.                         font = '%i', \
  899.                         proportional = '%i', \
  900.                         selectable = '%i', \
  901.                         preview_model = '%i', \
  902.                         rot_x = '%f', rot_y = '%f', rot_z = '%f', rot_zoom = '%f', \
  903.                         veh_color1 = '%i', veh_color2 = '%i', \
  904.                         type_player = '%i' \
  905.                     WHERE id = '%i'";
  906.                 format(string, sizeof (string), string,
  907.                     groupData[i][E_GROUP_NAME],
  908.                     groupTextDrawData[i][x][E_TEXTDRAW_TEXT],
  909.                     groupTextDrawData[i][x][E_TEXTDRAW_X], groupTextDrawData[i][x][E_TEXTDRAW_Y],
  910.                     groupTextDrawData[i][x][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[i][x][E_TEXTDRAW_LETTERSIZE_Y],
  911.                     groupTextDrawData[i][x][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[i][x][E_TEXTDRAW_TEXTSIZE_Y],
  912.                     groupTextDrawData[i][x][E_TEXTDRAW_ALIGNMENT],
  913.                     groupTextDrawData[i][x][E_TEXTDRAW_COLOR],
  914.                     groupTextDrawData[i][x][E_TEXTDRAW_USE_BOX],
  915.                     groupTextDrawData[i][x][E_TEXTDRAW_BOX_COLOR],
  916.                     groupTextDrawData[i][x][E_TEXTDRAW_SHADOW],
  917.                     groupTextDrawData[i][x][E_TEXTDRAW_OUTLINE],
  918.                     groupTextDrawData[i][x][E_TEXTDRAW_BACKGROUND_COLOR],
  919.                     groupTextDrawData[i][x][E_TEXTDRAW_FONT],
  920.                     groupTextDrawData[i][x][E_TEXTDRAW_PROPORTIONAL],
  921.                     groupTextDrawData[i][x][E_TEXTDRAW_SELECTABLE],
  922.                     groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_MODEL],
  923.                     groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_ROT_ZOOM],
  924.                     groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_VEH_COLOR1], groupTextDrawData[i][x][E_TEXTDRAW_PREVIEW_VEH_COLOR2],
  925.                     groupTextDrawData[i][x][E_TEXTDRAW_TYPE_PLAYER],
  926.                     groupTextDrawData[i][x][E_TEXTDRAW_SQLID]);
  927.                 db_query(projectDB, string);
  928.             }
  929.         }
  930.         db_close(projectDB);
  931.         projectDB = DB:0;
  932.     }
  933.  
  934.     for (new i; i < groupsCount; i++) {
  935.         ResetGroupData(i);
  936.     }
  937.     groupsCount = 0;
  938.    
  939.     for (new i; i < MAX_PLAYERS; i++) {
  940.         playerEditing[i] = EDITING_NONE;
  941.         playerEditingTimer[i] = -1;
  942.     }
  943.     return 1;
  944. }
  945.  
  946. public OnPlayerConnect(playerid) {
  947.     playerEditingTextDraw[playerid] = CreatePlayerTextDraw(playerid, 7.0, 170.0, "-");
  948.     PlayerTextDrawBackgroundColor(playerid, playerEditingTextDraw[playerid], 255);
  949.     PlayerTextDrawFont(playerid, playerEditingTextDraw[playerid], 1);
  950.     PlayerTextDrawLetterSize(playerid, playerEditingTextDraw[playerid], 0.2, 1.0);
  951.     PlayerTextDrawColor(playerid, playerEditingTextDraw[playerid], -1);
  952.     PlayerTextDrawSetOutline(playerid, playerEditingTextDraw[playerid], 1);
  953.     PlayerTextDrawSetProportional(playerid, playerEditingTextDraw[playerid], 1);
  954.     PlayerTextDrawSetShadow(playerid, playerEditingTextDraw[playerid], 0);
  955.     return 1;
  956. }
  957.  
  958. public OnPlayerDisconnect(playerid, reason) {
  959.     playerEditing[playerid] = EDITING_NONE;
  960.     KillTimer(playerEditingTimer[playerid]);
  961.     playerEditingTimer[playerid] = -1;
  962.    
  963.     if (projectDB) {
  964.         new string[1024];
  965.         new groupid = playerCurrentGroup[playerid];
  966.        
  967.         for (new x; x < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  968.             string = "UPDATE %s SET \
  969.                 text = '%q', \
  970.                 x = '%f', y = '%f', \
  971.                 letter_x = '%f', letter_y = '%f', \
  972.                 text_x = '%f', text_y = '%f', \
  973.                 alignment = '%i', \
  974.                 color = '%i', \
  975.                 usebox = '%i', \
  976.                 box_color = '%i', \
  977.                 shadow = '%i', \
  978.                 outline = '%i', \
  979.                 background_color = '%i', \
  980.                 font = '%i', \
  981.                 proportional = '%i', \
  982.                 selectable = '%i', \
  983.                 preview_model = '%i', \
  984.                 rot_x = '%f', rot_y = '%f', rot_z = '%f', rot_zoom = '%f', \
  985.                 veh_color1 = '%i', veh_color2 = '%i', \
  986.                 type_player = '%i' \
  987.             WHERE id = '%i'";
  988.             format(string, sizeof (string), string,
  989.                 groupData[groupid][E_GROUP_NAME],
  990.                 groupTextDrawData[groupid][x][E_TEXTDRAW_TEXT],
  991.                 groupTextDrawData[groupid][x][E_TEXTDRAW_X], groupTextDrawData[groupid][x][E_TEXTDRAW_Y],
  992.                 groupTextDrawData[groupid][x][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][x][E_TEXTDRAW_LETTERSIZE_Y],
  993.                 groupTextDrawData[groupid][x][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][x][E_TEXTDRAW_TEXTSIZE_Y],
  994.                 groupTextDrawData[groupid][x][E_TEXTDRAW_ALIGNMENT],
  995.                 groupTextDrawData[groupid][x][E_TEXTDRAW_COLOR],
  996.                 groupTextDrawData[groupid][x][E_TEXTDRAW_USE_BOX],
  997.                 groupTextDrawData[groupid][x][E_TEXTDRAW_BOX_COLOR],
  998.                 groupTextDrawData[groupid][x][E_TEXTDRAW_SHADOW],
  999.                 groupTextDrawData[groupid][x][E_TEXTDRAW_OUTLINE],
  1000.                 groupTextDrawData[groupid][x][E_TEXTDRAW_BACKGROUND_COLOR],
  1001.                 groupTextDrawData[groupid][x][E_TEXTDRAW_FONT],
  1002.                 groupTextDrawData[groupid][x][E_TEXTDRAW_PROPORTIONAL],
  1003.                 groupTextDrawData[groupid][x][E_TEXTDRAW_SELECTABLE],
  1004.                 groupTextDrawData[groupid][x][E_TEXTDRAW_PREVIEW_MODEL],
  1005.                 groupTextDrawData[groupid][x][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][x][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][x][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][x][E_TEXTDRAW_PREVIEW_ROT_ZOOM],
  1006.                 groupTextDrawData[groupid][x][E_TEXTDRAW_PREVIEW_VEH_COLOR1], groupTextDrawData[groupid][x][E_TEXTDRAW_PREVIEW_VEH_COLOR2],
  1007.                 groupTextDrawData[groupid][x][E_TEXTDRAW_TYPE_PLAYER],
  1008.                 groupTextDrawData[groupid][x][E_TEXTDRAW_SQLID]);
  1009.             db_query(projectDB, string);
  1010.         }
  1011.     }
  1012.     return 1;
  1013. }
  1014.  
  1015. public OnPlayerSpawn(playerid) {
  1016.     SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Use \"/text\" to open TextDraw Edtior menu.");
  1017.     return 1;
  1018. }
  1019.  
  1020. forward OnPlayerTimerUpdate(playerid);
  1021. public OnPlayerTimerUpdate(playerid) {
  1022.     if (playerEditing[playerid] != EDITING_NONE) {
  1023.         new groupid = playerCurrentGroup[playerid];
  1024.         new textdrawid = playerCurrentTextDraw[playerid];
  1025.    
  1026.         new keys, updown, leftright;
  1027.         GetPlayerKeys(playerid, keys, updown, leftright);
  1028.  
  1029.         if (updown < 0) {
  1030.             switch (playerEditing[playerid]) {
  1031.                 case EDITING_GROUP_POS: {
  1032.                     if (keys == KEY_SPRINT) {
  1033.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1034.                             groupTextDrawData[groupid][i][E_TEXTDRAW_Y] -= 10.0;
  1035.                             CreateGroupTextDraw(groupid, i);
  1036.                         }
  1037.                     }
  1038.                     else {
  1039.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1040.                             groupTextDrawData[groupid][i][E_TEXTDRAW_Y] -= 0.5;
  1041.                             CreateGroupTextDraw(groupid, i);
  1042.                         }
  1043.                     }
  1044.                 }
  1045.                
  1046.                 case EDITING_POS: {
  1047.                     if (keys == KEY_SPRINT) {
  1048.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y] -= 10.0;
  1049.                     }
  1050.                     else {
  1051.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y] -= 0.5;
  1052.                     }
  1053.                     CreateGroupTextDraw(groupid, textdrawid);
  1054.                 }
  1055.  
  1056.                 case EDITING_LETTER_SIZE: {
  1057.                     if (keys == KEY_SPRINT) {
  1058.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y] -= 1.0;
  1059.                     }
  1060.                     else {
  1061.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y] -= 0.1;
  1062.                     }
  1063.  
  1064.                     TextDrawLetterSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y]);
  1065.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1066.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1067.                     }
  1068.                 }
  1069.  
  1070.                 case EDITING_TEXT_SIZE: {
  1071.                     if (keys == KEY_SPRINT) {
  1072.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y] -= 10.0;
  1073.                     }
  1074.                     else {
  1075.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y] -= 0.5;
  1076.                     }
  1077.  
  1078.                     TextDrawTextSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y]);
  1079.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1080.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1081.                     }
  1082.                 }
  1083.  
  1084.                 case EDITING_SHADOW_SIZE: {
  1085.                     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW] += 1;
  1086.  
  1087.                     TextDrawSetShadow(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW]);
  1088.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1089.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1090.                     }
  1091.                 }
  1092.  
  1093.                 case EDITING_OUTLINE_SIZE: {
  1094.                     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE] += 1;
  1095.    
  1096.                     TextDrawSetOutline(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE]);
  1097.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1098.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1099.                     }
  1100.                 }
  1101.  
  1102.                 case EDITING_PREVIEW_ROT: {
  1103.                     if (keys == KEY_SPRINT) {
  1104.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] += 5.0;
  1105.                     }
  1106.                     else {
  1107.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] += 1.0;
  1108.                     }
  1109.  
  1110.                     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1111.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1112.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1113.                     }
  1114.                 }
  1115.             }
  1116.         }
  1117.         else if (updown > 0) {
  1118.             switch (playerEditing[playerid]) {
  1119.                 case EDITING_GROUP_POS: {
  1120.                     if (keys == KEY_SPRINT) {
  1121.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1122.                             groupTextDrawData[groupid][i][E_TEXTDRAW_Y] += 10.0;
  1123.                             CreateGroupTextDraw(groupid, i);
  1124.                         }
  1125.                     }
  1126.                     else {
  1127.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1128.                             groupTextDrawData[groupid][i][E_TEXTDRAW_Y] += 0.5;
  1129.                             CreateGroupTextDraw(groupid, i);
  1130.                         }
  1131.                     }
  1132.                 }
  1133.                
  1134.                 case EDITING_POS: {
  1135.                     if (keys == KEY_SPRINT) {
  1136.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y] += 10.0;
  1137.                     }
  1138.                     else {
  1139.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y] += 0.5;
  1140.                     }
  1141.                     CreateGroupTextDraw(groupid, textdrawid);
  1142.                 }
  1143.  
  1144.                 case EDITING_LETTER_SIZE: {
  1145.                     if (keys == KEY_SPRINT) {
  1146.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y] += 1.0;
  1147.                     }
  1148.                     else {
  1149.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y] += 0.1;
  1150.                     }
  1151.  
  1152.                     TextDrawLetterSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y]);
  1153.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1154.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1155.                     }
  1156.                 }
  1157.  
  1158.                 case EDITING_TEXT_SIZE: {
  1159.                     if (keys == KEY_SPRINT) {
  1160.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y] += 10.0;
  1161.                     }
  1162.                     else {
  1163.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y] += 0.5;
  1164.                     }
  1165.  
  1166.                     TextDrawTextSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y]);
  1167.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1168.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1169.                     }
  1170.                 }
  1171.  
  1172.                 case EDITING_SHADOW_SIZE: {
  1173.                     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW] -= 1;
  1174.  
  1175.                     TextDrawSetShadow(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW]);
  1176.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1177.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1178.                     }
  1179.                 }
  1180.  
  1181.                 case EDITING_OUTLINE_SIZE: {
  1182.                     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE] -= 1;
  1183.  
  1184.                     TextDrawSetOutline(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE]);
  1185.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1186.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1187.                     }
  1188.                 }
  1189.  
  1190.                 case EDITING_PREVIEW_ROT: {
  1191.                     if (keys == KEY_SPRINT) {
  1192.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] -= 5.0;
  1193.                     }
  1194.                     else {
  1195.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] -= 1.0;
  1196.                     }
  1197.  
  1198.                     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1199.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1200.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1201.                     }
  1202.                 }
  1203.             }
  1204.         }
  1205.  
  1206.         if (leftright < 0) {
  1207.             switch (playerEditing[playerid]) {
  1208.                 case EDITING_GROUP_POS: {
  1209.                     if (keys == KEY_SPRINT) {
  1210.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1211.                             groupTextDrawData[groupid][i][E_TEXTDRAW_X] -= 10.0;
  1212.                             CreateGroupTextDraw(groupid, i);
  1213.                         }
  1214.                     }
  1215.                     else {
  1216.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1217.                             groupTextDrawData[groupid][i][E_TEXTDRAW_X] -= 0.5;
  1218.                             CreateGroupTextDraw(groupid, i);
  1219.                         }
  1220.                     }
  1221.                 }
  1222.                
  1223.                 case EDITING_POS: {
  1224.                     if (keys == KEY_SPRINT) {
  1225.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X] -= 10.0;
  1226.                     }
  1227.                     else {
  1228.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X] -= 0.5;
  1229.                     }
  1230.                     CreateGroupTextDraw(groupid, textdrawid);
  1231.                 }
  1232.  
  1233.                 case EDITING_LETTER_SIZE: {
  1234.                     if (keys == KEY_SPRINT) {
  1235.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X] -= 1.0;
  1236.                     }
  1237.                     else {
  1238.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X] -= 0.1;
  1239.                     }
  1240.  
  1241.                     TextDrawLetterSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y]);
  1242.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1243.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1244.                     }
  1245.                 }
  1246.  
  1247.                 case EDITING_TEXT_SIZE: {
  1248.                     if (keys == KEY_SPRINT) {
  1249.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X] -= 10.0;
  1250.                     }
  1251.                     else {
  1252.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X] -= 0.5;
  1253.                     }
  1254.  
  1255.                     TextDrawTextSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y]);
  1256.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1257.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1258.                     }
  1259.                 }
  1260.  
  1261.                 case EDITING_PREVIEW_ROT: {
  1262.                     if (keys == KEY_SPRINT) {
  1263.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] -= 5.0;
  1264.                     }
  1265.                     else {
  1266.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] -= 1.0;
  1267.                     }
  1268.  
  1269.                     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1270.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1271.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1272.                     }
  1273.                 }
  1274.             }
  1275.         }
  1276.         else if (leftright > 0) {
  1277.             switch (playerEditing[playerid]) {
  1278.                 case EDITING_GROUP_POS: {
  1279.                     if (keys == KEY_SPRINT) {
  1280.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1281.                             groupTextDrawData[groupid][i][E_TEXTDRAW_X] += 10.0;
  1282.                             CreateGroupTextDraw(groupid, i);
  1283.                         }
  1284.                     }
  1285.                     else {
  1286.                         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1287.                             groupTextDrawData[groupid][i][E_TEXTDRAW_X] += 0.5;
  1288.                             CreateGroupTextDraw(groupid, i);
  1289.                         }
  1290.                     }
  1291.                 }
  1292.  
  1293.                 case EDITING_POS: {
  1294.                     if (keys == KEY_SPRINT) {
  1295.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X] += 10.0;
  1296.                     }
  1297.                     else {
  1298.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X] += 0.5;
  1299.                     }
  1300.                     CreateGroupTextDraw(groupid, textdrawid);
  1301.                 }
  1302.  
  1303.                 case EDITING_LETTER_SIZE: {
  1304.                     if (keys == KEY_SPRINT) {
  1305.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X] += 1.0;
  1306.                     }
  1307.                     else {
  1308.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X] += 0.1;
  1309.                     }
  1310.  
  1311.                     TextDrawLetterSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y]);
  1312.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1313.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1314.                     }
  1315.                 }
  1316.  
  1317.                 case EDITING_TEXT_SIZE: {
  1318.                     if (keys == KEY_SPRINT) {
  1319.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X] += 10.0;
  1320.                     }
  1321.                     else {
  1322.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X] += 0.5;
  1323.                     }
  1324.  
  1325.                     TextDrawTextSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y]);
  1326.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1327.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1328.                     }
  1329.                 }
  1330.  
  1331.                 case EDITING_PREVIEW_ROT: {
  1332.                     if (keys == KEY_SPRINT) {
  1333.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] += 5.0;
  1334.                     }
  1335.                     else {
  1336.                         groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] += 1.0;
  1337.                     }
  1338.  
  1339.                     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1340.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1341.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1342.                     }
  1343.                 }
  1344.             }
  1345.         }
  1346.        
  1347.         if (showTextDrawCmds) {
  1348.             if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1349.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid],
  1350.                     "~w~EDITOR MODE COMMANDS: (/show)~n~\
  1351.                     ~w~/position~n~\
  1352.                     ~y~/x: ~b~~h~~h~?~n~\
  1353.                     ~y~/y: ~b~~h~~h~?");
  1354.                 return 1;
  1355.             }
  1356.  
  1357.             new previewChars[MAX_GROUP_TEXTDRAW_PREVIEW_CHARS + 4];
  1358.             strmid(previewChars, groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], 0, MAX_GROUP_TEXTDRAW_PREVIEW_CHARS);
  1359.             if (strlen(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT]) > MAX_GROUP_TEXTDRAW_PREVIEW_CHARS) {
  1360.                 strcat(previewChars, "...");
  1361.             }
  1362.  
  1363.             new string[1024];
  1364.             switch (playerEditing[playerid]) {
  1365.                 case EDITING_POS, EDITING_GROUP_POS: {
  1366.                     string = "~w~EDITOR MODE COMMANDS: (/show)~n~\
  1367.                         ~w~/string: \"%s\"~n~\
  1368.                         ~r~~h~~h~/position~n~\
  1369.                         ~r~~h~~h~/x: ~h~%0.4f~n~\
  1370.                         ~r~~h~~h~/y: ~h~%0.4f~n~\
  1371.                         ~w~/lettersize~n~\
  1372.                         ~w~/lx: %0.4f~n~\
  1373.                         ~w~/ly: %0.4f~n~\
  1374.                         ~w~/textsize~n~\
  1375.                         ~w~/tx: %0.4f~n~\
  1376.                         ~w~/ty: %0.4f~n~\
  1377.                         ~w~/rotation~n~\
  1378.                         ~w~/rx: %0.4f~n~\
  1379.                         ~w~/ry: %0.4f~n~\
  1380.                         ~w~/rz: %0.4f~n~\
  1381.                         ~w~/zoom: %0.4f~n~\
  1382.                         ~w~/shadow: %i~n~\
  1383.                         ~w~/outline: %i";
  1384.                 }
  1385.                
  1386.                 case EDITING_LETTER_SIZE: {
  1387.                     string = "~w~EDITOR MODE COMMANDS: (/show)~n~\
  1388.                         ~w~/string: \"%s\"~n~\
  1389.                         ~w~/position~n~\
  1390.                         ~w~/x: %0.4f~n~\
  1391.                         ~w~/y: %0.4f~n~\
  1392.                         ~r~~h~~h~/lettersize~n~\
  1393.                         ~r~~h~~h~/lx: ~h~%0.4f~n~\
  1394.                         ~r~~h~~h~/ly: ~h~%0.4f~n~\
  1395.                         ~w~/textsize~n~\
  1396.                         ~w~/tx: %0.4f~n~\
  1397.                         ~w~/ty: %0.4f~n~\
  1398.                         ~w~/rotation~n~\
  1399.                         ~w~/rx: %0.4f~n~\
  1400.                         ~w~/ry: %0.4f~n~\
  1401.                         ~w~/rz: %0.4f~n~\
  1402.                         ~w~/zoom: %0.4f~n~\
  1403.                         ~w~/shadow: %i~n~\
  1404.                         ~w~/outline: %i";
  1405.                 }
  1406.                
  1407.                 case EDITING_TEXT_SIZE: {
  1408.                     string = "~w~EDITOR MODE COMMANDS: (/show)~n~\
  1409.                         ~w~/string: \"%s\"~n~\
  1410.                         ~w~/position~n~\
  1411.                         ~w~/x: %0.4f~n~\
  1412.                         ~w~/y: %0.4f~n~\
  1413.                         ~w~/lettersize~n~\
  1414.                         ~w~/lx: %0.4f~n~\
  1415.                         ~w~/ly: %0.4f~n~\
  1416.                         ~r~~h~~h~/textsize~n~\
  1417.                         ~r~~h~~h~/tx: ~h~%0.4f~n~\
  1418.                         ~r~~h~~h~/ty: ~h~%0.4f~n~\
  1419.                         ~w~/rotation~n~\
  1420.                         ~w~/rx: %0.4f~n~\
  1421.                         ~w~/ry: %0.4f~n~\
  1422.                         ~w~/rz: %0.4f~n~\
  1423.                         ~w~/zoom: %0.4f~n~\
  1424.                         ~w~/shadow: %i~n~\
  1425.                         ~w~/outline: %i";
  1426.                 }
  1427.                
  1428.                 case EDITING_PREVIEW_ROT: {
  1429.                     string = "~w~EDITOR MODE COMMANDS: (/show)~n~\
  1430.                         ~w~/string: \"%s\"~n~\
  1431.                         ~w~/position~n~\
  1432.                         ~w~/x: %0.4f~n~\
  1433.                         ~w~/y: %0.4f~n~\
  1434.                         ~w~/lettersize~n~\
  1435.                         ~w~/lx: %0.4f~n~\
  1436.                         ~w~/ly: %0.4f~n~\
  1437.                         ~w~/textsize~n~\
  1438.                         ~w~/tx: %0.4f~n~\
  1439.                         ~w~/ty: %0.4f~n~\
  1440.                         ~r~~h~~h~/rotation~n~\
  1441.                         ~r~~h~~h~/rx: ~h~%0.4f~n~\
  1442.                         ~r~~h~~h~/ry: ~h~%0.4f~n~\
  1443.                         ~r~~h~~h~/rz: ~h~%0.4f~n~\
  1444.                         ~r~~h~~h~/zoom: ~h~%0.4f~n~\
  1445.                         ~w~/shadow: %i~n~\
  1446.                         ~w~/outline: %i";
  1447.                 }
  1448.                
  1449.                 case EDITING_SHADOW_SIZE: {
  1450.                     string = "~w~EDITOR MODE COMMANDS: (/show)~n~\
  1451.                         ~w~/string: \"%s\"~n~\
  1452.                         ~w~/position~n~\
  1453.                         ~w~/x: %0.4f~n~\
  1454.                         ~w~/y: %0.4f~n~\
  1455.                         ~w~/lettersize~n~\
  1456.                         ~w~/lx: %0.4f~n~\
  1457.                         ~w~/ly: %0.4f~n~\
  1458.                         ~w~/textsize~n~\
  1459.                         ~w~/tx: %0.4f~n~\
  1460.                         ~w~/ty: %0.4f~n~\
  1461.                         ~w~/rotation~n~\
  1462.                         ~w~/rx: %0.4f~n~\
  1463.                         ~w~/ry: %0.4f~n~\
  1464.                         ~w~/rz: %0.4f~n~\
  1465.                         ~w~/zoom: %0.4f~n~\
  1466.                         ~r~~h~~h~/shadow: ~h~%i~n~\
  1467.                         ~w~/outline: %i";
  1468.                 }
  1469.                
  1470.                 case EDITING_OUTLINE_SIZE: {
  1471.                     string = "~w~EDITOR MODE COMMANDS: (/show)~n~\
  1472.                         ~w~/string: \"%s\"~n~\
  1473.                         ~w~/position~n~\
  1474.                         ~w~/x: %0.4f~n~\
  1475.                         ~w~/y: %0.4f~n~\
  1476.                         ~w~/lettersize~n~\
  1477.                         ~w~/lx: %0.4f~n~\
  1478.                         ~w~/ly: %0.4f~n~\
  1479.                         ~w~/textsize~n~\
  1480.                         ~w~/tx: %0.4f~n~\
  1481.                         ~w~/ty: %0.4f~n~\
  1482.                         ~w~/rotation~n~\
  1483.                         ~w~/rx: %0.4f~n~\
  1484.                         ~w~/ry: %0.4f~n~\
  1485.                         ~w~/rz: %0.4f~n~\
  1486.                         ~w~/zoom: %0.4f~n~\
  1487.                         ~w~/shadow: %i~n~\
  1488.                         ~r~~h~~h~/outline: ~h~%i";
  1489.                 }
  1490.             }
  1491.            
  1492.             format(string, sizeof (string), string,
  1493.             previewChars,
  1494.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y],
  1495.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y],
  1496.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y],
  1497.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM],
  1498.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW],
  1499.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE]);
  1500.  
  1501.             PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], string);
  1502.         }
  1503.     }
  1504.     return 1;
  1505. }
  1506.  
  1507. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  1508.     if (playerEditing[playerid] != EDITING_NONE) {
  1509.         if (newkeys == KEY_SECONDARY_ATTACK) {
  1510.             PlayerTextDrawHide(playerid, playerEditingTextDraw[playerid]);
  1511.            
  1512.             TogglePlayerControllable(playerid, true);
  1513.  
  1514.             playerEditing[playerid] = EDITING_NONE;
  1515.             KillTimer(playerEditingTimer[playerid]);
  1516.             playerEditingTimer[playerid] = -1;
  1517.  
  1518.             if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1519.                 SetTimerEx("ShowPlayerGroupDialog", 150, false, "ii", playerid, playerCurrentGroup[playerid]);
  1520.             }
  1521.             else {
  1522.                 SetTimerEx("ShowPlayerTextDrawDialog", 150, false, "ii", playerid, playerCurrentTextDraw[playerid]);
  1523.             }
  1524.         }
  1525.     }
  1526.     return 1;
  1527. }
  1528.  
  1529. CMD:x(playerid, params[]) {
  1530.     if (playerEditing[playerid] == EDITING_NONE) {
  1531.         return 1;
  1532.     }
  1533.  
  1534.     new Float:value;
  1535.     if (sscanf(params, "%f", value)) {
  1536.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /x [value]");
  1537.     }
  1538.  
  1539.     new groupid = playerCurrentGroup[playerid];
  1540.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1541.         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1542.             groupTextDrawData[groupid][i][E_TEXTDRAW_X] = value;
  1543.             CreateGroupTextDraw(groupid, i);
  1544.         }
  1545.         return 1;
  1546.     }
  1547.  
  1548.     new textdrawid = playerCurrentTextDraw[playerid];
  1549.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X] = value;
  1550.     CreateGroupTextDraw(groupid, textdrawid);
  1551.     return 1;
  1552. }
  1553.  
  1554. CMD:y(playerid, params[]) {
  1555.     if (playerEditing[playerid] == EDITING_NONE) {
  1556.         return 1;
  1557.     }
  1558.  
  1559.     new Float:value;
  1560.     if (sscanf(params, "%f", value)) {
  1561.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /y [value]");
  1562.     }
  1563.  
  1564.     new groupid = playerCurrentGroup[playerid];
  1565.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1566.         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  1567.             groupTextDrawData[groupid][i][E_TEXTDRAW_Y] = value;
  1568.             CreateGroupTextDraw(groupid, i);
  1569.         }
  1570.         return 1;
  1571.     }
  1572.  
  1573.     new textdrawid = playerCurrentTextDraw[playerid];
  1574.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y] = value;
  1575.     CreateGroupTextDraw(groupid, textdrawid);
  1576.     return 1;
  1577. }
  1578.  
  1579. CMD:lx(playerid, params[]) {
  1580.     if (playerEditing[playerid] == EDITING_NONE) {
  1581.         return 1;
  1582.     }
  1583.  
  1584.     new Float:value;
  1585.     if (sscanf(params, "%f", value)) {
  1586.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /lx [value]");
  1587.     }
  1588.  
  1589.     new groupid = playerCurrentGroup[playerid];
  1590.     new textdrawid = playerCurrentTextDraw[playerid];
  1591.  
  1592.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X] = value;
  1593.     TextDrawLetterSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y]);
  1594.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1595.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1596.     }
  1597.     return 1;
  1598. }
  1599.  
  1600. CMD:ly(playerid, params[]) {
  1601.     if (playerEditing[playerid] == EDITING_NONE) {
  1602.         return 1;
  1603.     }
  1604.  
  1605.     new Float:value;
  1606.     if (sscanf(params, "%f", value)) {
  1607.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /ly [value]");
  1608.     }
  1609.  
  1610.     new groupid = playerCurrentGroup[playerid];
  1611.     new textdrawid = playerCurrentTextDraw[playerid];
  1612.  
  1613.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y] = value;
  1614.     TextDrawLetterSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y]);
  1615.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1616.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1617.     }
  1618.     return 1;
  1619. }
  1620.  
  1621. CMD:tx(playerid, params[]) {
  1622.     if (playerEditing[playerid] == EDITING_NONE) {
  1623.         return 1;
  1624.     }
  1625.  
  1626.     new Float:value;
  1627.     if (sscanf(params, "%f", value)) {
  1628.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /tx [value]");
  1629.     }
  1630.  
  1631.     new groupid = playerCurrentGroup[playerid];
  1632.     new textdrawid = playerCurrentTextDraw[playerid];
  1633.  
  1634.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X] = value;
  1635.     TextDrawTextSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y]);
  1636.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1637.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1638.     }
  1639.     return 1;
  1640. }
  1641.  
  1642. CMD:ty(playerid, params[]) {
  1643.     if (playerEditing[playerid] == EDITING_NONE) {
  1644.         return 1;
  1645.     }
  1646.  
  1647.     new Float:value;
  1648.     if (sscanf(params, "%f", value)) {
  1649.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /ty [value]");
  1650.     }
  1651.  
  1652.     new groupid = playerCurrentGroup[playerid];
  1653.     new textdrawid = playerCurrentTextDraw[playerid];
  1654.  
  1655.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y] = value;
  1656.     TextDrawTextSize(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y]);
  1657.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1658.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1659.     }
  1660.     return 1;
  1661. }
  1662.  
  1663. CMD:rx(playerid, params[]) {
  1664.     if (playerEditing[playerid] == EDITING_NONE) {
  1665.         return 1;
  1666.     }
  1667.  
  1668.     new Float:value;
  1669.     if (sscanf(params, "%f", value)) {
  1670.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /rx [value]");
  1671.     }
  1672.  
  1673.     new groupid = playerCurrentGroup[playerid];
  1674.     new textdrawid = playerCurrentTextDraw[playerid];
  1675.  
  1676.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] = value;
  1677.     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1678.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1679.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1680.     }
  1681.     return 1;
  1682. }
  1683.  
  1684. CMD:ry(playerid, params[]) {
  1685.     if (playerEditing[playerid] == EDITING_NONE) {
  1686.         return 1;
  1687.     }
  1688.  
  1689.     new Float:value;
  1690.     if (sscanf(params, "%f", value)) {
  1691.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /ry [value]");
  1692.     }
  1693.  
  1694.     new groupid = playerCurrentGroup[playerid];
  1695.     new textdrawid = playerCurrentTextDraw[playerid];
  1696.  
  1697.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] = value;
  1698.     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1699.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1700.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1701.     }
  1702.     return 1;
  1703. }
  1704.  
  1705. CMD:rz(playerid, params[]) {
  1706.     if (playerEditing[playerid] == EDITING_NONE) {
  1707.         return 1;
  1708.     }
  1709.  
  1710.     new Float:value;
  1711.     if (sscanf(params, "%f", value)) {
  1712.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /rz [value]");
  1713.     }
  1714.  
  1715.     new groupid = playerCurrentGroup[playerid];
  1716.     new textdrawid = playerCurrentTextDraw[playerid];
  1717.  
  1718.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z] = value;
  1719.     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1720.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1721.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1722.     }
  1723.     return 1;
  1724. }
  1725.  
  1726. CMD:zoom(playerid, params[]) {
  1727.     if (playerEditing[playerid] == EDITING_NONE) {
  1728.         return 1;
  1729.     }
  1730.  
  1731.     new Float:value;
  1732.     if (sscanf(params, "%f", value)) {
  1733.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /zoom [value]");
  1734.     }
  1735.  
  1736.     new groupid = playerCurrentGroup[playerid];
  1737.     new textdrawid = playerCurrentTextDraw[playerid];
  1738.  
  1739.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM] = value;
  1740.     TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  1741.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1742.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1743.     }
  1744.     return 1;
  1745. }
  1746.  
  1747. CMD:position(playerid, params[]) {
  1748.     if (playerEditing[playerid] == EDITING_NONE) {
  1749.         return 1;
  1750.     }
  1751.  
  1752.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1753.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You are in Position Editing Mode already.");
  1754.     }
  1755.  
  1756.     playerEditing[playerid] = EDITING_POS;
  1757.     return 1;
  1758. }
  1759.  
  1760. CMD:lettersize(playerid, params[]) {
  1761.     if (playerEditing[playerid] == EDITING_NONE) {
  1762.         return 1;
  1763.     }
  1764.  
  1765.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1766.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot use this command when in Group Position Editing Mode.");
  1767.     }
  1768.  
  1769.     playerEditing[playerid] = EDITING_LETTER_SIZE;
  1770.     return 1;
  1771. }
  1772.  
  1773. CMD:textsize(playerid, params[]) {
  1774.     if (playerEditing[playerid] == EDITING_NONE) {
  1775.         return 1;
  1776.     }
  1777.  
  1778.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1779.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot use this command when in Group Position Editing Mode.");
  1780.     }
  1781.  
  1782.     playerEditing[playerid] = EDITING_TEXT_SIZE;
  1783.     return 1;
  1784. }
  1785.  
  1786. CMD:rotation(playerid, params[]) {
  1787.     if (playerEditing[playerid] == EDITING_NONE) {
  1788.         return 1;
  1789.     }
  1790.  
  1791.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1792.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot use this command when in Group Position Editing Mode.");
  1793.     }
  1794.  
  1795.     playerEditing[playerid] = EDITING_PREVIEW_ROT;
  1796.     return 1;
  1797. }
  1798.  
  1799. CMD:shadow(playerid, params[]) {
  1800.     if (playerEditing[playerid] == EDITING_NONE) {
  1801.         return 1;
  1802.     }
  1803.  
  1804.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1805.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot use this command when in Group Position Editing Mode.");
  1806.     }
  1807.  
  1808.     playerEditing[playerid] = EDITING_SHADOW_SIZE;
  1809.     return 1;
  1810. }
  1811.  
  1812. CMD:outline(playerid, params[]) {
  1813.     if (playerEditing[playerid] == EDITING_NONE) {
  1814.         return 1;
  1815.     }
  1816.  
  1817.     if (playerEditing[playerid] == EDITING_GROUP_POS) {
  1818.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot use this command when in Group Position Editing Mode.");
  1819.     }
  1820.  
  1821.     playerEditing[playerid] = EDITING_OUTLINE_SIZE;
  1822.     return 1;
  1823. }
  1824.  
  1825. CMD:string(playerid, params[]) {
  1826.     if (playerEditing[playerid] == EDITING_NONE) {
  1827.         return 1;
  1828.     }
  1829.  
  1830.     new string[MAX_GROUP_TEXTDRAW_TEXT];
  1831.     if (sscanf(params, "%s["#MAX_GROUP_TEXTDRAW_TEXT"]", string)) {
  1832.         return SendClientMessage(playerid, MESSAGE_COLOR, "Usage: /string [text]");
  1833.     }
  1834.  
  1835.     new groupid = playerCurrentGroup[playerid];
  1836.     new textdrawid = playerCurrentTextDraw[playerid];
  1837.    
  1838.     format(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], MAX_GROUP_TEXTDRAW_TEXT, string);
  1839.  
  1840.     TextDrawSetString(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], string);
  1841.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  1842.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  1843.     }
  1844.     return 1;
  1845. }
  1846.  
  1847. CMD:show(playerid) {
  1848.     if (playerEditing[playerid] == EDITING_NONE) {
  1849.         return 1;
  1850.     }
  1851.    
  1852.     if (showTextDrawCmds) {
  1853.         PlayerTextDrawHide(playerid, playerEditingTextDraw[playerid]);
  1854.     }
  1855.     else {
  1856.         PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  1857.     }
  1858.     showTextDrawCmds = !showTextDrawCmds;
  1859.     return 1;
  1860. }
  1861.  
  1862. CMD:text(playerid) {
  1863.     if (playerEditing[playerid] != EDITING_NONE) {
  1864.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You can't open editor menu while editing.");
  1865.     }
  1866.    
  1867.     if (!projectDB) {
  1868.         return Dialog_Show(playerid, MAIN_MENU, DIALOG_STYLE_TABLIST, "TDEditor: Main menu", ""COL_GREEN"New Project\t"COL_GREY"Create an empty GUI project\n"COL_YELLOW"Load Project\t"COL_GREY"Load a project from scriptfiles folder (Plug'n'Play)\n"COL_YELLOW"Delete Project\t"COL_GREY"Delete a project from scriptfiles folder","Select", "Close");
  1869.     }
  1870.  
  1871.     static string[512 + (MAX_GROUPS * (MAX_GROUP_NAME + 32))];
  1872.     string = ""COL_GREEN"Create New Group\t"COL_GREY"Add an empty group where you can add textdraws later (max groups you can add: "#MAX_GROUPS")\n\
  1873.         "COL_YELLOW"Export project\t"COL_GREY"You can export the whole project as a .pwn file or you can also choose to export certain groups\n\
  1874.         "COL_RED"Close Project\t"COL_GREY"Close the current project and go back to Main Menu\n";
  1875.  
  1876.     for (new i; i < groupsCount; i++) {
  1877.         format(string, sizeof (string), "%sGroup #%i: '%s'\t"COL_GREY"%i textdraws\n", string, i, groupData[i][E_GROUP_NAME], groupData[i][E_GROUP_TEXTDRAWS_COUNT]);
  1878.     }
  1879.  
  1880.     Dialog_Show(playerid, EDITOR_MENU, DIALOG_STYLE_TABLIST, "TDEditor: Editor menu", string, "Select", "Close");
  1881.     return 1;
  1882. }
  1883.  
  1884. Dialog:MAIN_MENU(playerid, response, listitem, inputtext[]) {
  1885.     if (!response) {
  1886.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Edtior closed.");
  1887.     }
  1888.  
  1889.     switch (listitem) {
  1890.         case 0: {
  1891.             Dialog_Show(playerid, NEW_PROJECT, DIALOG_STYLE_INPUT, "TDEditor: New project", ""COL_WHITE"Insert a "COL_GREEN"PROJECT-NAME"COL_WHITE" below to create.\n\n"COL_GREY"The project will be saved as a \".db\" file. Each project gets its\n"COL_GREY"own database file so its easy to manage and even share!", "Create", "Back");
  1892.         }
  1893.  
  1894.         case 1, 2: {
  1895.             new Dini:h = dini_open(PATH_RECORD_FILE, 0);
  1896.             new numFields = dini_num_fields(h);
  1897.            
  1898.             if (numFields == 0) {
  1899.                 dini_close(h);
  1900.                
  1901.                 if (listitem == 1) {
  1902.                     return Dialog_Show(playerid, LOAD_PROJECT, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Load project", "File\tDate created\n"COL_RED"null\t"COL_RED"null", "Load", "Back");
  1903.                 }
  1904.                 else {
  1905.                     return Dialog_Show(playerid, DELETE_PROJECT, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Delete project", "File\tDate created\n"COL_RED"null\t"COL_RED"null", "Delete", "Back");
  1906.                 }
  1907.             }
  1908.  
  1909.             new count;
  1910.             static string[MAX_PROJECTS * (MAX_PROJECT_NAME + 16 + 2)];
  1911.             new field[DINI_MAX_FIELD_NAME];
  1912.             new value[DINI_MAX_FIELD_VALUE];
  1913.            
  1914.             string = "File\tDate Created\n";
  1915.             for (new i; i < numFields; i++) {
  1916.                 if (++count == MAX_PROJECTS) {
  1917.                     SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Maximum projects limit is set to "#MAX_PROJECTS", and the limit has reached. There might be more projects which are not listed in the dialog.");
  1918.                     break;
  1919.                 }
  1920.  
  1921.                 dini_get_field_name(h, i, field);
  1922.                 dini_get(h, i, value);
  1923.                 format(string, sizeof (string), "%s%s\t%s\n", string, field, value);
  1924.             }
  1925.  
  1926.             dini_close(h);
  1927.  
  1928.             if (count == 0) {
  1929.                 if (listitem == 1) {
  1930.                     return Dialog_Show(playerid, LOAD_PROJECT, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Load project", "File\tDate created\n"COL_RED"null\t"COL_RED"null", "Load", "Back");
  1931.                 }
  1932.                 else {
  1933.                     return Dialog_Show(playerid, DELETE_PROJECT, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Delete project", "File\tDate created\n"COL_RED"null\t"COL_RED"null", "Delete", "Back");
  1934.                 }
  1935.             }
  1936.  
  1937.             if (listitem == 1) {
  1938.                 return Dialog_Show(playerid, LOAD_PROJECT, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Load project", string, "Load", "Back");
  1939.             }
  1940.             else {
  1941.                 return Dialog_Show(playerid, DELETE_PROJECT, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Delete project", string, "Delete", "Back");
  1942.             }
  1943.         }
  1944.     }
  1945.     return 1;
  1946. }
  1947.  
  1948. Dialog:NEW_PROJECT(playerid, response, listitem, inputtext[]) {
  1949.     if (!response) {
  1950.         return cmd_text(playerid);
  1951.     }
  1952.  
  1953.     new name[MAX_PROJECT_NAME + 3];
  1954.     if (sscanf(inputtext, "%s["#MAX_PROJECT_NAME"]", name)) {
  1955.         return Dialog_Show(playerid, NEW_PROJECT, DIALOG_STYLE_INPUT, "TDEditor: New project", ""COL_WHITE"Insert a "COL_GREEN"PROJECT-NAME"COL_WHITE" below to create.\n\n"COL_GREY"The project will be saved as a \".db\" file. Each project gets its\n"COL_GREY"own database file so its easy to manage and even share!\n\n"COL_RED"Error: "COL_GREY"The project name cannot be empty or spaces.", "Create", "Back");
  1956.     }
  1957.  
  1958.     new pos = strfind(name, ".db", true);
  1959.     if (pos == -1) {
  1960.         strcat(name, ".db");
  1961.     }
  1962.    
  1963.     new Dini:h = dini_open(PATH_RECORD_FILE, 0);
  1964.    
  1965.     if (dini_get_field_id(h, name) != -1 || fexist(name)) {
  1966.         dini_close(h);
  1967.         return Dialog_Show(playerid, NEW_PROJECT, DIALOG_STYLE_INPUT, "TDEditor: New project", ""COL_WHITE"Insert a "COL_GREEN"PROJECT-NAME"COL_WHITE" below to create.\n\n"COL_GREY"The project will be saved as a \".db\" file. Each project gets its\n"COL_GREY"own database file so its easy to manage and even share!\n\n"COL_RED"Error: "COL_GREY"The project name already exists. Try something else or you can continue your work by loading that project instead!", "Create", "Back");
  1968.     }
  1969.  
  1970.     if (!strcmp(inputtext, "null", true)) {
  1971.         dini_close(h);
  1972.         return Dialog_Show(playerid, NEW_PROJECT, DIALOG_STYLE_INPUT, "TDEditor: New project", ""COL_WHITE"Insert a "COL_GREEN"PROJECT-NAME"COL_WHITE" below to create.\n\n"COL_GREY"The project will be saved as a \".db\" file. Each project gets its\n"COL_GREY"own database file so its easy to manage and even share!\n\n"COL_RED"Error: "COL_GREY"The project name cannot be \"null\"!", "Create", "Back");
  1973.     }
  1974.  
  1975.     format(projectName, MAX_PROJECT_NAME, name);
  1976.     pos = strfind(projectName, ".db", true);
  1977.     if (pos != -1) {
  1978.         strdel(projectName, pos, (pos + strlen(".db")));
  1979.     }
  1980.  
  1981.     new string[150] = PATH_PROJECT_FILES;
  1982.     strcat(string, name);
  1983.     projectDB = db_open(string);
  1984.     if (!projectDB) {
  1985.         return Dialog_Show(playerid, NEW_PROJECT, DIALOG_STYLE_INPUT, "TDEditor: New project", ""COL_WHITE"Insert a "COL_GREEN"PROJECT-NAME"COL_WHITE" below to create.\n\n"COL_GREY"The project will be saved as a \".db\" file. Each project gets its\n"COL_GREY"own database file so its easy to manage and even share!\n\n"COL_RED"Error: "COL_GREY"Something went wrong! Try again or check your project name for invalid characters!", "Create", "Back");
  1986.     }
  1987.     db_query(projectDB, "PRAGMA synchronous = NORMAL");
  1988.     db_query(projectDB, "PRAGMA journal_mode = WAL");
  1989.  
  1990.     format(string, sizeof (string), "TDEditor: A new project has been created \"%s\". Start editing!", name);
  1991.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  1992.  
  1993.     if (!dini_set_assoc(h, name, ReturnDate(gettime()))) {
  1994.         SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: System couldn't open record file so your project name might not arrive on Loading dialog, but you project database is fine!");
  1995.     }
  1996.  
  1997.     dini_close(h);
  1998.    
  1999.     return cmd_text(playerid);
  2000. }
  2001.  
  2002. Dialog:LOAD_PROJECT(playerid, response, listitem, inputtext[]) {
  2003.     if (!response) {
  2004.         return cmd_text(playerid);
  2005.     }
  2006.  
  2007.     if (!strcmp(inputtext, "null", true)) {
  2008.         return dialog_MAIN_MENU(playerid, 1, 1, "\1");
  2009.     }
  2010.  
  2011.     new string[256] = PATH_PROJECT_FILES;
  2012.     strcat(string, inputtext);
  2013.     projectDB = db_open(string);
  2014.     if (!projectDB) {
  2015.         SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Couldn't load project file. Try again!");
  2016.         return dialog_MAIN_MENU(playerid, 1, 1, "\1");
  2017.     }
  2018.     db_query(projectDB, "PRAGMA synchronous = NORMAL");
  2019.     db_query(projectDB, "PRAGMA journal_mode = WAL");
  2020.  
  2021.     format(projectName, MAX_PROJECT_NAME, inputtext);
  2022.     new pos = strfind(projectName, ".db", true);
  2023.     strdel(projectName, pos, (pos + strlen(".db")));
  2024.    
  2025.     new DBResult:result = db_query(projectDB, "SELECT name FROM sqlite_master WHERE type = 'table'");
  2026.     if (db_num_rows(result) > 0) {
  2027.         new DBResult:result2;
  2028.         new textdrawid;
  2029.        
  2030.         do {
  2031.             if (groupsCount == MAX_GROUPS) {
  2032.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Only first \""#MAX_GROUPS"\" groups were loaded. If there are more than that in your database, you have to change the limit in script(MAX_GROUPS) and recompile.");
  2033.                 break;
  2034.             }
  2035.            
  2036.             db_get_field(result, 0, groupData[groupsCount][E_GROUP_NAME], MAX_GROUP_NAME);
  2037.  
  2038.             groupData[groupsCount][E_GROUP_TEXTDRAWS_COUNT] = 0;
  2039.             groupData[groupsCount][E_GROUP_VISIBLE] = true;
  2040.            
  2041.             format(string, sizeof (string), "SELECT * FROM %s", groupData[groupsCount][E_GROUP_NAME]);
  2042.             result2 = db_query(projectDB, string);
  2043.             if (result2) {
  2044.                 if (db_num_rows(result2) > 0) {
  2045.                     do {
  2046.                         if (groupData[groupsCount][E_GROUP_TEXTDRAWS_COUNT] == MAX_GROUP_TEXTDRAWS) {
  2047.                             SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Only first \""#MAX_GROUP_TEXTDRAWS"\" textdraws were loaded for group. If there are more than that in your database, you have to change the limit in script(MAX_GROUP_TEXTDRAWS) and recompile.");
  2048.                             break;
  2049.                         }
  2050.  
  2051.                         textdrawid = groupData[groupsCount][E_GROUP_TEXTDRAWS_COUNT]++;
  2052.  
  2053.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_SQLID] = db_get_field_assoc_int(result2, "id");
  2054.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_ID] = Text:INVALID_TEXT_DRAW;
  2055.                         db_get_field_assoc(result2, "text", groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_TEXT], MAX_GROUP_TEXTDRAW_TEXT);
  2056.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_X] = db_get_field_assoc_float(result2, "x");
  2057.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_Y] = db_get_field_assoc_float(result2, "y");
  2058.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_LETTERSIZE_X] = db_get_field_assoc_float(result2, "letter_x");
  2059.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_LETTERSIZE_Y] = db_get_field_assoc_float(result2, "letter_y");
  2060.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_TEXTSIZE_X] = db_get_field_assoc_float(result2, "text_x");
  2061.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_TEXTSIZE_Y] = db_get_field_assoc_float(result2, "text_y");
  2062.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_ALIGNMENT] = db_get_field_assoc_int(result2, "alignment");
  2063.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_COLOR] = db_get_field_assoc_int(result2, "color");
  2064.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_USE_BOX] = bool:db_get_field_assoc_int(result2, "usebox");
  2065.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_BOX_COLOR] = db_get_field_assoc_int(result2, "box_color");
  2066.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_SHADOW] = db_get_field_assoc_int(result2, "shadow");
  2067.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_OUTLINE] = db_get_field_assoc_int(result2, "outline");
  2068.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] = db_get_field_assoc_int(result2, "background_color");
  2069.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_FONT] = db_get_field_assoc_int(result2, "font");
  2070.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PROPORTIONAL] = bool:db_get_field_assoc_int(result2, "proportional");
  2071.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_SELECTABLE] = bool:db_get_field_assoc_int(result2, "selectable");
  2072.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PREVIEW_MODEL] = db_get_field_assoc_int(result2, "preview_model");
  2073.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] = db_get_field_assoc_float(result2, "rot_x");
  2074.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] = db_get_field_assoc_float(result2, "rot_y");
  2075.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z] = db_get_field_assoc_float(result2, "rot_z");
  2076.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM] = db_get_field_assoc_float(result2, "rot_zoom");
  2077.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR1] = db_get_field_assoc_int(result2, "veh_color1");
  2078.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR2] = db_get_field_assoc_int(result2, "veh_color2");
  2079.                         groupTextDrawData[groupsCount][textdrawid][E_TEXTDRAW_TYPE_PLAYER] = bool:db_get_field_assoc_int(result2, "type_player");
  2080.  
  2081.                         CreateGroupTextDraw(groupsCount, textdrawid);
  2082.                     }
  2083.                     while (db_next_row(result2));
  2084.                 }
  2085.                 db_free_result(result2);
  2086.             }
  2087.            
  2088.             groupsCount++;
  2089.         }
  2090.         while (db_next_row(result));
  2091.         db_free_result(result);
  2092.     }
  2093.    
  2094.     format(string, sizeof (string), "TDEditor: Loaded project \"%s\". Start editing!", inputtext);
  2095.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  2096.  
  2097.     return cmd_text(playerid);
  2098. }
  2099.  
  2100. Dialog:DELETE_PROJECT(playerid, response, listitem, inputtext[]) {
  2101.     if (!response) {
  2102.         return cmd_text(playerid);
  2103.     }
  2104.  
  2105.     if (!strcmp(inputtext, "null", true)) {
  2106.         return dialog_MAIN_MENU(playerid, 1, 1, "\1");
  2107.     }
  2108.  
  2109.     format(projectName, MAX_PROJECT_NAME, inputtext);
  2110.  
  2111.     new string[512];
  2112.     format(string, sizeof (string), ""COL_WHITE"Are you sure you want the delete this "COL_ORANGE"PROJECT"COL_WHITE"?\n\n"COL_RED"Project Name:\t"COL_GREY"%s\n\n"COL_GREY"Note: Deleting a project will erase the project permanently from scriptfiles folder. No recovey!", inputtext);
  2113.     return Dialog_Show(playerid, CONFIRM_DELETE_PROJECT, DIALOG_STYLE_MSGBOX, "TDEditor: Confirm delete project", string, "Yes", "No");
  2114. }
  2115.  
  2116. Dialog:CONFIRM_DELETE_PROJECT(playerid, response, listitem, inputtext[]) {
  2117.     if (!response) {
  2118.         return dialog_MAIN_MENU(playerid, 1, 2, "\1");
  2119.     }
  2120.  
  2121.     fremove(projectName);
  2122.    
  2123.     new Dini:h = dini_open(PATH_RECORD_FILE, 0);
  2124.     if (!dini_remove_field_id(h, dini_get_field_id(h, projectName))) {
  2125.         SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: System couldn't open record file so your project name might still be there in loading/deleteing dialog, but you project database has been deleted!");
  2126.     }
  2127.     dini_close(h);
  2128.  
  2129.     new string[150];
  2130.     format(string, sizeof (string), "TDEditor: Deleted project \"%s\".", projectName);
  2131.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  2132.  
  2133.     return dialog_MAIN_MENU(playerid, 1, 2, "\1");
  2134. }
  2135.  
  2136. Dialog:EDITOR_MENU(playerid, response, listitem, inputtext[]) {
  2137. //    #pragma warning disable 238
  2138.     if (!response) {
  2139.         return SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Edtior closed.");
  2140.     }
  2141.  
  2142.     switch (listitem) {
  2143.         case 0: {
  2144.             if (groupsCount == MAX_GROUPS) {
  2145.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot add more than \""#MAX_GROUPS"\" groups. Change the limit in script(MAX_GROUPS) and recompile to be able to add more.");
  2146.                 return cmd_text(playerid);
  2147.             }
  2148.  
  2149.             return Dialog_Show(playerid, NEW_GROUP, DIALOG_STYLE_INPUT, "TDEditor: Create new group", ""COL_WHITE"Insert a textdraw "COL_GREEN"GROUP-NAME"COL_WHITE" below to create.\n\n"COL_GREY"What is a textdraw group?\n"COL_GREY"A textdraw group is a pack of textdraws made together to serve a purpose; e.g. a group with name\n'button' with textdraws made as a button in it. Later you can duplicate the group, move the whole textdraws in group, etc.", "Create", "Back");
  2150.         }
  2151.  
  2152.         case 1: {
  2153.             new name[MAX_PROJECT_NAME * 2] = PATH_EXPORT_FILES;
  2154.             strcat(name, projectName);
  2155.             strcat(name, ".pwn");
  2156.            
  2157.             if (!ExportProject(name)) {
  2158.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Couldn't create project file. Try again!");
  2159.                 return dialog_EDITOR_MENU(playerid, 1, 1, "\1");
  2160.             }
  2161.  
  2162.             new string[150];
  2163.             format(string, sizeof (string), "TDEditor: Project \"%s\" has been exported to file \"%s\".", projectName, name);
  2164.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2165.            
  2166.             return cmd_text(playerid);
  2167.         }
  2168.  
  2169.         case 2: {
  2170.             OnFilterScriptExit();
  2171.             SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Project saved & closed.");
  2172.             return cmd_text(playerid);
  2173.         }
  2174.  
  2175.         default: {
  2176.             return ShowPlayerGroupDialog(playerid, (listitem - 3));
  2177.         }
  2178.     }
  2179.  
  2180.     return 1;
  2181. }
  2182.  
  2183. Dialog:NEW_GROUP(playerid, response, listitem, inputtext[]) {
  2184.     if (!response) {
  2185.         return cmd_text(playerid);
  2186.     }
  2187.  
  2188.     new name[MAX_GROUP_NAME];
  2189.     if (sscanf(inputtext, "%s["#MAX_GROUP_NAME"]", name)) {
  2190.         return Dialog_Show(playerid, NEW_GROUP, DIALOG_STYLE_INPUT, "TDEditor: Create new group",""COL_WHITE"Insert a textdraw "COL_GREEN"GROUP-NAME"COL_WHITE" below to create.\n\n"COL_GREY"What is a textdraw group?\n"COL_GREY"A textdraw group is a pack of textdraws made together to serve a purpose; e.g. a group with name\n'button' with textdraws made as a button in it. Later you can duplicate the group, move the whole textdraws in group, etc.\n\n"COL_RED"Error: "COL_GREY"The group name cannot be empty or spaces.","Create", "Back");
  2191.     }
  2192.  
  2193.     format(groupData[groupsCount][E_GROUP_NAME], MAX_GROUP_NAME, name);
  2194.     groupData[groupsCount][E_GROUP_TEXTDRAWS_COUNT] = 0;
  2195.     groupData[groupsCount][E_GROUP_VISIBLE] = true;
  2196.    
  2197.     new string[1024] = "CREATE TABLE IF NOT EXISTS ";
  2198.     strcat(string, name);
  2199.     strcat(string, " (`id` INTEGER PRIMARY KEY, \
  2200.         `text` VARCHAR("#MAX_GROUP_TEXTDRAW_TEXT"), \
  2201.         `x` FLOAT, \
  2202.         `y` FLOAT, \
  2203.         `letter_x` FLOAT, \
  2204.         `letter_y` FLOAT, \
  2205.         `text_x` FLOAT, \
  2206.         `text_y` FLOAT, \
  2207.         `alignment` INTEGER, \
  2208.         `color` INTEGER, \
  2209.         `usebox` INTEGER, \
  2210.         `box_color` INTEGER, \
  2211.         `shadow` INTEGER, ");
  2212.     strcat(string, "`outline` INTEGER, \
  2213.         `background_color` INTEGER, \
  2214.         `font` INTEGER, \
  2215.         `proportional` INTEGER, \
  2216.         `selectable` INTEGER, \
  2217.         `preview_model` INTEGER, \
  2218.         `rot_x` FLOAT, \
  2219.         `rot_y` FLOAT, \
  2220.         `rot_z` FLOAT, \
  2221.         `rot_zoom` FLOAT, \
  2222.         `veh_color1` INTEGER, \
  2223.         `veh_color2` INTEGER, \
  2224.         `type_player` INTEGER)");
  2225.     db_query(projectDB, string);
  2226.  
  2227.     groupsCount++;
  2228.  
  2229.     format(string, sizeof (string), "TDEditor: A new textdraw group has been added: %s [Group #%i].", name, (groupsCount - 1));
  2230.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  2231.  
  2232.     return cmd_text(playerid);
  2233. }
  2234.  
  2235. Dialog:GROUP_MENU(playerid, response, listitem, inputtext[]) {
  2236.     new groupid = playerCurrentGroup[playerid];
  2237.    
  2238.     if (!response) {
  2239.         new string[1024];
  2240.         for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  2241.             string = "UPDATE %s SET \
  2242.                     text = '%q', \
  2243.                     x = '%f', y = '%f', \
  2244.                     letter_x = '%f', letter_y = '%f', \
  2245.                     text_x = '%f', text_y = '%f', \
  2246.                     alignment = '%i', \
  2247.                     color = '%i', \
  2248.                     usebox = '%i', \
  2249.                     box_color = '%i', \
  2250.                     shadow = '%i', \
  2251.                     outline = '%i', \
  2252.                     background_color = '%i', \
  2253.                     font = '%i', \
  2254.                     proportional = '%i', \
  2255.                     selectable = '%i', \
  2256.                     preview_model = '%i', \
  2257.                     rot_x = '%f', rot_y = '%f', rot_z = '%f', rot_zoom = '%f', \
  2258.                     veh_color1 = '%i', veh_color2 = '%i', \
  2259.                     type_player = '%i' \
  2260.                 WHERE id = '%i'";
  2261.             format(string, sizeof (string), string,
  2262.                 groupData[groupid][E_GROUP_NAME],
  2263.                 groupTextDrawData[groupid][i][E_TEXTDRAW_TEXT],
  2264.                 groupTextDrawData[groupid][i][E_TEXTDRAW_X], groupTextDrawData[groupid][i][E_TEXTDRAW_Y],
  2265.                 groupTextDrawData[groupid][i][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][i][E_TEXTDRAW_LETTERSIZE_Y],
  2266.                 groupTextDrawData[groupid][i][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][i][E_TEXTDRAW_TEXTSIZE_Y],
  2267.                 groupTextDrawData[groupid][i][E_TEXTDRAW_ALIGNMENT],
  2268.                 groupTextDrawData[groupid][i][E_TEXTDRAW_COLOR],
  2269.                 groupTextDrawData[groupid][i][E_TEXTDRAW_USE_BOX],
  2270.                 groupTextDrawData[groupid][i][E_TEXTDRAW_BOX_COLOR],
  2271.                 groupTextDrawData[groupid][i][E_TEXTDRAW_SHADOW],
  2272.                 groupTextDrawData[groupid][i][E_TEXTDRAW_OUTLINE],
  2273.                 groupTextDrawData[groupid][i][E_TEXTDRAW_BACKGROUND_COLOR],
  2274.                 groupTextDrawData[groupid][i][E_TEXTDRAW_FONT],
  2275.                 groupTextDrawData[groupid][i][E_TEXTDRAW_PROPORTIONAL],
  2276.                 groupTextDrawData[groupid][i][E_TEXTDRAW_SELECTABLE],
  2277.                 groupTextDrawData[groupid][i][E_TEXTDRAW_PREVIEW_MODEL],
  2278.                 groupTextDrawData[groupid][i][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][i][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][i][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][i][E_TEXTDRAW_PREVIEW_ROT_ZOOM],
  2279.                 groupTextDrawData[groupid][i][E_TEXTDRAW_PREVIEW_VEH_COLOR1], groupTextDrawData[groupid][i][E_TEXTDRAW_PREVIEW_VEH_COLOR2],
  2280.                 groupTextDrawData[groupid][i][E_TEXTDRAW_TYPE_PLAYER],
  2281.                 groupTextDrawData[groupid][i][E_TEXTDRAW_SQLID]);
  2282.             db_query(projectDB, string);
  2283.         }
  2284.         return cmd_text(playerid);
  2285.     }
  2286.    
  2287.     switch (listitem) {
  2288.         case 0: {
  2289.             if (groupData[groupid][E_GROUP_TEXTDRAWS_COUNT] == MAX_GROUP_TEXTDRAWS) {
  2290.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot add more than \""#MAX_GROUP_TEXTDRAWS"\" textdraws in a group. Change the limit in script(MAX_GROUP_TEXTDRAWS) and recompile to be able to add more.");
  2291.                 return ShowPlayerGroupDialog(playerid, groupid);
  2292.             }
  2293.  
  2294.             new textdrawid = groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]++;
  2295.  
  2296.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID] = Text:INVALID_TEXT_DRAW;
  2297.             format(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], MAX_GROUP_TEXTDRAW_TEXT, "New TextDraw");
  2298.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X] = 250.0;
  2299.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y] = 10.0;
  2300.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X] = 0.5;
  2301.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y] = 1.0;
  2302.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X] = 0.0;
  2303.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y] = 0.0;
  2304.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ALIGNMENT] = 1;
  2305.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR] = 0xFFFFFFFF;
  2306.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_USE_BOX] = false;
  2307.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR] = 0x000000FF;
  2308.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW] = 0;
  2309.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE] = 0;
  2310.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] = 0x000000FF;
  2311.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_FONT] = 1;
  2312.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PROPORTIONAL] = true;
  2313.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SELECTABLE] = false;
  2314.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_MODEL] = 0;
  2315.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] = 0.0;
  2316.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] = 0.0;
  2317.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z] = 0.0;
  2318.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM] = 1.0;
  2319.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR1] = -1;
  2320.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR2] = -1;
  2321.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TYPE_PLAYER] = false;
  2322.  
  2323.             CreateGroupTextDraw(groupid, textdrawid);
  2324.  
  2325.             new string[1024] = "INSERT INTO ";
  2326.             strcat(string, groupData[groupid][E_GROUP_NAME]);
  2327.             strcat(string, "(text, x, y, letter_x, letter_y, text_x, text_y, alignment, color, usebox, box_color, shadow, outline, background_color, font, proportional, selectable, preview_model, rot_x, rot_y, rot_z, rot_zoom, veh_color1, veh_color2, type_player)");
  2328.             strcat(string, "VALUES ('New TextDraw', '250.0', '10.0', '0.5', '1.0', '0.0', '0.0', '1', '-1', '0', '0xFF', '0', '0', '0xFF', '1', '1', '0', '0', '0.0', '0.0', '0.0', '1.0', '-1', '-1', '0')");
  2329.             db_query(projectDB, string);
  2330.            
  2331.             format(string, sizeof (string), "SELECT id FROM %s ORDER BY id DESC LIMIT 1", groupData[groupid][E_GROUP_NAME]);
  2332.             new DBResult:result = db_query(projectDB, string);
  2333.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SQLID] = db_get_field_int(result, 0);
  2334.             db_free_result(result);
  2335.            
  2336.             format(string, sizeof (string), "TDEditor: A new textdraw added: Text #%i [Group: %s].", textdrawid, groupData[groupid][E_GROUP_NAME]);
  2337.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2338.  
  2339.             return ShowPlayerGroupDialog(playerid, groupid);
  2340.         }
  2341.  
  2342.         case 1: {
  2343.             if (groupData[groupid][E_GROUP_TEXTDRAWS_COUNT] == 0) {
  2344.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: There are no textdraws in the group!");
  2345.                 return ShowPlayerGroupDialog(playerid, groupid);
  2346.             }
  2347.            
  2348.             playerEditing[playerid] = EDITING_GROUP_POS;
  2349.             playerEditingTimer[playerid] = SetTimerEx("OnPlayerTimerUpdate", 200, true, "i", playerid);
  2350.             if (showTextDrawCmds) {
  2351.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], "~w~Updating...");
  2352.                 PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  2353.             }
  2354.            
  2355.             TogglePlayerControllable(playerid, false);
  2356.         }
  2357.  
  2358.         case 2: {
  2359.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  2360.                 groupData[groupid][E_GROUP_VISIBLE] = false;
  2361.                 for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  2362.                     TextDrawHideForAll(groupTextDrawData[groupid][i][E_TEXTDRAW_ID]);
  2363.                 }
  2364.  
  2365.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Group textdraws visibility changed to OFF.");
  2366.             }
  2367.             else {
  2368.                 groupData[groupid][E_GROUP_VISIBLE] = true;
  2369.                 for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  2370.                     TextDrawShowForAll(groupTextDrawData[groupid][i][E_TEXTDRAW_ID]);
  2371.                 }
  2372.  
  2373.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: Group textdraws visibility changed to ON.");
  2374.             }
  2375.  
  2376.             return ShowPlayerGroupDialog(playerid, groupid);
  2377.         }
  2378.  
  2379.         case 3: {
  2380.             new string[512];
  2381.             format(string, sizeof (string), ""COL_WHITE"Insert a new textdraw "COL_GREEN"GROUP-NAME"COL_WHITE" you want to call this group as!\n\n"COL_YELLOW"Current Name:\t"COL_WHITE"%s", groupData[groupid][E_GROUP_NAME]);
  2382.             return Dialog_Show(playerid, CHANGE_GROUP_NAME, DIALOG_STYLE_INPUT, "TDEditor: New project", string, "Change", "Back");
  2383.         }
  2384.  
  2385.         case 4: {
  2386.             if (groupsCount == MAX_GROUPS) {
  2387.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot add more than \""#MAX_GROUPS"\" groups. Change the limit in script(MAX_GROUPS) and recompile to be able to add more.");
  2388.                 return ShowPlayerGroupDialog(playerid, groupid);
  2389.             }
  2390.  
  2391.             groupData[groupsCount] = groupData[groupid];
  2392.             format(groupData[groupsCount][E_GROUP_NAME], MAX_GROUP_NAME, "%s_copy", groupData[groupid][E_GROUP_NAME]);
  2393.            
  2394.             new string[1024] = "CREATE TABLE IF NOT EXISTS ";
  2395.             strcat(string, groupData[groupsCount][E_GROUP_NAME]);
  2396.             strcat(string, " (`id` INTEGER PRIMARY KEY, \
  2397.                 `text` VARCHAR("#MAX_GROUP_TEXTDRAW_TEXT"), \
  2398.                 `x` FLOAT, \
  2399.                 `y` FLOAT, \
  2400.                 `letter_x` FLOAT, \
  2401.                 `letter_y` FLOAT, \
  2402.                 `text_x` FLOAT, \
  2403.                 `text_y` FLOAT, \
  2404.                 `alignment` INTEGER, \
  2405.                 `color` INTEGER, \
  2406.                 `usebox` INTEGER, \
  2407.                 `box_color` INTEGER, \
  2408.                 `shadow` INTEGER, ");
  2409.             strcat(string, "`outline` INTEGER, \
  2410.                 `background_color` INTEGER, \
  2411.                 `font` INTEGER, \
  2412.                 `proportional` INTEGER, \
  2413.                 `selectable` INTEGER, \
  2414.                 `preview_model` INTEGER, \
  2415.                 `rot_x` FLOAT, \
  2416.                 `rot_y` FLOAT, \
  2417.                 `rot_z` FLOAT, \
  2418.                 `rot_zoom` FLOAT, \
  2419.                 `veh_color1` INTEGER, \
  2420.                 `veh_color2` INTEGER, \
  2421.                 `type_player` INTEGER)");
  2422.             db_query(projectDB, string);
  2423.            
  2424.             new DBResult:result;
  2425.             for (new i; i < groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]; i++) {
  2426.                 for (new x; E_TEXTDRAW:x < E_TEXTDRAW; x++) {
  2427.                     if (E_TEXTDRAW:x == E_TEXTDRAW_ID || E_TEXTDRAW:x == E_TEXTDRAW_SQLID) {
  2428.                         continue;
  2429.                     }
  2430.                    
  2431.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW:x] = groupTextDrawData[groupid][i][E_TEXTDRAW:x];
  2432.                 }
  2433.                
  2434.                string = "INSERT INTO ";
  2435.                 strcat(string, groupData[groupsCount][E_GROUP_NAME]);
  2436.                 strcat(string, "(text, x, y, letter_x, letter_y, text_x, text_y, alignment, color, usebox, box_color, shadow, outline, background_color, font, proportional, selectable, preview_model, rot_x, rot_y, rot_z, rot_zoom, veh_color1, veh_color2, type_player)");
  2437.                 strcat(string, "VALUES ('%q', '%f', '%f', '%f', '%f', '%f', '%f', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%f', '%f', '%f', '%f', '%i', '%i', '%i')");
  2438.                 format(string, sizeof (string), string,
  2439.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_TEXT],
  2440.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_X], groupTextDrawData[groupsCount][i][E_TEXTDRAW_Y],
  2441.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupsCount][i][E_TEXTDRAW_LETTERSIZE_Y],
  2442.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupsCount][i][E_TEXTDRAW_TEXTSIZE_Y],
  2443.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_ALIGNMENT],
  2444.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_COLOR],
  2445.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_USE_BOX],
  2446.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_BOX_COLOR],
  2447.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_SHADOW],
  2448.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_OUTLINE],
  2449.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_BACKGROUND_COLOR],
  2450.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_FONT],
  2451.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_PROPORTIONAL],
  2452.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_SELECTABLE],
  2453.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_PREVIEW_MODEL],
  2454.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupsCount][i][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupsCount][i][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupsCount][i][E_TEXTDRAW_PREVIEW_ROT_ZOOM],
  2455.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_PREVIEW_VEH_COLOR1], groupTextDrawData[groupsCount][i][E_TEXTDRAW_PREVIEW_VEH_COLOR2],
  2456.                     groupTextDrawData[groupsCount][i][E_TEXTDRAW_TYPE_PLAYER]);
  2457.                 db_query(projectDB, string);
  2458.                
  2459.                 format(string, sizeof (string), "SELECT id FROM %s ORDER BY id DESC LIMIT 1", groupData[groupsCount][E_GROUP_NAME]);
  2460.                 result = db_query(projectDB, string);
  2461.                 groupTextDrawData[groupsCount][i][E_TEXTDRAW_SQLID] = db_get_field_int(result, 0);
  2462.                 db_free_result(result);
  2463.                
  2464.                 groupTextDrawData[groupsCount][i][E_TEXTDRAW_ID] = Text:INVALID_TEXT_DRAW;
  2465.                 CreateGroupTextDraw(groupsCount, i);
  2466.             }
  2467.             groupsCount++;
  2468.            
  2469.  
  2470.             format(string, sizeof (string), "TDEditor: Group '%s' duplicated to '%s_copy'.", groupData[groupid][E_GROUP_NAME], groupData[groupid][E_GROUP_NAME]);
  2471.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2472.             return cmd_text(playerid);
  2473.         }
  2474.  
  2475.         case 5: {
  2476.             new string[512];
  2477.             format(string, sizeof (string), ""COL_WHITE"Are you sure you want the delete this "COL_ORANGE"TEXTDRAW-GROUP"COL_WHITE"?\n\n"COL_RED"Group Name:\t"COL_GREY"%s\n"COL_RED"Textdraws:\t"COL_GREY"%i items\n\n"COL_GREY"Note: Deleting a group will erase the group data/textdraws permanently from scriptfiles folder. No recovey!", groupData[groupid][E_GROUP_NAME], groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]);
  2478.             return Dialog_Show(playerid, CONFIRM_DELETE_GROUP, DIALOG_STYLE_MSGBOX, "TDEditor: Confirm delete group", string, "Yes", "No");
  2479.         }
  2480.  
  2481.         default: {
  2482.             return ShowPlayerTextDrawDialog(playerid, (listitem - 6));
  2483.         }
  2484.     }
  2485.     return 1;
  2486. }
  2487.  
  2488. Dialog:CONFIRM_DELETE_GROUP(playerid, response, listitem, inputtext[]) {
  2489.     if (!response) {
  2490.         return ShowPlayerGroupDialog(playerid, playerCurrentGroup[playerid]);
  2491.     }
  2492.  
  2493.     new groupid = playerCurrentGroup[playerid];
  2494.  
  2495.     new string[150];
  2496.     format(string, sizeof (string), "DROP TABLE %s", groupData[groupid][E_GROUP_NAME]);
  2497.     db_query(projectDB, string);
  2498.    
  2499.     format(string, sizeof (string), "TDEditor: Deleted group \"%s\".", groupData[groupid][E_GROUP_NAME]);
  2500.    
  2501.     ResetGroupData(groupid);
  2502.  
  2503.     for (new i = groupid; i < (groupsCount - 1); i++) {
  2504.         for (new x; x < groupData[i + 1][E_GROUP_TEXTDRAWS_COUNT]; x++) {
  2505.             groupTextDrawData[i][x] = groupTextDrawData[i + 1][x];
  2506.         }
  2507.         groupData[i] = groupData[i + 1];
  2508.     }
  2509.     groupsCount--;
  2510.  
  2511.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  2512.     return cmd_text(playerid);
  2513. }
  2514.  
  2515. Dialog:CHANGE_GROUP_NAME(playerid, response, listitem, inputtext[]) {
  2516.     if (response) {
  2517.         new name[MAX_GROUP_NAME];
  2518.         if (sscanf(inputtext, "%s["#MAX_GROUP_NAME"]", name)) {
  2519.             new string[512];
  2520.             format(string, sizeof (string), ""COL_WHITE"Insert a new textdraw "COL_GREEN"GROUP-NAME"COL_WHITE" you want to call this group as!\n\n"COL_YELLOW"Current Name:\t"COL_WHITE"%s\n\n"COL_RED"Error: "COL_GREY"The group name cannot be empty or spaces.", groupData[playerCurrentGroup[playerid]][E_GROUP_NAME]);
  2521.             return Dialog_Show(playerid, CHANGE_GROUP_NAME, DIALOG_STYLE_INPUT, "TDEditor: New project", string, "Change", "Back");
  2522.         }
  2523.  
  2524.         new groupid = playerCurrentGroup[playerid];
  2525.  
  2526.         new string[150];
  2527.         format(string, sizeof (string), "ALTER TABLE %s RENAME TO %s", groupData[groupid][E_GROUP_NAME], name);
  2528.         db_query(projectDB, string);
  2529.    
  2530.         format(string, sizeof (string), "TDEditor: Group name changed to \"%s\" from \"%s\".", inputtext, groupData[groupid][E_GROUP_NAME]);
  2531.         SendClientMessage(playerid, MESSAGE_COLOR, string);
  2532.  
  2533.         format(groupData[groupid][E_GROUP_NAME], MAX_GROUP_NAME, inputtext);
  2534.     }
  2535.  
  2536.     return ShowPlayerGroupDialog(playerid, playerCurrentGroup[playerid]);
  2537. }
  2538.  
  2539. Dialog:TEXTDRAW_MENU(playerid, response, listitem, inputtext[]) {
  2540.     new groupid = playerCurrentGroup[playerid];
  2541.     new textdrawid = playerCurrentTextDraw[playerid];
  2542.    
  2543.     if (!response) {
  2544.         new string[1024];
  2545.         string = "UPDATE %s SET \
  2546.             text = '%q', \
  2547.             x = '%f', y = '%f', \
  2548.             letter_x = '%f', letter_y = '%f', \
  2549.             text_x = '%f', text_y = '%f', \
  2550.             alignment = '%i', \
  2551.             color = '%i', \
  2552.             usebox = '%i', \
  2553.             box_color = '%i', \
  2554.             shadow = '%i', \
  2555.             outline = '%i', \
  2556.             background_color = '%i', \
  2557.             font = '%i', \
  2558.             proportional = '%i', \
  2559.             selectable = '%i', \
  2560.             preview_model = '%i', \
  2561.             rot_x = '%f', rot_y = '%f', rot_z = '%f', rot_zoom = '%f', \
  2562.             veh_color1 = '%i', veh_color2 = '%i', \
  2563.             type_player = '%i' \
  2564.             WHERE id = '%i'";
  2565.         format(string, sizeof (string), string,
  2566.             groupData[groupid][E_GROUP_NAME],
  2567.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT],
  2568.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_Y],
  2569.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_LETTERSIZE_Y],
  2570.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXTSIZE_Y],
  2571.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ALIGNMENT],
  2572.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR],
  2573.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_USE_BOX],
  2574.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR],
  2575.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SHADOW],
  2576.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_OUTLINE],
  2577.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR],
  2578.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_FONT],
  2579.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PROPORTIONAL],
  2580.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SELECTABLE],
  2581.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_MODEL],
  2582.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM],
  2583.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR1], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR2],
  2584.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TYPE_PLAYER],
  2585.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SQLID]);
  2586.         db_query(projectDB, string);
  2587.  
  2588.         return ShowPlayerGroupDialog(playerid, playerCurrentGroup[playerid]);
  2589.     }
  2590.    
  2591.     switch (listitem) {
  2592.         case 0: {
  2593.             return Dialog_Show(playerid, CHANGE_TEXT_OR_POSITION, DIALOG_STYLE_LIST, "TDEditor: Change text/position", "Change Text\nChange Position", "Select", "Back");
  2594.         }
  2595.        
  2596.         case 1: {
  2597.             return Dialog_Show(playerid, CHANGE_FONT, DIALOG_STYLE_LIST, "TDEditor: Change font", "Font 0\nFont 1\nFont 2\nFont 3\nFont 4 (Sprite)\nFont 5 (Preview Model)", "Set", "Back");
  2598.         }
  2599.  
  2600.         case 2: {
  2601.             return Dialog_Show(playerid, CHANGE_ALIGNMENT, DIALOG_STYLE_LIST, "TDEditor: Change alignment", "Alignment 1 (Left)\nAlignment 2 (Center)\nAlignment 3 (Right)", "Set", "Back");
  2602.         }
  2603.  
  2604.         case 3: {
  2605.             new string[150];
  2606.  
  2607.             if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PROPORTIONAL]) {
  2608.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PROPORTIONAL] = false;
  2609.  
  2610.                 format(string, sizeof (string), "TDEditor: Textdraw #%i Proportionality OFF.", textdrawid);
  2611.             }
  2612.             else {
  2613.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PROPORTIONAL] = true;
  2614.  
  2615.                 format(string, sizeof (string), "TDEditor: Textdraw #%i Proportionality ON.", textdrawid);
  2616.             }
  2617.  
  2618.             TextDrawSetProportional(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PROPORTIONAL]);
  2619.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  2620.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2621.             }
  2622.  
  2623.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2624.  
  2625.             return ShowPlayerTextDrawDialog(playerid, textdrawid);
  2626.         }
  2627.  
  2628.         case 4: {
  2629.             playerEditing[playerid] = EDITING_SHADOW_SIZE;
  2630.             playerEditingTimer[playerid] = SetTimerEx("OnPlayerTimerUpdate", 200, true, "i", playerid);
  2631.             if (showTextDrawCmds) {
  2632.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], "~w~Updating...");
  2633.                 PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  2634.             }
  2635.  
  2636.             TogglePlayerControllable(playerid, false);
  2637.         }
  2638.  
  2639.         case 5: {
  2640.             playerEditing[playerid] = EDITING_OUTLINE_SIZE;
  2641.             playerEditingTimer[playerid] = SetTimerEx("OnPlayerTimerUpdate", 200, true, "i", playerid);
  2642.             if (showTextDrawCmds) {
  2643.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], "~w~Updating...");
  2644.                 PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  2645.             }
  2646.  
  2647.             TogglePlayerControllable(playerid, false);
  2648.         }
  2649.  
  2650.         case 6: {
  2651.             playerEditing[playerid] = EDITING_BACKGROUND_COLOR;
  2652.             Dialog_Show(playerid, CHANGE_COLOR, DIALOG_STYLE_LIST, "TDEditor: Change outline/shadow color", "Custom HEX code\nCustom RGBA input\nTDEditor's colors list", "Set", "Back");
  2653.         }
  2654.  
  2655.         case 7: {
  2656.             playerEditing[playerid] = EDITING_LETTER_SIZE;
  2657.             playerEditingTimer[playerid] = SetTimerEx("OnPlayerTimerUpdate", 200, true, "i", playerid);
  2658.             if (showTextDrawCmds) {
  2659.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], "~w~Updating...");
  2660.                 PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  2661.             }
  2662.  
  2663.             TogglePlayerControllable(playerid, false);
  2664.         }
  2665.  
  2666.         case 8: {
  2667.             playerEditing[playerid] = EDITING_TEXTDRAW_COLOR;
  2668.             Dialog_Show(playerid, CHANGE_COLOR, DIALOG_STYLE_LIST, "TDEditor: Change textdraw color", "Custom HEX code\nCustom RGBA input\nTDEditor's colors list", "Set", "Back");
  2669.         }
  2670.  
  2671.         case 9: {
  2672.             new string[150];
  2673.  
  2674.             if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_USE_BOX]) {
  2675.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_USE_BOX] = false;
  2676.  
  2677.                 format(string, sizeof (string), "TDEditor: Textdraw #%i UseBox is set to OFF.", textdrawid);
  2678.             }
  2679.             else {
  2680.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_USE_BOX] = true;
  2681.  
  2682.                 format(string, sizeof (string), "TDEditor: Textdraw #%i UseBox is set to ON.", textdrawid);
  2683.             }
  2684.  
  2685.             TextDrawUseBox(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_USE_BOX]);
  2686.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  2687.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2688.             }
  2689.  
  2690.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2691.  
  2692.             return ShowPlayerTextDrawDialog(playerid, textdrawid);
  2693.         }
  2694.  
  2695.         case 10: {
  2696.             playerEditing[playerid] = EDITING_TEXT_SIZE;
  2697.             playerEditingTimer[playerid] = SetTimerEx("OnPlayerTimerUpdate", 200, true, "i", playerid);
  2698.             if (showTextDrawCmds) {
  2699.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], "~w~Updating...");
  2700.                 PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  2701.             }
  2702.  
  2703.             TogglePlayerControllable(playerid, false);
  2704.         }
  2705.  
  2706.         case 11: {
  2707.             playerEditing[playerid] = EDITING_BOX_COLOR;
  2708.             Dialog_Show(playerid, CHANGE_COLOR, DIALOG_STYLE_LIST, "TDEditor: Change box color", "Custom HEX code\nCustom RGBA input\nTDEditor's colors list", "Set", "Back");
  2709.         }
  2710.  
  2711.         case 12: {
  2712.             new string[150];
  2713.  
  2714.             if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SELECTABLE]) {
  2715.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SELECTABLE] = false;
  2716.  
  2717.                 format(string, sizeof (string), "TDEditor: Textdraw #%i is Selectable.", textdrawid);
  2718.             }
  2719.             else {
  2720.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SELECTABLE] = true;
  2721.  
  2722.                 format(string, sizeof (string), "TDEditor: Textdraw #%i is not Selectable.", textdrawid);
  2723.             }
  2724.  
  2725.             TextDrawSetSelectable(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SELECTABLE]);
  2726.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  2727.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2728.             }
  2729.  
  2730.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2731.  
  2732.             return ShowPlayerTextDrawDialog(playerid, textdrawid);
  2733.         }
  2734.        
  2735.         case 13: {
  2736.             Dialog_Show(playerid, PREVIEW_MODEL_OPTIONS, DIALOG_STYLE_LIST, "TDEditor: Preview model options", "Modelid\nChange Rotation From Keyboard(X,Y only)\nInput Rotation (X,Y,Z,Zoom)", "Select", "Back");
  2737.         }
  2738.  
  2739.         case 14: {
  2740.             new string[150];
  2741.  
  2742.             if (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TYPE_PLAYER]) {
  2743.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TYPE_PLAYER] = false;
  2744.  
  2745.                 format(string, sizeof (string), "TDEditor: Textdraw #%i type changed to GLOBAL('Text:').", textdrawid);
  2746.             }
  2747.             else {
  2748.                 groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TYPE_PLAYER] = true;
  2749.  
  2750.                 format(string, sizeof (string), "TDEditor: Textdraw #%i type changed to PLAYER('PlayerText:').", textdrawid);
  2751.             }
  2752.  
  2753.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  2754.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2755.             }
  2756.  
  2757.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2758.  
  2759.             return ShowPlayerTextDrawDialog(playerid, textdrawid);
  2760.         }
  2761.  
  2762.         case 15: {
  2763.             if (groupData[groupid][E_GROUP_TEXTDRAWS_COUNT] == MAX_GROUP_TEXTDRAWS) {
  2764.                 SendClientMessage(playerid, MESSAGE_COLOR, "TDEditor: You cannot add more than \""#MAX_GROUP_TEXTDRAWS"\" textdraws in a group. Change the limit in script(MAX_GROUP_TEXTDRAWS) and recompile to be able to add more.");
  2765.                 return ShowPlayerTextDrawDialog(playerid, textdrawid);
  2766.             }
  2767.  
  2768.             new newTextdrawid = groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]++;
  2769.             for (new i; E_TEXTDRAW:i < E_TEXTDRAW; i++) {
  2770.                 if (E_TEXTDRAW:i == E_TEXTDRAW_ID || E_TEXTDRAW:i == E_TEXTDRAW_SQLID) {
  2771.                     continue;
  2772.                 }
  2773.  
  2774.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW:i] = groupTextDrawData[groupid][textdrawid][E_TEXTDRAW:i];
  2775.             }
  2776.  
  2777.             new string[1024] = "INSERT INTO ";
  2778.             strcat(string, groupData[groupid][E_GROUP_NAME]);
  2779.             strcat(string, "(text, x, y, letter_x, letter_y, text_x, text_y, alignment, color, usebox, box_color, shadow, outline, background_color, font, proportional, selectable, preview_model, rot_x, rot_y, rot_z, rot_zoom, veh_color1, veh_color2, type_player)");
  2780.             strcat(string, "VALUES ('%q', '%f', '%f', '%f', '%f', '%f', '%f', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%f', '%f', '%f', '%f', '%i', '%i', '%i')");
  2781.             format(string, sizeof (string), string,
  2782.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_TEXT],
  2783.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_X], groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_Y],
  2784.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_LETTERSIZE_X], groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_LETTERSIZE_Y],
  2785.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_TEXTSIZE_X], groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_TEXTSIZE_Y],
  2786.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_ALIGNMENT],
  2787.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_COLOR],
  2788.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_USE_BOX],
  2789.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_BOX_COLOR],
  2790.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_SHADOW],
  2791.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_OUTLINE],
  2792.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_BACKGROUND_COLOR],
  2793.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_FONT],
  2794.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PROPORTIONAL],
  2795.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_SELECTABLE],
  2796.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PREVIEW_MODEL],
  2797.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM],
  2798.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR1], groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_PREVIEW_VEH_COLOR2],
  2799.                 groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_TYPE_PLAYER]);
  2800.             db_query(projectDB, string);
  2801.  
  2802.             format(string, sizeof (string), "SELECT id FROM %s ORDER BY id DESC LIMIT 1", groupData[groupid][E_GROUP_NAME]);
  2803.             new DBResult:result = db_query(projectDB, string);
  2804.             groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_SQLID] = db_get_field_int(result, 0);
  2805.             db_free_result(result);
  2806.  
  2807.             groupTextDrawData[groupid][newTextdrawid][E_TEXTDRAW_ID] = Text:INVALID_TEXT_DRAW;
  2808.             CreateGroupTextDraw(groupid, newTextdrawid);
  2809.  
  2810.             format(string, sizeof (string), "TDEditor: A duplicate textdraw added: Text #%i [Group: %s].", newTextdrawid, groupData[groupid][E_GROUP_NAME]);
  2811.             SendClientMessage(playerid, MESSAGE_COLOR, string);
  2812.  
  2813.             return ShowPlayerGroupDialog(playerid, groupid);
  2814.         }
  2815.  
  2816.         case 16: {
  2817.             new previewChars[MAX_GROUP_TEXTDRAW_PREVIEW_CHARS + 4];
  2818.             strmid(previewChars, groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], 0, MAX_GROUP_TEXTDRAW_PREVIEW_CHARS);
  2819.             if (strlen(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT]) > MAX_GROUP_TEXTDRAW_PREVIEW_CHARS) {
  2820.                 strcat(previewChars, "...");
  2821.             }
  2822.            
  2823.             new fontName[16];
  2824.             switch (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_FONT]) {
  2825.                 case 0, 1, 2, 3: {
  2826.                     fontName = "Text";
  2827.                 }
  2828.                
  2829.                 case 4: {
  2830.                     fontName = "Sprite";
  2831.                 }
  2832.                
  2833.                 case 5: {
  2834.                     fontName = "Preview Model";
  2835.                 }
  2836.             }
  2837.            
  2838.             new string[256];
  2839.             format(string, sizeof (string), ""COL_WHITE"Are you sure you want the delete "COL_ORANGE"TEXTDRAW: #%i"COL_WHITE"?\n\n"COL_RED"TextDraw Text:\t"COL_WHITE"'%s'\n"COL_RED"TextDraw Font:\t"COL_WHITE"%i (%s)", textdrawid, previewChars, groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_FONT], fontName);
  2840.             return Dialog_Show(playerid, CONFIRM_DELETE_TEXTDRAW, DIALOG_STYLE_MSGBOX, "TDEditor: Confirm delete group", string, "Yes", "No");
  2841.         }
  2842.     }
  2843.     return 1;
  2844. }
  2845.  
  2846. Dialog:CHANGE_TEXT_OR_POSITION(playerid, response, listitem, inputtext[]) {
  2847.     if (!response) {
  2848.         return ShowPlayerTextDrawDialog(playerid, playerCurrentTextDraw[playerid]);
  2849.     }
  2850.    
  2851.     switch (listitem) {
  2852.         case 0: {
  2853.             new groupid = playerCurrentGroup[playerid];
  2854.             new textdrawid = playerCurrentTextDraw[playerid];
  2855.            
  2856.             new previewChars[MAX_GROUP_TEXTDRAW_PREVIEW_CHARS + 4];
  2857.             strmid(previewChars, groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], 0, MAX_GROUP_TEXTDRAW_PREVIEW_CHARS);
  2858.             if (strlen(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT]) > MAX_GROUP_TEXTDRAW_PREVIEW_CHARS) {
  2859.                 strcat(previewChars, "...");
  2860.             }
  2861.        
  2862.             new string[256];
  2863.             format(string, sizeof(string), ""COL_WHITE"Insert a string to set as textxdraw "COL_GREEN"TEXT"COL_WHITE".\n\n"COL_YELLOW"Current Text: "COL_WHITE"'%s'", previewChars);
  2864.             Dialog_Show(playerid,  CHANGE_TEXT, DIALOG_STYLE_INPUT, "TDEditor: Change text", string, "Set", "Back");
  2865.         }
  2866.  
  2867.         case 1: {
  2868.             playerEditing[playerid] = EDITING_POS;
  2869.             playerEditingTimer[playerid] = SetTimerEx("OnPlayerTimerUpdate", 200, true, "i", playerid);
  2870.             if (showTextDrawCmds) {
  2871.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], "~w~Updating...");
  2872.                 PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  2873.             }
  2874.  
  2875.             TogglePlayerControllable(playerid, false);
  2876.         }
  2877.     }
  2878.     return 1;
  2879. }
  2880.  
  2881. Dialog:CHANGE_TEXT(playerid, response, listitem, inputtext[]) {
  2882.     if (!response) {
  2883.         return dialog_TEXTDRAW_MENU(playerid, 1, 0, "\1");
  2884.     }
  2885.  
  2886.     new groupid = playerCurrentGroup[playerid];
  2887.     new textdrawid = playerCurrentTextDraw[playerid];
  2888.    
  2889.     new previewChars[MAX_GROUP_TEXTDRAW_PREVIEW_CHARS + 4];
  2890.     strmid(previewChars, groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], 0, MAX_GROUP_TEXTDRAW_PREVIEW_CHARS);
  2891.     if (strlen(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT]) > MAX_GROUP_TEXTDRAW_PREVIEW_CHARS) {
  2892.         strcat(previewChars, "...");
  2893.     }
  2894.    
  2895.     new text[MAX_GROUP_TEXTDRAW_TEXT];
  2896.     if (sscanf(inputtext, "%s["#MAX_GROUP_TEXTDRAW_TEXT"]", text)) {
  2897.         new string[256];
  2898.         format(string, sizeof(string), ""COL_WHITE"Insert a string to set as textxdraw "COL_GREEN"TEXT"COL_WHITE".\n\n"COL_YELLOW"Current Text: "COL_WHITE"'%s'\n\n"COL_RED"Error: "COL_GREY"No text entered.", previewChars);
  2899.         return Dialog_Show(playerid,  CHANGE_TEXT, DIALOG_STYLE_INPUT, "TDEditor: Change text", string, "Set", "Back");
  2900.     }
  2901.    
  2902.     format(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_TEXT], MAX_GROUP_TEXTDRAW_TEXT, text);
  2903.     TextDrawSetString(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], text);
  2904.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  2905.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2906.     }
  2907.    
  2908.     return dialog_TEXTDRAW_MENU(playerid, 1, 0, "\1");
  2909. }
  2910.  
  2911. Dialog:CHANGE_FONT(playerid, response, listitem, inputtext[]) {
  2912.     if (!response) {
  2913.         return ShowPlayerTextDrawDialog(playerid, playerCurrentTextDraw[playerid]);
  2914.     }
  2915.  
  2916.     new groupid = playerCurrentGroup[playerid];
  2917.     new textdrawid = playerCurrentTextDraw[playerid];
  2918.  
  2919.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_FONT] = listitem;
  2920.     TextDrawFont(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], listitem);
  2921.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  2922.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2923.     }
  2924.  
  2925.     new string[150];
  2926.     format(string, sizeof (string), "TDEditor: Textdraw #%i Font changed to '%i'.", textdrawid, listitem);
  2927.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  2928.  
  2929.     return ShowPlayerTextDrawDialog(playerid, textdrawid);
  2930. }
  2931.  
  2932. Dialog:CHANGE_ALIGNMENT(playerid, response, listitem, inputtext[]) {
  2933.     if (!response) {
  2934.         return ShowPlayerTextDrawDialog(playerid, playerCurrentTextDraw[playerid]);
  2935.     }
  2936.  
  2937.     new groupid = playerCurrentGroup[playerid];
  2938.     new textdrawid = playerCurrentTextDraw[playerid];
  2939.  
  2940.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ALIGNMENT] = (listitem + 1);
  2941.     TextDrawAlignment(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], (listitem + 1));
  2942.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  2943.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2944.     }
  2945.  
  2946.     new string[150];
  2947.     format(string, sizeof (string), "TDEditor: Textdraw #%i Allignment changed to '%i'.", textdrawid, (listitem + 1));
  2948.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  2949.  
  2950.     return ShowPlayerTextDrawDialog(playerid, textdrawid);
  2951. }
  2952.  
  2953. Dialog:CONFIRM_DELETE_TEXTDRAW(playerid, response, listitem, inputtext[]) {
  2954.     if (!response) {
  2955.         return ShowPlayerTextDrawDialog(playerid, playerCurrentTextDraw[playerid]);
  2956.     }
  2957.  
  2958.     new groupid = playerCurrentGroup[playerid];
  2959.     new textdrawid = playerCurrentTextDraw[playerid];
  2960.  
  2961.     new string[150];
  2962.     format(string, sizeof (string), "DELETE FROM %s WHERE id = %i", groupData[groupid][E_GROUP_NAME], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_SQLID]);
  2963.     db_query(projectDB, string);
  2964.  
  2965.     TextDrawDestroy(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  2966.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID] = Text:INVALID_TEXT_DRAW;
  2967.  
  2968.     format(string, sizeof (string), "TDEditor: Deleted TextDraw #%i.", textdrawid);
  2969.  
  2970.     for (new i = textdrawid; i < (groupData[groupid][E_GROUP_TEXTDRAWS_COUNT] - 1); i++) {
  2971.         groupTextDrawData[groupid][i] = groupTextDrawData[groupid][i + 1];
  2972.     }
  2973.     groupData[groupid][E_GROUP_TEXTDRAWS_COUNT]--;
  2974.  
  2975.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  2976.     return ShowPlayerGroupDialog(playerid, playerCurrentGroup[playerid]);
  2977. }
  2978.  
  2979. Dialog:CHANGE_COLOR(playerid, response, listitem, inputtext[]) {
  2980.     if (!response) {
  2981.         return ShowPlayerTextDrawDialog(playerid, playerCurrentTextDraw[playerid]);
  2982.     }
  2983.  
  2984.     switch (listitem) {
  2985.         case 0: {
  2986.             return Dialog_Show(playerid, CUSTOM_HEX_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom HEX color", ""COL_WHITE"Insert a "COL_GREEN"HEXA-DECIMAL"COL_WHITE" color code below.\n\n"COL_WHITE"(for example: '0xFFFFFFF' is color white)", "Set", "Back");
  2987.         }
  2988.        
  2989.         case 1: {
  2990.             return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_RED"RED"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  2991.         }
  2992.        
  2993.         case 2: {
  2994.             static string[sizeof (COLORS) * ((32 * 2) + 1)];
  2995.             string[0] = EOS;
  2996.             for (new i; i < sizeof (COLORS); i++) {
  2997.                 format(string, sizeof (string), "%s{%06x}%s\n", string, (COLORS[i][E_COLOR_CODE] >>> 8), COLORS[i][E_COLOR_NAME]);
  2998.             }
  2999.             return Dialog_Show(playerid, COLOR_MENU, DIALOG_STYLE_LIST, "TDEditor: Colors menu", string, "Select", "Back");
  3000.         }
  3001.     }
  3002.     return 1;
  3003. }
  3004.  
  3005. Dialog:CUSTOM_HEX_COLOR(playerid, response, listitem, inputtext[]) {
  3006.     if (!response) {
  3007.         switch (playerEditing[playerid]) {
  3008.             case EDITING_BACKGROUND_COLOR: {
  3009.                 return dialog_TEXTDRAW_MENU(playerid, 1, 6, "\1");
  3010.             }
  3011.  
  3012.             case EDITING_TEXTDRAW_COLOR: {
  3013.                 return dialog_TEXTDRAW_MENU(playerid, 1, 8, "\1");
  3014.             }
  3015.  
  3016.             case EDITING_BOX_COLOR: {
  3017.                 return dialog_TEXTDRAW_MENU(playerid, 1, 11, "\1");
  3018.             }
  3019.         }
  3020.     }
  3021.  
  3022.     new red[3], green[3], blue[3], alpha[3];
  3023.  
  3024.     if (inputtext[0] == '0' && inputtext[1] == 'x') { // He's using 0xFFFFFF format
  3025.         if (strlen(inputtext) != 8 && strlen(inputtext) != 10) {
  3026.             return Dialog_Show(playerid, CUSTOM_HEX_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom hex color", ""COL_WHITE"Insert a "COL_GREEN"HEXA-DECIMAL"COL_WHITE" color code below.\n\n"COL_WHITE"(for example: '0xFFFFFFF' is color white)\n\n"COL_RED"Error: "COL_GREY"Invalid hexa-decimal color code entered.", "Set", "Back");
  3027.         }
  3028.  
  3029.         format(red, sizeof (red), "%c%c", inputtext[2], inputtext[3]);
  3030.         format(green, sizeof (green), "%c%c", inputtext[4], inputtext[5]);
  3031.         format(blue, sizeof (blue), "%c%c", inputtext[6], inputtext[7]);
  3032.        
  3033.         if (inputtext[8] != '\0') {
  3034.             format(alpha, sizeof (alpha), "%c%c", inputtext[8], inputtext[9]);
  3035.         }
  3036.         else {
  3037.             alpha = "FF";
  3038.         }
  3039.     }
  3040.     else if (inputtext[0] == '#') { // He's using #FFFFFF format
  3041.         if (strlen(inputtext) != 7 && strlen(inputtext) != 9) {
  3042.             return Dialog_Show(playerid, CUSTOM_HEX_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom hex color", ""COL_WHITE"Insert a "COL_GREEN"HEXA-DECIMAL"COL_WHITE" color code below.\n\n"COL_WHITE"(for example: '0xFFFFFFF' is color white)\n\n"COL_RED"Error: "COL_GREY"Invalid hexa-decimal color code entered.", "Set", "Back");
  3043.         }
  3044.  
  3045.         format(red, sizeof (red), "%c%c", inputtext[1], inputtext[2]);
  3046.         format(green, sizeof (green), "%c%c", inputtext[3], inputtext[4]);
  3047.         format(blue, sizeof (blue), "%c%c", inputtext[5], inputtext[6]);
  3048.  
  3049.         if (inputtext[7] != '\0') {
  3050.             format(alpha, sizeof (alpha), "%c%c", inputtext[7], inputtext[8]);
  3051.         }
  3052.         else {
  3053.             alpha = "FF";
  3054.         }
  3055.     }
  3056.     else { // He's using FFFFFF format
  3057.         if (strlen(inputtext) != 6 && strlen(inputtext) != 8) {
  3058.             return Dialog_Show(playerid, CUSTOM_HEX_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom hex color", ""COL_WHITE"Insert a "COL_GREEN"HEXA-DECIMAL"COL_WHITE" color code below.\n\n"COL_WHITE"(for example: '0xFFFFFFF' is color white)\n\n"COL_RED"Error: "COL_GREY"Invalid hexa-decimal color code entered.", "Set", "Back");
  3059.         }
  3060.  
  3061.         format(red, sizeof (red), "%c%c", inputtext[0], inputtext[1]);
  3062.         format(green, sizeof (green), "%c%c", inputtext[2], inputtext[3]);
  3063.         format(blue, sizeof (blue), "%c%c", inputtext[4], inputtext[5]);
  3064.  
  3065.         if (inputtext[7] != '\0') {
  3066.             format(alpha, sizeof (alpha), "%c%c", inputtext[6], inputtext[7]);
  3067.         }
  3068.         else {
  3069.             alpha = "FF";
  3070.         }
  3071.     }
  3072.    
  3073.     new groupid = playerCurrentGroup[playerid];
  3074.     new textdrawid = playerCurrentTextDraw[playerid];
  3075.  
  3076.     new string[150];
  3077.     switch (playerEditing[playerid]) {
  3078.         case EDITING_TEXTDRAW_COLOR: {
  3079.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR] = RGBA(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha));
  3080.             TextDrawColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR]);
  3081.  
  3082.             format(string, sizeof (string), "TDEditor: Textdraw #%i color changed to {%06x}Color Preview", textdrawid, (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR] >>> 8));
  3083.         }
  3084.  
  3085.         case EDITING_BOX_COLOR: {
  3086.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR] = RGBA(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha));
  3087.             TextDrawBoxColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR]);
  3088.  
  3089.             format(string, sizeof (string), "TDEditor: Textdraw #%i box color changed to {%06x}Color Preview", textdrawid, (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR] >>> 8));
  3090.         }
  3091.  
  3092.         case EDITING_BACKGROUND_COLOR: {
  3093.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] = RGBA(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha));
  3094.             TextDrawBackgroundColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR]);
  3095.  
  3096.             format(string, sizeof (string), "TDEditor: Textdraw #%i outline/shadow color changed to {%06x}Color Preview", textdrawid, (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] >>> 8));
  3097.         }
  3098.     }
  3099.    
  3100.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  3101.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3102.     }
  3103.  
  3104.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  3105.  
  3106.     return ShowPlayerTextDrawDialog(playerid, textdrawid);
  3107. }
  3108.  
  3109. Dialog:CUSTOM_RGBA_COLOR(playerid, response, listitem, inputtext[]) {
  3110.     if (!response) {
  3111.         switch (GetPVarInt(playerid, "ColorElement")) {
  3112.             case 0: {
  3113.                 DeletePVar(playerid, "ColorElement");
  3114.                 DeletePVar(playerid, "ColorElement_R");
  3115.                 DeletePVar(playerid, "ColorElement_G");
  3116.                 DeletePVar(playerid, "ColorElement_B");
  3117.                 DeletePVar(playerid, "ColorElement_A");
  3118.                
  3119.                 switch (playerEditing[playerid]) {
  3120.                     case EDITING_BACKGROUND_COLOR: {
  3121.                         return dialog_TEXTDRAW_MENU(playerid, 1, 6, "\1");
  3122.                     }
  3123.  
  3124.                     case EDITING_TEXTDRAW_COLOR: {
  3125.                         return dialog_TEXTDRAW_MENU(playerid, 1, 8, "\1");
  3126.                     }
  3127.  
  3128.                     case EDITING_BOX_COLOR: {
  3129.                         return dialog_TEXTDRAW_MENU(playerid, 1, 11, "\1");
  3130.                     }
  3131.                 }
  3132.             }
  3133.  
  3134.             case 1: {
  3135.                 SetPVarInt(playerid, "ColorElement", 0);
  3136.                 return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_RED"RED"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  3137.             }
  3138.  
  3139.             case 2: {
  3140.                 SetPVarInt(playerid, "ColorElement", 1);
  3141.                 return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_GREEN"GREEN"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  3142.             }
  3143.  
  3144.             case 3: {
  3145.                 SetPVarInt(playerid, "ColorElement", 2);
  3146.                 return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_BLUE"BLUE"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  3147.             }
  3148.         }
  3149.     }
  3150.    
  3151.     new val;
  3152.     if (!sscanf(inputtext, "%i", val)) {
  3153.         if (val >= 0 && val <= 255) {
  3154.             switch (GetPVarInt(playerid, "ColorElement")) {
  3155.                 case 0: {
  3156.                     SetPVarInt(playerid, "ColorElement", 1);
  3157.                     SetPVarInt(playerid, "ColorElement_R", val);
  3158.                     return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_GREEN"GREEN"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  3159.                 }
  3160.                
  3161.                 case 1: {
  3162.                     SetPVarInt(playerid, "ColorElement", 2);
  3163.                     SetPVarInt(playerid, "ColorElement_G", val);
  3164.                     return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_BLUE"BLUE"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  3165.                 }
  3166.                
  3167.                 case 2: {
  3168.                     SetPVarInt(playerid, "ColorElement", 3);
  3169.                     SetPVarInt(playerid, "ColorElement_B", val);
  3170.                     return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_GREY"ALPHA"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  3171.                 }
  3172.                
  3173.                 case 3: {
  3174.                     new groupid = playerCurrentGroup[playerid];
  3175.                     new textdrawid = playerCurrentTextDraw[playerid];
  3176.                    
  3177.                     new string[150];
  3178.                     switch (playerEditing[playerid]) {
  3179.                         case EDITING_TEXTDRAW_COLOR: {
  3180.                             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR] = RGBA(GetPVarInt(playerid, "ColorElement_R"), GetPVarInt(playerid, "ColorElement_G"), GetPVarInt(playerid, "ColorElement_B"), val);
  3181.                             TextDrawColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR]);
  3182.  
  3183.                             format(string, sizeof (string), "TDEditor: Textdraw #%i color changed to {%06x}Color Preview", textdrawid, (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR] >>> 8));
  3184.                         }
  3185.  
  3186.                         case EDITING_BOX_COLOR: {
  3187.                             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR] = RGBA(GetPVarInt(playerid, "ColorElement_R"), GetPVarInt(playerid, "ColorElement_G"), GetPVarInt(playerid, "ColorElement_B"), val);
  3188.                             TextDrawBoxColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR]);
  3189.  
  3190.                             format(string, sizeof (string), "TDEditor: Textdraw #%i box color changed to {%06x}Color Preview", textdrawid, (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR] >>> 8));
  3191.                         }
  3192.  
  3193.                         case EDITING_BACKGROUND_COLOR: {
  3194.                             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] = RGBA(GetPVarInt(playerid, "ColorElement_R"), GetPVarInt(playerid, "ColorElement_G"), GetPVarInt(playerid, "ColorElement_B"), val);
  3195.                             TextDrawBackgroundColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR]);
  3196.  
  3197.                             format(string, sizeof (string), "TDEditor: Textdraw #%i outline/shadow color changed to {%06x}Color Preview", textdrawid, (groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] >>> 8));
  3198.                         }
  3199.                     }
  3200.  
  3201.                     DeletePVar(playerid, "ColorElement");
  3202.                     DeletePVar(playerid, "ColorElement_R");
  3203.                     DeletePVar(playerid, "ColorElement_G");
  3204.                     DeletePVar(playerid, "ColorElement_B");
  3205.                     DeletePVar(playerid, "ColorElement_A");
  3206.  
  3207.                     if (groupData[groupid][E_GROUP_VISIBLE]) {
  3208.                         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3209.                     }
  3210.  
  3211.                     SendClientMessage(playerid, MESSAGE_COLOR, string);
  3212.  
  3213.                     return ShowPlayerTextDrawDialog(playerid, textdrawid);
  3214.                 }
  3215.             }
  3216.         }
  3217.     }
  3218.     return Dialog_Show(playerid, CUSTOM_RGBA_COLOR, DIALOG_STYLE_INPUT, "TDEditor: Custom RGBA color", ""COL_WHITE"Insert color element value for "COL_RED"RED"COL_WHITE" below.\n\n"COL_WHITE"Maximum value of a color componenet can be 255.", "Next", "Back");
  3219. }
  3220.  
  3221. Dialog:COLOR_MENU(playerid, response, listitem, inputtext[]) {
  3222.     if (!response) {
  3223.         switch (playerEditing[playerid]) {
  3224.             case EDITING_BACKGROUND_COLOR: {
  3225.                 return dialog_TEXTDRAW_MENU(playerid, 1, 6, "\1");
  3226.             }
  3227.            
  3228.             case EDITING_TEXTDRAW_COLOR: {
  3229.                 return dialog_TEXTDRAW_MENU(playerid, 1, 8, "\1");
  3230.             }
  3231.            
  3232.             case EDITING_BOX_COLOR: {
  3233.                 return dialog_TEXTDRAW_MENU(playerid, 1, 11, "\1");
  3234.             }
  3235.         }
  3236.     }
  3237.  
  3238.     new groupid = playerCurrentGroup[playerid];
  3239.     new textdrawid = playerCurrentTextDraw[playerid];
  3240.  
  3241.     new string[150];
  3242.     switch (playerEditing[playerid]) {
  3243.         case EDITING_TEXTDRAW_COLOR: {
  3244.             TextDrawColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], COLORS[listitem][E_COLOR_CODE]);
  3245.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_COLOR] = COLORS[listitem][E_COLOR_CODE];
  3246.  
  3247.             format(string, sizeof (string), "TDEditor: Textdraw #%i color changed to {%06x}%s", textdrawid, (COLORS[listitem][E_COLOR_CODE] >>> 8), COLORS[listitem][E_COLOR_NAME]);
  3248.         }
  3249.  
  3250.         case EDITING_BOX_COLOR: {
  3251.             TextDrawBoxColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], COLORS[listitem][E_COLOR_CODE]);
  3252.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BOX_COLOR] = COLORS[listitem][E_COLOR_CODE];
  3253.  
  3254.             format(string, sizeof (string), "TDEditor: Textdraw #%i box color changed to {%06x}%s", textdrawid, (COLORS[listitem][E_COLOR_CODE] >>> 8), COLORS[listitem][E_COLOR_NAME]);
  3255.         }
  3256.  
  3257.         case EDITING_BACKGROUND_COLOR: {
  3258.             TextDrawBackgroundColor(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], COLORS[listitem][E_COLOR_CODE]);
  3259.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_BACKGROUND_COLOR] = COLORS[listitem][E_COLOR_CODE];
  3260.  
  3261.             format(string, sizeof (string), "TDEditor: Textdraw #%i outline/shadow color changed to {%06x}%s", textdrawid, (COLORS[listitem][E_COLOR_CODE] >>> 8), COLORS[listitem][E_COLOR_NAME]);
  3262.         }
  3263.     }
  3264.  
  3265.     playerEditing[playerid] = EDITING_NONE;
  3266.  
  3267.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  3268.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3269.     }
  3270.  
  3271.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  3272.  
  3273.     return ShowPlayerTextDrawDialog(playerid, textdrawid);
  3274. }
  3275.  
  3276. Dialog:PREVIEW_MODEL_OPTIONS(playerid, response, listitem, inputtext[]) {
  3277.     if (!response) {
  3278.         return ShowPlayerTextDrawDialog(playerid, playerCurrentTextDraw[playerid]);
  3279.     }
  3280.    
  3281.     switch (listitem) {
  3282.         case 0: {
  3283.             Dialog_Show(playerid, SEARCH_PREVIEW_MODEL, DIALOG_STYLE_INPUT, "TDEditor: Change preview model", ""COL_WHITE"Insert exact "COL_GREEN"MODELID"COL_WHITE" or a "COL_GREEN"OBJECT NAME"COL_WHITE" or a hint so we can find all relative object models and give you a list!", "Search", "Back");
  3284.         }
  3285.        
  3286.         case 1: {
  3287.             playerEditing[playerid] = EDITING_PREVIEW_ROT;
  3288.             playerEditingTimer[playerid] = SetTimerEx("OnPlayerTimerUpdate", 200, true, "i", playerid);
  3289.             if (showTextDrawCmds) {
  3290.                 PlayerTextDrawSetString(playerid, playerEditingTextDraw[playerid], "~w~Updating...");
  3291.                 PlayerTextDrawShow(playerid, playerEditingTextDraw[playerid]);
  3292.             }
  3293.  
  3294.             TogglePlayerControllable(playerid, false);
  3295.         }
  3296.  
  3297.         case 2: {
  3298.             new groupid = playerCurrentGroup[playerid];
  3299.             new textdrawid = playerCurrentTextDraw[playerid];
  3300.  
  3301.             new string[256];
  3302.             format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"X COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-X: "COL_WHITE"%0.2f", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X]);
  3303.             Dialog_Show(playerid, INPUT_ROTATION, DIALOG_STYLE_INPUT, "TDEditor: Input X,Y,Z,Zoom manually", string, "Next", "Back");
  3304.  
  3305.             SetPVarInt(playerid, "RotationType", 0);
  3306.         }
  3307.     }
  3308.     return 1;
  3309. }
  3310.  
  3311. Dialog:SEARCH_PREVIEW_MODEL(playerid, response, listitem, inputtext[]) {
  3312.     if (!response) {
  3313.         return dialog_TEXTDRAW_MENU(playerid, 1, 13, "\1");
  3314.     }
  3315.  
  3316.     new name[32];
  3317.     if (sscanf(inputtext, "%s[32]", name)) {
  3318.         return Dialog_Show(playerid, SEARCH_PREVIEW_MODEL, DIALOG_STYLE_INPUT, "TDEditor: Search modelid", ""COL_WHITE"Insert exact "COL_GREEN"MODELID"COL_WHITE" or a "COL_GREEN"OBJECT NAME"COL_WHITE" or a hint so we can find all relative object models and give you a list!\n\n"COL_RED"Error: "COL_GREY"Model name not entered.", "Search", "Back");
  3319.     }
  3320.    
  3321.     if (!sscanf(name, "{i}")) {
  3322.         new modelid = strval(name);
  3323.         if (modelid < 0 || modelid >= 44764) {
  3324.             return Dialog_Show(playerid, SEARCH_PREVIEW_MODEL, DIALOG_STYLE_INPUT, "TDEditor: Search modelid", ""COL_WHITE"Insert exact "COL_GREEN"MODELID"COL_WHITE" or a "COL_GREEN"OBJECT NAME"COL_WHITE" or a hint so we can find all relative object models and give you a list!\n\n"COL_RED"Error: "COL_GREY"Invalid object/modelid, must be between 0 to 44764.", "Search", "Back");
  3325.         }
  3326.        
  3327.         return dialog_CHOOSE_PREVIEW_MODEL(playerid, 1, 0, name);
  3328.     }
  3329.     else {
  3330.         new DB:db = db_open(PATH_OBJECTS_FILE);
  3331.         if (!db) {
  3332.             return Dialog_Show(playerid, SEARCH_PREVIEW_MODEL, DIALOG_STYLE_INPUT, "TDEditor: Search modelid", ""COL_WHITE"Insert exact "COL_GREEN"MODELID"COL_WHITE" or a "COL_GREEN"OBJECT NAME"COL_WHITE" or a hint so we can find all relative object models and give you a list!\n\n"COL_RED"Error: "COL_GREY"Database file \"allbuildings.db\" wasn't found in scriptfiles.", "Search", "Back");
  3333.         }
  3334.  
  3335.         new string[256];
  3336.         format(string, sizeof (string), "SELECT Model, Model_Name FROM buildings WHERE Model_Name LIKE '%s%q%s'", "%", name, "%");
  3337.         new DBResult:result = db_query(db, string);
  3338.         if (!result) {
  3339.             db_close(db);
  3340.             return Dialog_Show(playerid, SEARCH_PREVIEW_MODEL, DIALOG_STYLE_INPUT, "TDEditor: Search modelid", ""COL_WHITE"Insert exact "COL_GREEN"MODELID"COL_WHITE" or a "COL_GREEN"OBJECT NAME"COL_WHITE" or a hint so we can find all relative object models and give you a list!\n\n"COL_RED"Error: "COL_GREY"Something went wrong while performing query, Please try again.", "Search", "Back");
  3341.         }
  3342.  
  3343.         if (db_num_rows(result) == 0) {
  3344.             db_free_result(result);
  3345.             db_close(db);
  3346.             return Dialog_Show(playerid, SEARCH_PREVIEW_MODEL, DIALOG_STYLE_INPUT, "TDEditor: Search modelid", ""COL_WHITE"Insert exact "COL_GREEN"MODELID"COL_WHITE" or a "COL_GREEN"OBJECT NAME"COL_WHITE" or a hint so we can find all relative object models and give you a list!\n\n"COL_RED"Error: "COL_GREY"No results found, try some other name.", "Search", "Back");
  3347.         }
  3348.  
  3349.         new count;
  3350.         static info[100 * (32 + 1)];
  3351.         info = "Model\tModel Name\n";
  3352.  
  3353.         do {
  3354.             if (count++ == 100) {
  3355.                 break;
  3356.             }
  3357.  
  3358.             db_get_field(result, 1, name, sizeof (name));
  3359.             format(info, sizeof (info), "%s%i\t%s\n", info, db_get_field_int(result, 0), name);
  3360.         }
  3361.         while (db_next_row(result));
  3362.  
  3363.         db_free_result(result);
  3364.         db_close(db);
  3365.  
  3366.         return Dialog_Show(playerid, CHOOSE_PREVIEW_MODEL, DIALOG_STYLE_TABLIST_HEADERS, "TDEditor: Search modelid", info, "Set", "Back");
  3367.     }
  3368. }
  3369.  
  3370. Dialog:CHOOSE_PREVIEW_MODEL(playerid, response, listitem, inputtext[]) {
  3371.     if (!response) {
  3372.         return dialog_PREVIEW_MODEL_OPTIONS(playerid, 1, 0, "\1");
  3373.     }
  3374.  
  3375.     new modelid = strval(inputtext);
  3376.  
  3377.     new groupid = playerCurrentGroup[playerid];
  3378.     new textdrawid = playerCurrentTextDraw[playerid];
  3379.  
  3380.     TextDrawSetPreviewModel(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], modelid);
  3381.     groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_MODEL] = modelid;
  3382.     if (groupData[groupid][E_GROUP_VISIBLE]) {
  3383.         TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3384.     }
  3385.  
  3386.     new string[150];
  3387.     format(string, sizeof (string), "TDEditor: Textdraw #%i preview model changed to \"%i\"", textdrawid, modelid);
  3388.     SendClientMessage(playerid, MESSAGE_COLOR, string);
  3389.     return dialog_TEXTDRAW_MENU(playerid, 1, 13, "\1");
  3390. }
  3391.  
  3392. Dialog:INPUT_ROTATION(playerid, response, listitem, inputtext[]) {
  3393.     new groupid = playerCurrentGroup[playerid];
  3394.     new textdrawid = playerCurrentTextDraw[playerid];
  3395.    
  3396.     if (!response) {
  3397.         new string[256];
  3398.         switch (GetPVarInt(playerid, "RotationType")) {
  3399.             case 0: {
  3400.                 DeletePVar(playerid, "RotationType");
  3401.            
  3402.                 return dialog_TEXTDRAW_MENU(playerid, 1, 13, "\1");
  3403.             }
  3404.  
  3405.             case 1: {
  3406.                 SetPVarInt(playerid, "RotationType", 0);
  3407.                
  3408.                 format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"X COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-X: "COL_WHITE"%0.2f", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X]);
  3409.             }
  3410.  
  3411.             case 2: {
  3412.                 SetPVarInt(playerid, "RotationType", 1);
  3413.  
  3414.                 format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"Y COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Y: "COL_WHITE"%0.2f", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y]);
  3415.             }
  3416.  
  3417.             case 3: {
  3418.                 SetPVarInt(playerid, "RotationType", 2);
  3419.  
  3420.                 format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"Z COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Z: "COL_WHITE"%0.2f", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z]);
  3421.             }
  3422.         }
  3423.        
  3424.         return Dialog_Show(playerid, INPUT_ROTATION, DIALOG_STYLE_INPUT, "TDEditor: Input X,Y,Z,Zoom manuually", string, "Next", "Back");
  3425.     }
  3426.    
  3427.     new Float:val = -1.0;
  3428.     if (sscanf(inputtext, "%f", val) || ((GetPVarInt(playerid, "RotationType") == 3) ? (val < 0.0 || val > 100.0) : (val < -360.0 || val > 360.0))) {
  3429.         new string[256];
  3430.         switch (GetPVarInt(playerid, "RotationType")) {
  3431.             case 0: {
  3432.                 format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"X COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-X: "COL_WHITE"%0.2f\n\n"COL_RED"Error: "COL_GREY"No value entered or out of bounds (must be between '-360' - '360')", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X]);
  3433.             }
  3434.            
  3435.             case 1: {
  3436.                 format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"Y COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Y: "COL_WHITE"%0.2f\n\n"COL_RED"Error: "COL_GREY"No value entered or out of bounds (must be between '-360' - '360')", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y]);
  3437.             }
  3438.            
  3439.             case 2: {
  3440.                 format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"Z COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Z: "COL_WHITE"%0.2f\n\n"COL_RED"Error: "COL_GREY"No value entered or out of bounds (must be between '-360' - '360')", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z]);
  3441.             }
  3442.            
  3443.             case 3: {
  3444.                 format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"ZOOM"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Zoom: "COL_WHITE"%0.2f\n\n"COL_RED"Error: "COL_GREY"No value entered or out of bounds (must be between '0' - '100')", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  3445.                 return Dialog_Show(playerid, INPUT_ROTATION, DIALOG_STYLE_INPUT, "TDEditor: Input X,Y,Z,Zoom manuually", string, "Finish", "Back");
  3446.             }
  3447.         }
  3448.         return Dialog_Show(playerid, INPUT_ROTATION, DIALOG_STYLE_INPUT, "TDEditor: Input X,Y,Z,Zoom manuually", string, "Next", "Back");
  3449.     }
  3450.  
  3451.     new string[256];
  3452.     switch (GetPVarInt(playerid, "RotationType")) {
  3453.         case 0: {
  3454.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X] = val;
  3455.             TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  3456.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  3457.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3458.             }
  3459.            
  3460.             SetPVarInt(playerid, "RotationType", 1);
  3461.  
  3462.             format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"Y COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Y: "COL_WHITE"%0.2f", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y]);
  3463.         }
  3464.  
  3465.         case 1: {
  3466.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y] = val;
  3467.             TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  3468.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  3469.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3470.             }
  3471.  
  3472.             SetPVarInt(playerid, "RotationType", 2);
  3473.  
  3474.             format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"Z COORDINATE"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Z: "COL_WHITE"%0.2f", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z]);
  3475.         }
  3476.  
  3477.         case 2: {
  3478.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z] = val;
  3479.             TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  3480.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  3481.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3482.             }
  3483.  
  3484.             SetPVarInt(playerid, "RotationType", 3);
  3485.  
  3486.             format(string, sizeof(string), ""COL_WHITE"Insert a floating value for "COL_GREEN"ZOOM"COL_WHITE" of preview model rotation.\n\n"COL_YELLOW"Current Rot-Zoom: "COL_WHITE"%0.2f", groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  3487.             return Dialog_Show(playerid, INPUT_ROTATION, DIALOG_STYLE_INPUT, "TDEditor: Input X,Y,Z,Zoom manuually", string, "Finish", "Back");
  3488.         }
  3489.  
  3490.         case 3: {
  3491.             groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM] = val;
  3492.             TextDrawSetPreviewRot(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_X], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Y], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_Z], groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_PREVIEW_ROT_ZOOM]);
  3493.             if (groupData[groupid][E_GROUP_VISIBLE]) {
  3494.                 TextDrawShowForAll(groupTextDrawData[groupid][textdrawid][E_TEXTDRAW_ID]);
  3495.             }
  3496.  
  3497.             DeletePVar(playerid, "RotationType");
  3498.  
  3499.             return dialog_TEXTDRAW_MENU(playerid, 1, 13, "\1");
  3500.         }
  3501.     }
  3502.  
  3503.     return Dialog_Show(playerid, INPUT_ROTATION, DIALOG_STYLE_INPUT, "TDEditor: Input X,Y,Z,Zoom manuually", string, "Next", "Back");
  3504. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement