Advertisement
Guest User

DrEdit_V1.0

a guest
Jun 10th, 2012
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 100.48 KB | None | 0 0
  1. /*
  2.  
  3.  
  4.                          _____           _     _      
  5.                         |  __ \         | |   (_)      
  6.                         | |  | |_ __ ___| |__  _ _ __  
  7.                         | |  | | '__/ _ \ '_ \| | '_ \
  8.                         | |__| | | |  __/ |_) | | | | |
  9.                         |_____/|_|  \___|_.__/|_|_| |_|
  10.  
  11.                                ObjectEditor v1.0.0
  12.  
  13.                                   ยฉDrebin 2012
  14.  
  15.  
  16. */
  17.  
  18. #define FILTERSCRIPT
  19.  
  20. #include <a_samp>
  21. #include <dini>
  22. #include <zcmd>
  23. #include <sscanf2>
  24. //==============================================================================
  25. //                            > D E F I N E S <
  26. //
  27. //                 true = enabled/yes | false = disabled/no
  28. //==============================================================================
  29. #define RCON_ADMINS_ONLY                    false       //Restrict the usage of the editor to RCON admins
  30. #define TOGGLED_ONLY                        false       //If true, an admin has to /toggleeditor the player first before they can use the editor.
  31. #define USE_COMMAND_SHORTCUTS               true        //Allow the usage of command shortcuts (eg. /createnewobject -> /cno)
  32. #define USE_MAX_CREATE_DISTANCE             true        //Restrict the distance an object is create from the player
  33. #define USE_MAX_MOVE_DISTANCE               true        //Restict the max. distance a player can move the object
  34. #define MAX_CREATE_DISTANCE                 200.0       //The max. distance a player can enter when he creates an object (only if USEMAX_CREATE_DISTANCE is enabled)
  35. #define MAX_MOVE_DISTANCE                   400.0       //The max. distance a player can move an object (only if MAX_CREATE_DISTANCE is enabled)
  36. #define ALLOW_EXPORT_MAP_FILE               false       //Allow normal players to export an object file? (if disabled, only RCON admins can)
  37. #define ALLOW_EDIT_OBJECT_ON_DUPLICATE      true        //Allow a player to enable the auto edition of an object after it has been duplicated
  38. #define ALLOW_USE_MATERIAL_CHANGE_DIALOG    true        //Allow the player to use the material change dialog (recommended)
  39. #define ALLOW_EDIT_OBJECT_ON_CREATE         true        //Allow a player to enable the auto edition of an object after creating it
  40. #define ALLOW_KEEP_MATERIAL                 false       //Allow a player to enable a function which keeps the cusrom texture after changing the model of the object
  41. #define ALLOW_USE_CROSS                     true        //Allow a player to enable the fade cross when he's in the flyeditor
  42. #define ALLOW_TRANSFER_MATERIAL             true        //If a player duplicates an object with a custom material(texture) on it, this allows him to
  43.                                                         //-> enable a setting which automatically transfers the material to the duplicated object
  44. //==============================================================================
  45. //                           > D I A L O G   I D S <
  46. //==============================================================================
  47. #define DIALOG_MAINMENU 1693
  48. #define DIALOG_MAP_SAVENAME 1694
  49. #define DIALOG_MAP_EXPORTNAME 1695
  50. #define DIALOG_MAP_LOAD 1696
  51. #define DIALOG_SELECTMENU 1697
  52. #define DIALOG_CHANGEMODEL 1698
  53. #define DIALOG_MATERIALS 1699
  54. #define DIALOG_MATERIALINDEX 1700
  55. #define DIALOG_MODELID 1701
  56. #define DIALOG_TXDNAME 1702
  57. #define DIALOG_TEXTURENAME 1703
  58. #define DIALOG_COLOR 1704
  59. #define DIALOG_SETTINGS 1705
  60. #define DIALOG_EDITORCOMMANDS 1706
  61. #define DIALOG_EDITORCOMMANDS2 1707
  62. #define DIALOG_SETTINGSHELP 1708
  63. //==============================================================================
  64. //                        > C O L O R  D E F I N E S <
  65. //==============================================================================
  66. #define COLOR_USAGE     0x91FF91FF      //{91FF91} - The color of the command usage
  67. #define COLOR_USAGE2    0x87FF87FF      //{87FF87} - The color of the command parameter explanation
  68. #define COLOR_WARNING   0xF58282FF      //{F58282} - The color of the red error messages
  69. #define COLOR_INFO      0xF5F582FF      //{F5F582} - The color of the info messages
  70.                                         //{A9C4E4} - default dialog color
  71. //==============================================================================
  72.  
  73. //==============================================================================
  74. //------------------------------------------------------------------------------
  75. // !!!  D O  N O T  C H A N G E  V A L U E S  B E L O W  T H I S  L I N E  !!!
  76. //------------------------------------------------------------------------------
  77. //==============================================================================
  78. #define INVALID_OBJECT_NUMBER (-1)
  79. #define MAX_CREATED_OBJECTS 400
  80.  
  81. #define MOVE_FORWARD            1
  82. #define MOVE_BACK               2
  83. #define MOVE_LEFT               3
  84. #define MOVE_RIGHT              4
  85. #define MOVE_FORWARD_LEFT       5
  86. #define MOVE_FORWARD_RIGHT      6
  87. #define MOVE_BACK_LEFT          7
  88. #define MOVE_BACK_RIGHT         8
  89.  
  90. #define MOVE_SPEED              100.0
  91. #define ACCEL_RATE              0.03
  92.  
  93. enum objectenum
  94. {
  95.     created,
  96.     objectID,
  97.     modelID,
  98.     Float:XLoc,
  99.     Float:YLoc,
  100.     Float:ZLoc,
  101.     Float:XRot,
  102.     Float:YRot,
  103.     Float:ZRot,
  104.     usesmaterial,
  105.     indexused,
  106.     modelused,
  107.     txdused,
  108.     textureused,
  109.     colorused,
  110.     matindex,
  111.     matmodel
  112. };
  113.  
  114. enum playerenum
  115. {
  116.     bool:EditObjectOnCreate,
  117.     bool:EditObjectOnDuplicate,
  118.     bool:UseMaterialDialog,
  119.     bool:TransferMaterial,
  120.     bool:KeepMaterial,
  121.     bool:UseCross,
  122.     bool:editing,
  123.     totalobjects,
  124.     editobject,
  125.     flyeditor,
  126.     flyobject,
  127.     mode,
  128.     lrold,
  129.     udold,
  130.     lastmove,
  131.     Float:accelmul,
  132.     Float:poX,
  133.     Float:poY,
  134.     Float:poZ,
  135.     canuse
  136. };
  137.  
  138. new pInfo[MAX_PLAYERS][playerenum];
  139. new oInfo[MAX_PLAYERS][MAX_CREATED_OBJECTS][objectenum];
  140.  
  141. new PlayerText:Cross[2];
  142.  
  143. #if defined FILTERSCRIPT
  144.  
  145. public OnFilterScriptInit()
  146. {
  147.     print("-----------------------------------------------------------------------------\n");
  148.     print("                         > Drebin's Object Editor <                          ");
  149.     print("                                   v1.0.0                                    ");
  150.     print("                                                                             ");
  151.     print("                                ยฉDrebin 2012                                 ");
  152.     print("                                                                             ");
  153.     print("-----------------------------------------------------------------------------\n");
  154.     return 1;
  155. }
  156.  
  157. public OnFilterScriptExit()
  158. {
  159.     for(new i = 0; i <= MAX_PLAYERS; i++)
  160.     {
  161.         if(IsPlayerConnected(i))
  162.             Endflyeditor(i);
  163.     }
  164.     return 1;
  165. }
  166.  
  167. #endif
  168.  
  169. public OnPlayerConnect(playerid)
  170. {
  171.     ResetAllValues(playerid);
  172.     pInfo[playerid][canuse]                 = false;
  173.     pInfo[playerid][EditObjectOnCreate]     = false;
  174.     pInfo[playerid][EditObjectOnDuplicate]  = false;
  175.     pInfo[playerid][UseMaterialDialog]      = true;
  176.     pInfo[playerid][TransferMaterial]       = true;
  177.     pInfo[playerid][KeepMaterial]           = true;
  178.     pInfo[playerid][UseCross]               = false;
  179.     pInfo[playerid][lrold]                  = 0;
  180.     pInfo[playerid][udold]                  = 0;
  181.     pInfo[playerid][mode]                   = 0;
  182.     pInfo[playerid][lastmove]               = 0;
  183.     pInfo[playerid][accelmul]               = 0.0;
  184.     Cross[0] = CreatePlayerTextDraw(playerid, 320.000000, 221.000000, "_");
  185.     PlayerTextDrawAlignment(playerid, Cross[0], 2);
  186.     PlayerTextDrawBackgroundColor(playerid, Cross[0], 255);
  187.     PlayerTextDrawFont(playerid, Cross[0], 1);
  188.     PlayerTextDrawLetterSize(playerid, Cross[0], 0.500000, 1.400000);
  189.     PlayerTextDrawColor(playerid, Cross[0], -1);
  190.     PlayerTextDrawSetOutline(playerid, Cross[0], 0);
  191.     PlayerTextDrawSetProportional(playerid, Cross[0], 1);
  192.     PlayerTextDrawSetShadow(playerid, Cross[0], 1);
  193.     PlayerTextDrawUseBox(playerid, Cross[0], 1);
  194.     PlayerTextDrawBoxColor(playerid, Cross[0], -1);
  195.     PlayerTextDrawTextSize(playerid, Cross[0], 0.000000, -3.000000);
  196.  
  197.     Cross[1] = CreatePlayerTextDraw(playerid, 320.000000, 229.000000, "_");
  198.     PlayerTextDrawAlignment(playerid, Cross[1], 2);
  199.     PlayerTextDrawBackgroundColor(playerid, Cross[1], 255);
  200.     PlayerTextDrawFont(playerid, Cross[1], 1);
  201.     PlayerTextDrawLetterSize(playerid, Cross[1], 0.500000, -0.400000);
  202.     PlayerTextDrawColor(playerid, Cross[1], -1);
  203.     PlayerTextDrawSetOutline(playerid, Cross[1], 0);
  204.     PlayerTextDrawSetProportional(playerid, Cross[1], 1);
  205.     PlayerTextDrawSetShadow(playerid, Cross[1], 1);
  206.     PlayerTextDrawUseBox(playerid, Cross[1], 1);
  207.     PlayerTextDrawBoxColor(playerid, Cross[1], -1);
  208.     PlayerTextDrawTextSize(playerid, Cross[1], 0.000000, 13.000000);
  209.     return 1;
  210. }
  211.  
  212. public OnPlayerDisconnect(playerid, reason)
  213. {
  214.     Endflyeditor(playerid);
  215.     ResetAllValues(playerid);
  216.     pInfo[playerid][canuse] = false;
  217.     return 1;
  218. }
  219.  
  220. CMD:openeditor(playerid, params[])
  221. {
  222.     #if RCON_ADMINS_ONLY == true
  223.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WARNING,"Sorry, the object editor is for RCON admins only.");
  224.     #endif
  225.     #if TOGGLED_ONLY == true
  226.     if(pInfo[playerid][canuse] != 1) return SendClientMessage(playerid, COLOR_WARNING, "Sorry, you have to ask an admin first before you can use the object editor.");
  227.     #endif
  228.     if(pInfo[playerid][editing] == false)
  229.     {
  230.         SendClientMessage(playerid, -1, "[Editor {91FF91}ON{FFFFFF}]");
  231.         SendClientInfoMessage(playerid, "You have entered the object editor.");
  232.         pInfo[playerid][editing] = true;
  233.     }
  234.     else
  235.     {
  236.         SendClientMessage(playerid, -1, "[Editor {F58282}OFF{FFFFFF}]");
  237.         DeleteAllObjects(playerid);
  238.         ResetAllValues(playerid);
  239.         SendClientInfoMessage(playerid, "You have left the editor. | All your objects have been automatically deleted.");
  240.         pInfo[playerid][editing] = false;
  241.     }
  242.     return 1;
  243. }
  244.  
  245. CMD:cno(playerid, params[])
  246. {
  247.     #if USE_COMMAND_SHORTCUTS == true
  248.         return cmd_createnewobject(playerid, params);
  249.     #else
  250.         SendClientErrorMessage(playerid, 8);
  251.     #endif
  252. }
  253.  
  254. CMD:createnewobject(playerid, params[])
  255. {
  256.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  257.     new model, Float:distance;
  258.     if(sscanf(params, "iF(10.0)", model, distance))
  259.     {
  260.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /createnewobject [modelid] <distance>");
  261.         SendClientMessage(playerid, COLOR_USAGE2, "> Creates a new object using the defined model ID and distance.");
  262.         SendClientMessage(playerid, COLOR_USAGE2, "> If no distance is entered, the default value of 10.0m is used.");
  263.         #if USE_COMMAND_SHORTCUTS == true
  264.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /cno.");
  265.         #endif
  266.     }
  267.     else
  268.     {
  269.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  270.         {
  271.             #if USE_MAX_CREATE_DISTANCE == true
  272.             if(distance > MAX_CREATE_DISTANCE) return SendClientErrorMessage(playerid, 5);
  273.             #endif
  274.             for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  275.             {
  276.                 if(oInfo[playerid][i][created] == 0)
  277.                 {
  278.                     oInfo[playerid][i][created] = 1;
  279.                     if(pInfo[playerid][flyeditor] == 1)
  280.                     {
  281.                                 new
  282.                                     Float:fPX, Float:fPY, Float:fPZ,
  283.                                     Float:fVX, Float:fVY, Float:fVZ;
  284.                                 GetPlayerCameraPos(playerid, fPX, fPY, fPZ);
  285.                                 GetPlayerCameraFrontVector(playerid, fVX, fVY, fVZ);
  286.                                 oInfo[playerid][i][modelID]  = model;
  287.                                 oInfo[playerid][i][XLoc] = fPX + floatmul(fVX, distance);
  288.                                 oInfo[playerid][i][YLoc] = fPY + floatmul(fVY, distance);
  289.                                 oInfo[playerid][i][ZLoc] = fPZ + floatmul(fVZ, distance);
  290.                                 oInfo[playerid][i][XRot]     = 0.0;
  291.                                 oInfo[playerid][i][YRot]     = 0.0;
  292.                                 oInfo[playerid][i][ZRot]     = 0.0;
  293.                                 oInfo[playerid][i][objectID] = CreateObject(model,oInfo[playerid][i][XLoc], oInfo[playerid][i][YLoc], oInfo[playerid][i][ZLoc],0,0,0);
  294.                                 pInfo[playerid][totalobjects]        ++;
  295.                                 new string[100];
  296.                                 format(string, sizeof(string), "Created object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) %.1f meter infront of you.", i, oInfo[playerid][i][modelID], distance);
  297.                                 SendClientMessage(playerid, COLOR_INFO, string);
  298.                     }
  299.                     else
  300.                     {
  301.                         new Float:X, Float:Y, Float:Z;
  302.                         new Float:rot;
  303.                         GetPlayerPos(playerid, X, Y, Z);
  304.                         if(IsPlayerInAnyVehicle(playerid))
  305.                             GetVehicleZAngle(GetPlayerVehicleID(playerid), rot);
  306.                         else
  307.                             GetPlayerFacingAngle(playerid, rot);
  308.                         oInfo[playerid][i][modelID]  = model;
  309.                         oInfo[playerid][i][XLoc]     = X + (distance * floatsin(-rot, degrees));
  310.                         oInfo[playerid][i][YLoc]     = Y + (distance * floatcos(-rot, degrees));
  311.                         oInfo[playerid][i][ZLoc]     = Z;
  312.                         oInfo[playerid][i][XRot]     = 0.0;
  313.                         oInfo[playerid][i][YRot]     = 0.0;
  314.                         oInfo[playerid][i][ZRot]     = 0.0;
  315.                         oInfo[playerid][i][objectID] = CreateObject(model,X + (distance * floatsin(-rot, degrees)), Y + (distance * floatcos(-rot, degrees)), Z,0,0,0);
  316.                         pInfo[playerid][totalobjects]        ++;
  317.                         new string[100];
  318.                         format(string, sizeof(string), "Created object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) %.1f meter infront of you.", i, oInfo[playerid][i][modelID], distance);
  319.                         SendClientMessage(playerid, COLOR_INFO, string);
  320.                     }
  321.                     #if ALLOW_EDIT_OBJECT_ON_CREATE == true
  322.                     if(pInfo[playerid][EditObjectOnCreate] == true)
  323.                     {
  324.                         pInfo[playerid][editobject] = i;
  325.                         EditObject(playerid, oInfo[playerid][i][objectID]);
  326.                     }
  327.                     #endif
  328.                     break;
  329.                 }
  330.             }
  331.         }
  332.         else
  333.         {
  334.             SendClientErrorMessage(playerid, 2);
  335.         }
  336.     }
  337.     return 1;
  338. }
  339.  
  340. CMD:deo(playerid, params[])
  341. {
  342.     #if USE_COMMAND_SHORTCUTS == true
  343.         return cmd_deleteobject(playerid, params);
  344.     #else
  345.         SendClientErrorMessage(playerid, 8);
  346.     #endif
  347. }
  348.  
  349. CMD:deleteobject(playerid, params[])
  350. {
  351.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  352.     new object;
  353.     if(sscanf(params, "i", object))
  354.     {
  355.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /deleteobject [object number]");
  356.         SendClientMessage(playerid, COLOR_USAGE2, "> Deleted the defined object number.");
  357.         #if USE_COMMAND_SHORTCUTS == true
  358.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /deo.");
  359.         #endif
  360.     }
  361.     else
  362.     {
  363.         if(pInfo[playerid][totalobjects] !=0)
  364.         {
  365.             if(oInfo[playerid][object][created] == 1)
  366.             {
  367.                 DestroyObject(oInfo[playerid][object][objectID]);
  368.                 pInfo[playerid][totalobjects]--;
  369.                 new string[100];
  370.                 format(string, sizeof(string), "You have succesfully deleted object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}).", object, oInfo[playerid][object][modelID]);
  371.                 SendClientMessage(playerid, COLOR_INFO, string);
  372.                 oInfo[playerid][object][created]        = 0;
  373.                 oInfo[playerid][object][objectID]       = INVALID_OBJECT_ID;
  374.                 oInfo[playerid][object][modelID]        = 0;
  375.                 oInfo[playerid][object][XLoc]           = 0.0;
  376.                 oInfo[playerid][object][YLoc]           = 0.0;
  377.                 oInfo[playerid][object][ZLoc]           = 0.0;
  378.                 oInfo[playerid][object][XRot]           = 0.0;
  379.                 oInfo[playerid][object][YRot]           = 0.0;
  380.                 oInfo[playerid][object][ZRot]           = 0.0;
  381.                 oInfo[playerid][object][indexused]      = 0;
  382.                 oInfo[playerid][object][modelused]      = 0;
  383.                 oInfo[playerid][object][txdused]        = 0;
  384.                 oInfo[playerid][object][textureused]    = 0;
  385.                 oInfo[playerid][object][colorused]      = 0;
  386.                 oInfo[playerid][object][matindex]       = -1;
  387.                 oInfo[playerid][object][matmodel]       = -1;
  388.                 new str1[15], str2[15], str3[15];
  389.                 format(str1, sizeof(str1), "%i_txdname", object);
  390.                 format(str2, sizeof(str2), "%i_texturename", object);
  391.                 format(str3, sizeof(str3), "%i_color", object);
  392.                 DeletePVar(playerid, str1);
  393.                 DeletePVar(playerid, str2);
  394.                 DeletePVar(playerid, str3);
  395.                 oInfo[playerid][object][usesmaterial] = 0;
  396.             }
  397.             else
  398.             {
  399.                 SendClientErrorMessage(playerid, 0);
  400.             }
  401.         }
  402.         else
  403.         {
  404.             SendClientErrorMessage(playerid, 1);
  405.         }
  406.     }
  407.     return 1;
  408. }
  409.  
  410. CMD:deao(playerid, params[])
  411. {
  412.     #if USE_COMMAND_SHORTCUTS == true
  413.         return cmd_deleteallobjects(playerid, params);
  414.     #else
  415.         SendClientErrorMessage(playerid, 8);
  416.     #endif
  417. }
  418.  
  419. CMD:deleteallobjects(playerid, params[])
  420. {
  421.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  422.     if(pInfo[playerid][totalobjects] !=0)
  423.     {
  424.         DeleteAllObjects(playerid);
  425.         SendClientInfoMessage(playerid, "You have successfully deleted all objects.");
  426.     }
  427.     else SendClientErrorMessage(playerid, 1);
  428.     return 1;
  429. }
  430.  
  431. CMD:neo(playerid, params[])
  432. {
  433.     #if USE_COMMAND_SHORTCUTS == true
  434.         return cmd_nearestobject(playerid, params);
  435.     #else
  436.         SendClientErrorMessage(playerid, 8);
  437.     #endif
  438. }
  439.  
  440. CMD:nearestobject(playerid, params[])
  441. {
  442.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  443.     if(pInfo[playerid][totalobjects] != 0)
  444.     {
  445.         if(pInfo[playerid][flyeditor] == 1) return SendClientErrorMessage(playerid, 9);
  446.         new Float: px, Float: py, Float: pz;
  447.         new Float: oX, Float: oY, Float: oZ;
  448.         GetPlayerPos(playerid, px, py, pz);
  449.         new Float:currentdistance, Float:distance = 99999999.9;
  450.         new object;
  451.         for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  452.         {
  453.             GetObjectPos(oInfo[playerid][i][objectID], oX, oY, oZ);
  454.             currentdistance = GetPlayerDistanceFromPoint(playerid, oX, oY, oZ);
  455.             if(currentdistance < distance)
  456.             {
  457.                 object = i;
  458.                 distance = currentdistance;
  459.             }
  460.         }
  461.         new string[128];
  462.         format(string,sizeof(string),"The closest object to you is object number {F58282}%i{F5F582} (Distance: %.1fm).", object, distance);
  463.         SendClientInfoMessage(playerid, string);
  464.     }
  465.     else
  466.     {
  467.         SendClientErrorMessage(playerid, 1);
  468.     }
  469.     return 1;
  470. }
  471.  
  472. CMD:goo(playerid, params[])
  473. {
  474.     #if USE_COMMAND_SHORTCUTS == true
  475.         return cmd_gotoobject(playerid, params);
  476.     #else
  477.         SendClientErrorMessage(playerid, 8);
  478.     #endif
  479. }
  480.  
  481. CMD:gotoobject(playerid, params[])
  482. {
  483.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  484.     if(pInfo[playerid][flyeditor] == 1) return SendClientErrorMessage(playerid, 9);
  485.     new object;
  486.     if(sscanf(params, "i", object))
  487.     {
  488.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /gotoobject [object number]");
  489.         SendClientMessage(playerid, COLOR_USAGE2, "> Teleports you to the defined object number.");
  490.         #if USE_COMMAND_SHORTCUTS == true
  491.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /goo.");
  492.         #endif
  493.     }
  494.     else
  495.     {
  496.         if(pInfo[playerid][totalobjects] != 0)
  497.         {
  498.             if(oInfo[playerid][object][created] == 1)
  499.             {
  500.                 new Float:X, Float:Y, Float:Z;
  501.                 new string[100];
  502.                 GetObjectPos(oInfo[playerid][object][objectID], X, Y, Z);
  503.                 SetPlayerPos(playerid, X + 1.0, Y + 1.0, Z + 5.0);
  504.                 format(string, sizeof(string), "You have teleported yourself to object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}).", object, oInfo[playerid][object][modelID]);
  505.                 SendClientInfoMessage(playerid, string);
  506.             }
  507.             else
  508.             {
  509.                 SendClientErrorMessage(playerid, 0);
  510.             }
  511.         }
  512.         else
  513.         {
  514.             SendClientErrorMessage(playerid, 1);
  515.         }
  516.     }
  517.     return 1;
  518. }
  519.  
  520. CMD:rpom(playerid, params[])
  521. {
  522.     #if USE_COMMAND_SHORTCUTS == true
  523.         return cmd_replaceobjectmodel(playerid, params);
  524.     #else
  525.         SendClientErrorMessage(playerid, 8);
  526.     #endif
  527. }
  528.  
  529. CMD:replaceobjectmodel(playerid, params[])
  530. {
  531.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  532.     new object, model, oldmodel;
  533.     if(sscanf(params, "ii", object, model))
  534.     {
  535.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /replaceobjectmodel [object number] [new model]");
  536.         SendClientMessage(playerid, COLOR_USAGE2, "> Replaces the model of the defined object number with the new model.");
  537.         #if USE_COMMAND_SHORTCUTS == true
  538.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /rpom.");
  539.         #endif
  540.     }
  541.     else
  542.     {
  543.         if(pInfo[playerid][totalobjects] != 0)
  544.         {
  545.             if(oInfo[playerid][object][created] == 1)
  546.             {
  547.                 oldmodel = oInfo[playerid][object][modelID];
  548.                 DestroyObject(oInfo[playerid][object][objectID]);
  549.                 oInfo[playerid][object][objectID] = CreateObject(model, oInfo[playerid][object][XLoc],oInfo[playerid][object][YLoc],oInfo[playerid][object][ZLoc],oInfo[playerid][object][XRot],oInfo[playerid][object][YRot],oInfo[playerid][object][ZRot]);
  550.                 oInfo[playerid][object][modelID] = model;
  551.                 if(oInfo[playerid][object][usesmaterial] == 1){
  552.                     if(pInfo[playerid][KeepMaterial] == true){
  553.                             ChangeObjectMaterial(playerid, object);
  554.                     }
  555.                     else
  556.                         ResetObjectMaterial(playerid, object);
  557.                 }
  558.                 new string[135];
  559.                 format(string, sizeof(string), "You succesfully replaced the model of object {F58282}%i{F5F582} (Model: {F58282}%i{F5F582}) with model {F58282}%i{F5F582}.", object, oldmodel, model);
  560.                 SendClientInfoMessage(playerid, string);
  561.             }
  562.             else
  563.             {
  564.                 SendClientErrorMessage(playerid, 0);
  565.             }
  566.         }
  567.         else
  568.         {
  569.             SendClientErrorMessage(playerid, 1);
  570.         }
  571.     }
  572.     return 1;
  573. }
  574.  
  575. CMD:saveobjects(playerid, params[])
  576. {
  577.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  578.     {
  579.         new dg1[60];
  580.         format(dg1, sizeof(dg1), "Enter the name of the file you want to save the objects in:");
  581.         ShowPlayerDialog(playerid, DIALOG_MAP_SAVENAME, DIALOG_STYLE_INPUT,"Save objects",dg1,"Save","Cancel");
  582.     }
  583.     return 1;
  584. }
  585.  
  586. CMD:exportobjects(playerid, params[])
  587. {
  588.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  589.     #if ALLOW_EXPORT_MAP_FILE == false
  590.         if(IsPlayerAdmin(playerid))
  591.         {
  592.             new dg1[65];
  593.             format(dg1, sizeof(dg1), "Enter the name of the file you want to export the objects to:");
  594.             ShowPlayerDialog(playerid, DIALOG_MAP_EXPORTNAME, DIALOG_STYLE_INPUT,"Export name",dg1,"Export","Cancel");
  595.         }
  596.         else return SendClientErrorMessage(playerid, 3);
  597.     #else
  598.         new dg1[65];
  599.         format(dg1, sizeof(dg1), "Enter the name of the file you want to export the objects to:");
  600.         ShowPlayerDialog(playerid, DIALOG_MAP_EXPORTNAME, DIALOG_STYLE_INPUT,"Export name",dg1,"Export","Cancel");
  601.     #endif
  602.     return 1;
  603. }
  604.  
  605. CMD:loadobjects(playerid, params[])
  606. {
  607.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  608.     ShowPlayerDialog(playerid, DIALOG_MAP_LOAD, DIALOG_STYLE_INPUT, "Load map","Enter the name of the file you want to load:","Load","Cancel");
  609.     return 1;
  610. }
  611.  
  612. CMD:edo(playerid, params[])
  613. {
  614.     #if USE_COMMAND_SHORTCUTS == true
  615.         return cmd_editobject(playerid, params);
  616.     #else
  617.         SendClientErrorMessage(playerid, 8);
  618.     #endif
  619. }
  620.  
  621. CMD:editobject(playerid, params[])
  622. {
  623.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  624.     new object;
  625.     if(sscanf(params, "i", object))
  626.     {
  627.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /editobject [object number]");
  628.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to modify the position and rotation of the defined object number with your mouse.");
  629.         #if USE_COMMAND_SHORTCUTS == true
  630.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /edo.");
  631.         #endif
  632.     }
  633.     else
  634.     {
  635.         if(pInfo[playerid][totalobjects] !=0)
  636.         {
  637.             if(oInfo[playerid][object][created] == 1)
  638.             {
  639.                 EditObject(playerid, oInfo[playerid][object][objectID]);
  640.                 pInfo[playerid][editobject] = object;
  641.             }
  642.             else
  643.             {
  644.                 SendClientErrorMessage(playerid, 0);
  645.             }
  646.         }
  647.         else
  648.         {
  649.             SendClientErrorMessage(playerid, 1);
  650.         }
  651.     }
  652.     return 1;
  653. }
  654.  
  655. CMD:seo(playerid, params[])
  656. {
  657.     #if USE_COMMAND_SHORTCUTS == true
  658.         return cmd_selectobject(playerid, params);
  659.     #else
  660.         SendClientErrorMessage(playerid, 8);
  661.     #endif
  662. }
  663.  
  664. CMD:selectobject(playerid, params[])
  665. {
  666.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  667.     if(pInfo[playerid][totalobjects] !=0)
  668.     {
  669.         SelectObject(playerid);
  670.         SendClientInfoMessage(playerid, "You can now select an object by clicking onto it with your cursor.");
  671.     }
  672.     else SendClientErrorMessage(playerid, 1);
  673.     return 1;
  674. }
  675.  
  676. CMD:soxo(playerid, params[])
  677. {
  678.     #if USE_COMMAND_SHORTCUTS == true
  679.         return cmd_setobjectxoffset(playerid, params);
  680.     #else
  681.         SendClientErrorMessage(playerid, 8);
  682.     #endif
  683. }
  684.  
  685. CMD:setobjectxoffset(playerid, params[])
  686. {
  687.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  688.     new object, Float:offset;
  689.     if(sscanf(params, "if", object, offset))
  690.     {
  691.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectxoffset [object number] [value]");
  692.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to move the chosen object number on the X axis.");
  693.         SendClientMessage(playerid, COLOR_USAGE2, "> Positive values will move the object eastbound, negative values westbound.");
  694.         #if USE_COMMAND_SHORTCUTS == true
  695.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /soxo.");
  696.         #endif
  697.     }
  698.     else
  699.     {
  700.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  701.         {
  702.             #if USE_MAX_MOVE_DISTANCE == true
  703.             if(offset > MAX_MOVE_DISTANCE) return SendClientErrorMessage(playerid, 6);
  704.             #endif
  705.             if(oInfo[playerid][object][created] == 1)
  706.             {
  707.                 oInfo[playerid][object][XLoc]+=offset;
  708.                 SetObjectPos(oInfo[playerid][object][objectID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc]);
  709.                 new string[130];
  710.                 format(string, sizeof(string), "You have moved object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) {F58282}%.2f{F5F582}m on the X plane.", object, oInfo[playerid][object][modelID], offset);
  711.                 SendClientInfoMessage(playerid, string);
  712.             }
  713.             else SendClientErrorMessage(playerid, 0);
  714.         }
  715.         else
  716.         {
  717.             SendClientErrorMessage(playerid, 2);
  718.         }
  719.     }
  720.     return 1;
  721. }
  722.  
  723. CMD:soyo(playerid, params[])
  724. {
  725.     #if USE_COMMAND_SHORTCUTS == true
  726.         return cmd_setobjectyoffset(playerid, params);
  727.     #else
  728.         SendClientErrorMessage(playerid, 8);
  729.     #endif
  730. }
  731.  
  732. CMD:setobjectyoffset(playerid, params[])
  733. {
  734.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  735.     new object, Float:offset;
  736.     if(sscanf(params, "if", object, offset))
  737.     {
  738.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectyoffset [object number] [value]");
  739.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to move the chosen object number on the Y axis.");
  740.         SendClientMessage(playerid, COLOR_USAGE2, "> Positive values will move the object northbound, negative values southbound.");
  741.         #if USE_COMMAND_SHORTCUTS == true
  742.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /soyo.");
  743.         #endif
  744.     }
  745.     else
  746.     {
  747.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  748.         {
  749.             #if USE_MAX_MOVE_DISTANCE == true
  750.             if(offset > MAX_MOVE_DISTANCE) return SendClientErrorMessage(playerid, 6);
  751.             #endif
  752.             if(oInfo[playerid][object][created] == 1)
  753.             {
  754.                 oInfo[playerid][object][YLoc]+=offset;
  755.                 SetObjectPos(oInfo[playerid][object][objectID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc]);
  756.                 new string[128];
  757.                 format(string, sizeof(string), "You have moved object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) {F58282}%.2f{F5F582}m on the Y plane.", object, oInfo[playerid][object][modelID], offset);
  758.                 SendClientInfoMessage(playerid, string);
  759.             }
  760.             else SendClientErrorMessage(playerid, 0);
  761.         }
  762.         else
  763.         {
  764.             SendClientErrorMessage(playerid, 2);
  765.         }
  766.     }
  767.     return 1;
  768. }
  769.  
  770. CMD:sozo(playerid, params[])
  771. {
  772.     #if USE_COMMAND_SHORTCUTS == true
  773.         return cmd_setobjectzoffset(playerid, params);
  774.     #else
  775.         SendClientErrorMessage(playerid, 8);
  776.     #endif
  777. }
  778.  
  779. CMD:setobjectzoffset(playerid, params[])
  780. {
  781.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  782.     new object, Float:offset;
  783.     if(sscanf(params, "if", object, offset))
  784.     {
  785.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectzoffset [object number] [value]");
  786.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to move the chosen object number on the Z axis.");
  787.         SendClientMessage(playerid, COLOR_USAGE2, "> Positive values will move the object up, negative values down.");
  788.         #if USE_COMMAND_SHORTCUTS == true
  789.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /soyo.");
  790.         #endif
  791.     }
  792.     else
  793.     {
  794.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  795.         {
  796.             #if USE_MAX_MOVE_DISTANCE == true
  797.             if(offset > MAX_MOVE_DISTANCE) return SendClientErrorMessage(playerid, 6);
  798.             #endif
  799.             if(oInfo[playerid][object][created] == 1)
  800.             {
  801.                 oInfo[playerid][object][ZLoc]+=offset;
  802.                 SetObjectPos(oInfo[playerid][object][objectID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc]);
  803.                 new string[128];
  804.                 format(string, sizeof(string), "You have moved object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) {F58282}%.2f{F5F582}m on the Z plane.", object, oInfo[playerid][object][modelID], offset);
  805.                 SendClientInfoMessage(playerid, string);
  806.             }
  807.             else SendClientErrorMessage(playerid, 0);
  808.         }
  809.         else
  810.         {
  811.             SendClientErrorMessage(playerid, 2);
  812.         }
  813.     }
  814.     return 1;
  815. }
  816.  
  817. CMD:soxr(playerid, params[])
  818. {
  819.     #if USE_COMMAND_SHORTCUTS == true
  820.         return cmd_setobjectxrotation(playerid, params);
  821.     #else
  822.         SendClientErrorMessage(playerid, 8);
  823.     #endif
  824. }
  825.  
  826. CMD:setobjectxrotation(playerid, params[])
  827. {
  828.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  829.     new object, Float:rotation;
  830.     if(sscanf(params, "if", object, rotation))
  831.     {
  832.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectxrotation [object number] [value]");
  833.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to set the X rotation value of the defined object number.");
  834.         #if USE_COMMAND_SHORTCUTS == true
  835.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /soxr.");
  836.         #endif
  837.     }
  838.     else
  839.     {
  840.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  841.         {
  842.             if(oInfo[playerid][object][created] == 1)
  843.             {
  844.                 oInfo[playerid][object][XRot] = rotation;
  845.                 SetObjectRot(oInfo[playerid][object][objectID], oInfo[playerid][object][XRot], oInfo[playerid][object][YRot], oInfo[playerid][object][ZRot]);
  846.                 new string[140];
  847.                 format(string, sizeof(string), "You have set the X rotation of object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) to {F58282}%.2f{F5F582} degrees.", object, oInfo[playerid][object][modelID], rotation);
  848.                 SendClientInfoMessage(playerid, string);
  849.             }
  850.             else SendClientErrorMessage(playerid, 0);
  851.         }
  852.         else
  853.         {
  854.             SendClientErrorMessage(playerid, 2);
  855.         }
  856.     }
  857.     return 1;
  858. }
  859.  
  860. CMD:soyr(playerid, params[])
  861. {
  862.     #if USE_COMMAND_SHORTCUTS == true
  863.         return cmd_setobjectyrotation(playerid, params);
  864.     #else
  865.         SendClientErrorMessage(playerid, 8);
  866.     #endif
  867. }
  868.  
  869. CMD:setobjectyrotation(playerid, params[])
  870. {
  871.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  872.     new object, Float:rotation;
  873.     if(sscanf(params, "if", object, rotation))
  874.     {
  875.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectyrotation [object number] [value]");
  876.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to set the Y rotation value of the defined object number.");
  877.         #if USE_COMMAND_SHORTCUTS == true
  878.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /soyr.");
  879.         #endif
  880.     }
  881.     else
  882.     {
  883.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  884.         {
  885.             if(oInfo[playerid][object][created] == 1)
  886.             {
  887.                 oInfo[playerid][object][YRot] = rotation;
  888.                 SetObjectRot(oInfo[playerid][object][objectID], oInfo[playerid][object][XRot], oInfo[playerid][object][YRot], oInfo[playerid][object][ZRot]);
  889.                 new string[140];
  890.                 format(string, sizeof(string), "You have set the Y rotation of object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) to {F58282}%.2f{F5F582} degrees.", object, oInfo[playerid][object][modelID], rotation);
  891.                 SendClientInfoMessage(playerid, string);
  892.             }
  893.             else SendClientErrorMessage(playerid, 0);
  894.         }
  895.         else
  896.         {
  897.             SendClientErrorMessage(playerid, 2);
  898.         }
  899.     }
  900.     return 1;
  901. }
  902.  
  903. CMD:sozr(playerid, params[])
  904. {
  905.     #if USE_COMMAND_SHORTCUTS == true
  906.         return cmd_setobjectzrotation(playerid, params);
  907.     #else
  908.         SendClientErrorMessage(playerid, 8);
  909.     #endif
  910. }
  911.  
  912. CMD:setobjectzrotation(playerid, params[])
  913. {
  914.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  915.     new object, Float:rotation;
  916.     if(sscanf(params, "if", object, rotation))
  917.     {
  918.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectzrotation [object number] [value]");
  919.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to set the Z rotation value of the defined object number.");
  920.         #if USE_COMMAND_SHORTCUTS == true
  921.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /sozr.");
  922.         #endif
  923.     }
  924.     else
  925.     {
  926.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  927.         {
  928.             if(oInfo[playerid][object][created] == 1)
  929.             {
  930.                 oInfo[playerid][object][ZRot] = rotation;
  931.                 SetObjectRot(oInfo[playerid][object][objectID], oInfo[playerid][object][XRot], oInfo[playerid][object][YRot], oInfo[playerid][object][ZRot]);
  932.                 new string[140];
  933.                 format(string, sizeof(string), "You have set the Z rotation of object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) to {F58282}%.2f{F5F582} degrees.", object, oInfo[playerid][object][modelID], rotation);
  934.                 SendClientInfoMessage(playerid, string);
  935.             }
  936.             else SendClientErrorMessage(playerid, 0);
  937.         }
  938.         else
  939.         {
  940.             SendClientErrorMessage(playerid, 2);
  941.         }
  942.     }
  943.     return 1;
  944. }
  945.  
  946. CMD:sop(playerid, params[])
  947. {
  948.     #if USE_COMMAND_SHORTCUTS == true
  949.         return cmd_setobjectpos(playerid, params);
  950.     #else
  951.         SendClientErrorMessage(playerid, 8);
  952.     #endif
  953. }
  954.  
  955. CMD:setobjectpos(playerid, params[])
  956. {
  957.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  958.     new object, Float:X, Float:Y, Float:Z;
  959.     if(sscanf(params, "ifff", object, X, Y, Z))
  960.     {
  961.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectpos [object number] [X] [Y] [Z]");
  962.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to set the position of the defined object number to a certain coordinate.");
  963.         #if USE_COMMAND_SHORTCUTS == true
  964.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /sop.");
  965.         #endif
  966.     }
  967.     else
  968.     {
  969.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  970.         {
  971.             if(oInfo[playerid][object][created] == 1)
  972.             {
  973.                 oInfo[playerid][object][XLoc] = X;
  974.                 oInfo[playerid][object][YLoc] = Y;
  975.                 oInfo[playerid][object][ZLoc] = Z;
  976.                 SetObjectPos(oInfo[playerid][object][objectID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc]);
  977.                 new string[175];
  978.                 format(string, sizeof(string), "You have set the position of object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) to {F58282}%.2f{F5F582}, {F58282}%.2f{F5F582}, {F58282}%.2f{F5F582}.", object, oInfo[playerid][object][modelID], X, Y, Z);
  979.                 SendClientInfoMessage(playerid, string);
  980.             }
  981.             else SendClientErrorMessage(playerid, 0);
  982.         }
  983.         else
  984.         {
  985.             SendClientErrorMessage(playerid, 2);
  986.         }
  987.     }
  988.     return 1;
  989. }
  990.  
  991. CMD:saoxo(playerid, params[])
  992. {
  993.     #if USE_COMMAND_SHORTCUTS == true
  994.         return cmd_setallobjectsxoffset(playerid, params);
  995.     #else
  996.         SendClientErrorMessage(playerid, 8);
  997.     #endif
  998. }
  999.  
  1000. CMD:setallobjectsxoffset(playerid, params[])
  1001. {
  1002.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  1003.     new Float:offset;
  1004.     if(sscanf(params, "f", offset))
  1005.     {
  1006.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setallobjectsxoffset [value]");
  1007.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to move all your created objects on the X axis using the defined value.");
  1008.         SendClientMessage(playerid, COLOR_USAGE2, "> Positive values will move the objects eastbound, negative values westbound.");
  1009.         #if USE_COMMAND_SHORTCUTS == true
  1010.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /saoxo.");
  1011.         #endif
  1012.     }
  1013.     else
  1014.     {
  1015.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  1016.         {
  1017.             #if USE_MAX_MOVE_DISTANCE == true
  1018.             if(offset > MAX_MOVE_DISTANCE) return SendClientErrorMessage(playerid, 6);
  1019.             #endif
  1020.             for(new object = 0; object < MAX_CREATED_OBJECTS; object++)
  1021.             {
  1022.                 if(oInfo[playerid][object][created] == 1)
  1023.                 {
  1024.                     oInfo[playerid][object][XLoc]+=offset;
  1025.                     SetObjectPos(oInfo[playerid][object][objectID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc]);
  1026.                 }
  1027.             }
  1028.             new string[90];
  1029.             format(string, sizeof(string), "You have moved all objects you created {F58282}%.2f{F5F582}m on the X plane.", offset);
  1030.             SendClientInfoMessage(playerid, string);
  1031.         }
  1032.         else
  1033.         {
  1034.             SendClientErrorMessage(playerid, 2);
  1035.         }
  1036.     }
  1037.     return 1;
  1038. }
  1039.  
  1040. CMD:saoyo(playerid, params[])
  1041. {
  1042.     #if USE_COMMAND_SHORTCUTS == true
  1043.         return cmd_setallobjectsyoffset(playerid, params);
  1044.     #else
  1045.         SendClientErrorMessage(playerid, 8);
  1046.     #endif
  1047. }
  1048.  
  1049. CMD:setallobjectsyoffset(playerid, params[])
  1050. {
  1051.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  1052.     new Float:offset;
  1053.     if(sscanf(params, "f", offset))
  1054.     {
  1055.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setallobjectsyoffset [value]");
  1056.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to move all your created objects on the Y axis using the defined value.");
  1057.         SendClientMessage(playerid, COLOR_USAGE2, "> Positive values will move the objects northbound, negative values southbound.");
  1058.         #if USE_COMMAND_SHORTCUTS == true
  1059.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /saoyo.");
  1060.         #endif
  1061.     }
  1062.     else
  1063.     {
  1064.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  1065.         {
  1066.             #if USE_MAX_MOVE_DISTANCE == true
  1067.             if(offset > MAX_MOVE_DISTANCE) return SendClientErrorMessage(playerid, 6);
  1068.             #endif
  1069.             for(new object = 0; object < MAX_CREATED_OBJECTS; object++)
  1070.             {
  1071.                 if(oInfo[playerid][object][created] == 1)
  1072.                 {
  1073.                     oInfo[playerid][object][YLoc]+=offset;
  1074.                     SetObjectPos(oInfo[playerid][object][objectID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc]);
  1075.                 }
  1076.             }
  1077.             new string[90];
  1078.             format(string, sizeof(string), "You have moved all objects you created {F58282}%.2f{F5F582}m on the Y plane.", offset);
  1079.             SendClientInfoMessage(playerid, string);
  1080.         }
  1081.         else
  1082.         {
  1083.             SendClientErrorMessage(playerid, 2);
  1084.         }
  1085.     }
  1086.     return 1;
  1087. }
  1088.  
  1089. CMD:saozo(playerid, params[])
  1090. {
  1091.     #if USE_COMMAND_SHORTCUTS == true
  1092.         return cmd_setallobjectszoffset(playerid, params);
  1093.     #else
  1094.         SendClientErrorMessage(playerid, 8);
  1095.     #endif
  1096. }
  1097.  
  1098. CMD:setallobjectszoffset(playerid, params[])
  1099. {
  1100.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  1101.     new Float:offset;
  1102.     if(sscanf(params, "f", offset))
  1103.     {
  1104.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /setallobjectszoffset [value]");
  1105.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to move all your created objects on the Z axis using the defined value.");
  1106.         SendClientMessage(playerid, COLOR_USAGE2, "> Positive values will move the objects up, negative values down.");
  1107.         #if USE_COMMAND_SHORTCUTS == true
  1108.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /saozo.");
  1109.         #endif
  1110.     }
  1111.     else
  1112.     {
  1113.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  1114.         {
  1115.             #if USE_MAX_MOVE_DISTANCE == true
  1116.             if(offset > MAX_MOVE_DISTANCE) return SendClientErrorMessage(playerid, 6);
  1117.             #endif
  1118.             for(new object = 0; object < MAX_CREATED_OBJECTS; object++)
  1119.             {
  1120.                 if(oInfo[playerid][object][created] == 1)
  1121.                 {
  1122.                     oInfo[playerid][object][ZLoc]+=offset;
  1123.                     SetObjectPos(oInfo[playerid][object][objectID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc]);
  1124.                 }
  1125.             }
  1126.             new string[90];
  1127.             format(string, sizeof(string), "You have moved all objects you created {F58282}%.2f{F5F582}m on the Z plane.", offset);
  1128.             SendClientInfoMessage(playerid, string);
  1129.         }
  1130.         else
  1131.         {
  1132.             SendClientErrorMessage(playerid, 2);
  1133.         }
  1134.     }
  1135.     return 1;
  1136. }
  1137.  
  1138. CMD:duo(playerid, params[])
  1139. {
  1140.     #if USE_COMMAND_SHORTCUTS == true
  1141.         return cmd_duplicateobject(playerid, params);
  1142.     #else
  1143.         SendClientErrorMessage(playerid, 8);
  1144.     #endif
  1145. }
  1146.  
  1147. CMD:duplicateobject(playerid, params[])
  1148. {
  1149.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  1150.     new object, Float:X, Float:Y, Float:Z;
  1151.     if(sscanf(params, "ifff", object, X, Y, Z))
  1152.     {
  1153.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /duplicateobject [object number] [X Offset] [Y Offset] [Z Offset]");
  1154.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to \"copy\" and object with a defined distance from the original object.");
  1155.         #if USE_COMMAND_SHORTCUTS == true
  1156.         SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /duo.");
  1157.         #endif
  1158.     }
  1159.     else
  1160.     {
  1161.         if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  1162.         {
  1163.             if(oInfo[playerid][object][created] == 1)
  1164.             {
  1165.                 for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  1166.                 {
  1167.                     if(oInfo[playerid][i][created] == 0)
  1168.                     {
  1169.                         pInfo[playerid][editobject] = i;
  1170.                         oInfo[playerid][i][created] = 1;
  1171.                         oInfo[playerid][i][XLoc] = oInfo[playerid][object][XLoc] + X;
  1172.                         oInfo[playerid][i][YLoc] = oInfo[playerid][object][YLoc] + Y;
  1173.                         oInfo[playerid][i][ZLoc] = oInfo[playerid][object][ZLoc] + Z;
  1174.                         oInfo[playerid][i][XRot] = oInfo[playerid][object][XRot];
  1175.                         oInfo[playerid][i][YRot] = oInfo[playerid][object][YRot];
  1176.                         oInfo[playerid][i][ZRot] = oInfo[playerid][object][ZRot];  
  1177.                         oInfo[playerid][i][modelID] = oInfo[playerid][object][modelID];
  1178.                         oInfo[playerid][i][objectID] = CreateObject(oInfo[playerid][i][modelID], oInfo[playerid][i][XLoc], oInfo[playerid][i][YLoc], oInfo[playerid][i][ZLoc], oInfo[playerid][i][XRot], oInfo[playerid][i][YRot], oInfo[playerid][i][ZRot]);
  1179.                         if(pInfo[playerid][TransferMaterial] == true)
  1180.                         {
  1181.                             if(oInfo[playerid][object][usesmaterial] == 1)
  1182.                             {
  1183.                                 oInfo[playerid][i][usesmaterial]    = 1;
  1184.                                 oInfo[playerid][i][matindex]        = oInfo[playerid][object][matindex];
  1185.                                 oInfo[playerid][i][matmodel]        = oInfo[playerid][object][matmodel];
  1186.                                 oInfo[playerid][i][indexused]       = 1;
  1187.                                 oInfo[playerid][i][modelused]       = 1;
  1188.                                 oInfo[playerid][i][txdused]         = 1;
  1189.                                 oInfo[playerid][i][textureused]     = 1;
  1190.                                 oInfo[playerid][i][colorused]       = 1;
  1191.                                 new str[12], str2[16], str3[10];
  1192.                                 new newf[20], newf2[20], newf3[20];
  1193.                                 new txdname[25], texturename[25], color[25];
  1194.                                 format(str, sizeof(str), "%i_txdname", object);
  1195.                                 format(str2, sizeof(str2), "%i_texturename", object);
  1196.                                 format(str3, sizeof(str3), "%i_color", object);
  1197.                                 GetPVarString(playerid, str, txdname, sizeof(txdname));
  1198.                                 GetPVarString(playerid, str2, texturename, sizeof(texturename));
  1199.                                 GetPVarString(playerid, str3, color, sizeof(color));
  1200.                                 format(newf, sizeof(newf), "%i_txdname", i);
  1201.                                 format(newf2, sizeof(newf2), "%i_texturename", i);
  1202.                                 format(newf3, sizeof(newf3), "%i_color", i);
  1203.                                 SetPVarString(playerid, newf, txdname);
  1204.                                 SetPVarString(playerid, newf2, texturename);
  1205.                                 SetPVarString(playerid, newf3, color);
  1206.                                 ChangeObjectMaterial(playerid, i)
  1207.                             }
  1208.                         }
  1209.                         else
  1210.                             oInfo[playerid][i][usesmaterial] = 0;
  1211.                         pInfo[playerid][totalobjects]++;
  1212.                         new dupinfo[180], numinfo[70];
  1213.                         format(dupinfo, sizeof(dupinfo), "You have duplicated object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) with the offset {F58282}%.2f{F5F582}m, {F58282}%.2f{F5F582}m, {F58282}%.2f{F5F582}m.", object, oInfo[playerid][object][modelID], X, Y, Z);
  1214.                         format(numinfo, sizeof(numinfo), "The number of the new created object is {F58282}%i{F5F582}.", i);
  1215.                         SendClientInfoMessage(playerid, dupinfo);
  1216.                         SendClientInfoMessage(playerid, numinfo);
  1217.                         #if ALLOW_EDIT_OBJECT_ON_DUPLICATE == true
  1218.                         if(pInfo[playerid][EditObjectOnDuplicate] == true)
  1219.                         {
  1220.                             pInfo[playerid][editobject] = i;
  1221.                             EditObject(playerid, oInfo[playerid][i][objectID]);
  1222.                         }
  1223.                         #endif
  1224.                         break;
  1225.                     }
  1226.                 }
  1227.             }
  1228.             else SendClientErrorMessage(playerid, 0);
  1229.         }
  1230.         else
  1231.         {
  1232.             SendClientErrorMessage(playerid, 2);
  1233.         }
  1234.     }
  1235.     return 1;
  1236. }
  1237.  
  1238. CMD:som(playerid, params[])
  1239. {
  1240.     #if USE_COMMAND_SHORTCUTS == true
  1241.         return cmd_setobjectmaterial(playerid, params);
  1242.     #else
  1243.         SendClientErrorMessage(playerid, 8);
  1244.     #endif
  1245. }
  1246.  
  1247. CMD:setobjectmaterial(playerid, params[])
  1248. {
  1249.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  1250.     if(pInfo[playerid][UseMaterialDialog] == true)
  1251.     {
  1252.         new object;
  1253.         if(sscanf(params, "i", object))
  1254.         {
  1255.             SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectmaterial [object number]");
  1256.             SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to change the texture of the defined object number.");
  1257.             #if USE_COMMAND_SHORTCUTS == true
  1258.             SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /som.");
  1259.             #endif
  1260.         }
  1261.         else
  1262.         {
  1263.             if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  1264.             {
  1265.                 if(oInfo[playerid][object][created] == 1)
  1266.                 {
  1267.                     pInfo[playerid][editobject] = object;
  1268.                     ShowPlayerMaterialDialog(playerid, object);
  1269.                 }
  1270.                 else SendClientErrorMessage(playerid, 0);
  1271.             }
  1272.             else
  1273.             {
  1274.                 SendClientErrorMessage(playerid, 2);
  1275.             }
  1276.         }
  1277.     }
  1278.     else
  1279.     {
  1280.         new object, materialindex, mamodel, txdname[50], texturename[50], color[50];
  1281.         if(sscanf(params, "iiis[50]s[50]s[50]", object, materialindex, mamodel, txdname, texturename, color))
  1282.         {
  1283.             SendClientMessage(playerid, COLOR_USAGE, "Usage: /setobjectmaterial [object number] [materialindex] [modelid] [txdname] [texturename] [color]");
  1284.             SendClientMessage(playerid, COLOR_USAGE2, "> Allows you to change the texture of the defined object number.");
  1285.             SendClientMessage(playerid, COLOR_USAGE2, "> Materialindex = The part of the object you want to change.");
  1286.             SendClientMessage(playerid, COLOR_USAGE2, "> Modelid = The ID of the model the replacement texture is from (Use \"0\" for transparent).");
  1287.             SendClientMessage(playerid, COLOR_USAGE2, "> Txdname = The name of the .txd file which contains the texture (Use \"none\" for transparent).");
  1288.             SendClientMessage(playerid, COLOR_USAGE2, "> Texturename = The name of the texture (Use \"none\" for transparent).");
  1289.             SendClientMessage(playerid, COLOR_USAGE2, "> Color = The color you want to paint the texture with in AABBGGRR format. (Use \"0\" for default texture color).");
  1290.             #if USE_COMMAND_SHORTCUTS == true
  1291.             SendClientMessage(playerid, COLOR_USAGE2, "> The shortcut for this command is /som.");
  1292.             #endif
  1293.         }
  1294.         else
  1295.         {
  1296.             if(pInfo[playerid][totalobjects] < MAX_CREATED_OBJECTS)
  1297.             {
  1298.                 if(oInfo[playerid][object][created] == 1)
  1299.                 {
  1300.                     pInfo[playerid][editobject] = object;
  1301.                     oInfo[playerid][pInfo[playerid][editobject]][matindex]      = materialindex;
  1302.                     oInfo[playerid][pInfo[playerid][editobject]][matmodel]      = mamodel;
  1303.                     oInfo[playerid][pInfo[playerid][editobject]][txdused]       = 1;
  1304.                     oInfo[playerid][pInfo[playerid][editobject]][textureused]   = 1;
  1305.                     oInfo[playerid][pInfo[playerid][editobject]][colorused]     = 1;
  1306.                     oInfo[playerid][pInfo[playerid][editobject]][modelused]     = 1;
  1307.                     oInfo[playerid][pInfo[playerid][editobject]][indexused]     = 1;
  1308.                     new str[20];
  1309.                     format(str, sizeof(str), "%i_txdname", pInfo[playerid][editobject]);
  1310.                     SetPVarString(playerid, str, txdname);
  1311.                     new str2[20];
  1312.                     format(str2, sizeof(str2), "%i_texturename", pInfo[playerid][editobject]);
  1313.                     SetPVarString(playerid, str2, texturename);
  1314.                     new str3[20];
  1315.                     format(str3, sizeof(str3), "%i_color", pInfo[playerid][editobject]);
  1316.                     if(!strlen(color))
  1317.                         SetPVarString(playerid, str3, "0");
  1318.                     else
  1319.                         SetPVarString(playerid, str3, color);
  1320.                     ChangeObjectMaterial(playerid, pInfo[playerid][editobject]);
  1321.                 }
  1322.                 else SendClientErrorMessage(playerid, 0);
  1323.             }
  1324.             else
  1325.             {
  1326.                 SendClientErrorMessage(playerid, 2);
  1327.             }
  1328.         }
  1329.     }
  1330.     return 1;
  1331. }
  1332.  
  1333. CMD:editorsettings(playerid, params[])
  1334. {
  1335.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  1336.     ShowPlayerSettingsMenu(playerid);
  1337.     return 1;
  1338. }
  1339.  
  1340. CMD:editorcommands(playerid, params[])
  1341. {
  1342.     ShowPlayerCommandHelp(playerid);
  1343.     return 1;
  1344. }
  1345.  
  1346. CMD:esettingshelp(playerid, params[])
  1347. {
  1348.     ShowPlayerSettingsHelp(playerid);
  1349.     return 1;
  1350. }
  1351.  
  1352. CMD:fm(playerid, params[])
  1353. {
  1354.     #if USE_COMMAND_SHORTCUTS == true
  1355.         return cmd_flyeditor(playerid, params);
  1356.     #else
  1357.         SendClientErrorMessage(playerid, 8);
  1358.     #endif
  1359. }
  1360.  
  1361. CMD:flyeditor(playerid, params[])
  1362. {
  1363.     if(pInfo[playerid][editing] != true) return SendClientErrorMessage(playerid, 7);
  1364.     if(pInfo[playerid][flyeditor] == 0)
  1365.         Startflyeditor(playerid);
  1366.     else
  1367.         Endflyeditor(playerid);
  1368.     return 1;
  1369. }
  1370.  
  1371. CMD:toggleeditor(playerid, params[])
  1372. {
  1373.     #if TOGGLED_ONLY == true
  1374.     new pID;
  1375.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WARNING, "Sorry, this command can only be used by RCON admins.");
  1376.     if(sscanf(params, "r", pID))
  1377.     {
  1378.         SendClientMessage(playerid, COLOR_USAGE, "Usage: /toggleeditor [playerid]");
  1379.         SendClientMessage(playerid, COLOR_USAGE2, "> Allows a player to use the object editor.");
  1380.     }
  1381.     else
  1382.     {
  1383.         if(IsPlayerConnected(pID))
  1384.         {
  1385.             if(pInfo[playerid][canuse] == 0)
  1386.             {
  1387.                 pInfo[playerid][canuse] = 1;
  1388.                 new togglename[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
  1389.                 GetPlayerName(pID, togglename, MAX_PLAYER_NAME);
  1390.                 GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
  1391.                 new string[100], string2[100];
  1392.                 format(string, sizeof(string), "You have allowed %s to use the object editor.", togglename);
  1393.                 format(string2, sizeof(string2), "Admin %s has allowed you to use the object editor.", adminname);
  1394.                 SendClientInfoMessage(playerid, string);
  1395.                 SendClientInfoMessage(pID, string2);
  1396.             }
  1397.             else
  1398.             {
  1399.                 pInfo[playerid][canuse] = 0;
  1400.                 new togglename[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME];
  1401.                 GetPlayerName(pID, togglename, MAX_PLAYER_NAME);
  1402.                 GetPlayerName(playerid, adminname, MAX_PLAYER_NAME);
  1403.                 new string[100], string2[100];
  1404.                 format(string, sizeof(string), "You have taken %s the permission to use the object editor.", togglename);
  1405.                 format(string2, sizeof(string2), "Admin %s has taken you the permission to use the object editor.", adminname);
  1406.                 SendClientInfoMessage(playerid, string);
  1407.                 SendClientInfoMessage(pID, string2);
  1408.                 if(pInfo[pID][editing] == true)
  1409.                 {
  1410.                     SendClientMessage(playerid, -1, "[Editor {F58282}OFF{FFFFFF}]");
  1411.                     DeleteAllObjects(playerid);
  1412.                     ResetAllValues(playerid);
  1413.                     SendClientInfoMessage(playerid, "You have left the editor. | All your objects have been automatically deleted.");
  1414.                     pInfo[playerid][editing] = false;
  1415.                 }
  1416.             }
  1417.         }
  1418.         else SendClientErrorMessage(playerid, 10);
  1419.     }
  1420.     #else
  1421.     SendClientMessage(playerid, COLOR_WARNING, "The editor is free for everyone, you don't have to give permissions.");
  1422.     #endif
  1423.     return 1;
  1424. }
  1425.  
  1426. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  1427. {
  1428.     if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
  1429.     {
  1430.         if((pInfo[playerid][flyeditor] == 1) && (pInfo[playerid][editing] == true))
  1431.         {
  1432.             if(pInfo[playerid][totalobjects] == 0) return SendClientErrorMessage(playerid, 1);
  1433.             SelectObject(playerid);
  1434.         }
  1435.     }
  1436.     return 1;
  1437. }
  1438.  
  1439. public OnPlayerUpdate(playerid)
  1440. {
  1441.     if((pInfo[playerid][editing] == true) && (pInfo[playerid][flyeditor] == 1))
  1442.     {
  1443.         new keys,ud,lr;
  1444.         GetPlayerKeys(playerid,keys,ud,lr);
  1445.         if(pInfo[playerid][mode] && (GetTickCount() - pInfo[playerid][lastmove] > 100))
  1446.         {
  1447.             MoveCamera(playerid);
  1448.         }
  1449.  
  1450.         if(pInfo[playerid][udold] != ud || pInfo[playerid][lrold] != lr)
  1451.         {
  1452.             if((pInfo[playerid][udold] != 0 || pInfo[playerid][lrold] != 0) && ud == 0 && lr == 0)
  1453.             {
  1454.                 StopPlayerObject(playerid, pInfo[playerid][flyobject]);
  1455.                 pInfo[playerid][mode]      = 0;
  1456.                 pInfo[playerid][accelmul]  = 0.0;
  1457.             }
  1458.             else
  1459.             {
  1460.  
  1461.                 pInfo[playerid][mode] = GetMoveDirectionFromKeys(ud, lr);
  1462.                 MoveCamera(playerid);
  1463.             }
  1464.         }
  1465.         pInfo[playerid][udold] = ud; pInfo[playerid][lrold] = lr;
  1466.         return 0;
  1467.     }
  1468.     return 1;
  1469. }
  1470.  
  1471. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1472. {
  1473.     switch(dialogid)
  1474.     {
  1475.         case DIALOG_MAP_SAVENAME:
  1476.         {
  1477.             if(response)
  1478.             {
  1479.                 if(strlen(inputtext))
  1480.                 {
  1481.                     SaveMap(playerid, inputtext);
  1482.                 }
  1483.                 else
  1484.                 {
  1485.                     new dg1[101];
  1486.                     format(dg1, sizeof(dg1), "Enter the name of the file you want to save the objects in:\n\n{F58282}You need to enter a file name.");
  1487.                     ShowPlayerDialog(playerid, DIALOG_MAP_SAVENAME, DIALOG_STYLE_INPUT,"Save name",dg1,"Save","Cancel");
  1488.                 }
  1489.             }
  1490.         }
  1491.         case DIALOG_MAP_EXPORTNAME:
  1492.         {
  1493.             if(response)
  1494.             {
  1495.                 if(strlen(inputtext))
  1496.                 {
  1497.                     ExportMap(playerid, inputtext);
  1498.                 }
  1499.                 else
  1500.                 {
  1501.                     new dg1[103];
  1502.                     format(dg1, sizeof(dg1), "Enter the name of the file you want to export the objects to:\n\n{F58282}You need to enter a file name.");
  1503.                     ShowPlayerDialog(playerid, DIALOG_MAP_EXPORTNAME, DIALOG_STYLE_INPUT,"Export name",dg1,"Export","Cancel");
  1504.                 }
  1505.             }
  1506.         }
  1507.         case DIALOG_MAP_LOAD:
  1508.         {
  1509.             if(response)
  1510.             {
  1511.                 if(strlen(inputtext))
  1512.                 {
  1513.                     LoadMap(playerid, inputtext);
  1514.                 }
  1515.                 else
  1516.                 {
  1517.                     new dg1[86];
  1518.                     format(dg1, sizeof(dg1), "Enter the name of the file you want to load:\n\n{F58282}You need to enter a file name.");
  1519.                     ShowPlayerDialog(playerid, DIALOG_MAP_LOAD, DIALOG_STYLE_INPUT, "Load map",dg1,"Load","Cancel");
  1520.                 }
  1521.             }
  1522.         }
  1523.         case DIALOG_SELECTMENU:
  1524.         {
  1525.             if(response)
  1526.             {
  1527.                 switch(listitem)
  1528.                 {
  1529.                     case 0:
  1530.                     {
  1531.                         EditObject(playerid, oInfo[playerid][pInfo[playerid][editobject]][objectID]);
  1532.                     }  
  1533.                     case 1:
  1534.                     {
  1535.                         ShowPlayerDialog(playerid, DIALOG_CHANGEMODEL, DIALOG_STYLE_INPUT,"Replacement model","Enter the model ID you want to replace the object with","Replace","Cancel");
  1536.                     }
  1537.                     case 2:
  1538.                     {
  1539.                         new object = pInfo[playerid][editobject];
  1540.                         DestroyObject(oInfo[playerid][object][objectID]);
  1541.                         pInfo[playerid][totalobjects]--;
  1542.                         new string[88];
  1543.                         format(string, sizeof(string), "You have succesfully deleted object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}).", object, oInfo[playerid][object][modelID]);
  1544.                         SendClientMessage(playerid, COLOR_INFO, string);
  1545.                         oInfo[playerid][object][created]        = 0;
  1546.                         oInfo[playerid][object][objectID]       = INVALID_OBJECT_ID;
  1547.                         oInfo[playerid][object][modelID]        = 0;
  1548.                         oInfo[playerid][object][XLoc]           = 0.0;
  1549.                         oInfo[playerid][object][YLoc]           = 0.0;
  1550.                         oInfo[playerid][object][ZLoc]           = 0.0;
  1551.                         oInfo[playerid][object][XRot]           = 0.0;
  1552.                         oInfo[playerid][object][YRot]           = 0.0;
  1553.                         oInfo[playerid][object][ZRot]           = 0.0;
  1554.                         oInfo[playerid][object][indexused]      = 0;
  1555.                         oInfo[playerid][object][modelused]      = 0;
  1556.                         oInfo[playerid][object][txdused]        = 0;
  1557.                         oInfo[playerid][object][textureused]    = 0;
  1558.                         oInfo[playerid][object][colorused]      = 0;
  1559.                         oInfo[playerid][object][matindex]       = -1;
  1560.                         oInfo[playerid][object][matmodel]       = -1;
  1561.                         new str1[20], str2[20], str3[20];
  1562.                         format(str1, sizeof(str1), "%i_txdname", object);
  1563.                         format(str2, sizeof(str2), "%i_texturename", object);
  1564.                         format(str3, sizeof(str3), "%i_color", object);
  1565.                         DeletePVar(playerid, str1);
  1566.                         DeletePVar(playerid, str2);
  1567.                         DeletePVar(playerid, str3);
  1568.                         oInfo[playerid][object][usesmaterial] = 0;
  1569.                     }
  1570.                 }
  1571.             }
  1572.         }
  1573.         case DIALOG_CHANGEMODEL:
  1574.         {
  1575.             if(response)
  1576.             {
  1577.                 if(strlen(inputtext))
  1578.                 {
  1579.                     if(IsNumeric(inputtext))
  1580.                     {
  1581.                         new model, oldmodel;
  1582.                         new object = pInfo[playerid][editobject];
  1583.                         oldmodel = oInfo[playerid][object][modelID];
  1584.                         model = strval(inputtext);
  1585.                         DestroyObject(oInfo[playerid][object][objectID]);
  1586.                         oInfo[playerid][object][objectID] = CreateObject(model, oInfo[playerid][object][XLoc],oInfo[playerid][object][YLoc],oInfo[playerid][object][ZLoc],oInfo[playerid][object][XRot],oInfo[playerid][object][YRot],oInfo[playerid][object][ZRot]);
  1587.                         oInfo[playerid][object][modelID] = model;
  1588.                         new string[128];
  1589.                         if(pInfo[playerid][KeepMaterial] == true)
  1590.                             ChangeObjectMaterial(playerid, object);
  1591.                         else
  1592.                             ResetObjectMaterial(playerid, object);
  1593.                         format(string, sizeof(string), "You succesfully replaced the model of object {F58282}%i{F5F582} (Model: {F58282}%i{F5F582}) with model {F58282}%i{F5F582}.", object, oldmodel, model);
  1594.                         SendClientInfoMessage(playerid, string);
  1595.                     }
  1596.                     else ShowPlayerDialog(playerid, DIALOG_CHANGEMODEL, DIALOG_STYLE_INPUT,"Replacement model","Enter the model ID you want to replace the object with\n\n{91FF91}You may enter numbers only.","Replace","Cancel");
  1597.                 }
  1598.                 else ShowPlayerDialog(playerid, DIALOG_CHANGEMODEL, DIALOG_STYLE_INPUT,"Replacement model","Enter the model ID you want to replace the object with\n\n{91FF91}You need to enter a value.","Replace","Cancel");
  1599.             }
  1600.         }
  1601.         case DIALOG_SETTINGS:
  1602.         {
  1603.             if(response)
  1604.             {
  1605.                 switch(listitem)
  1606.                 {
  1607.                     case 0:
  1608.                     {
  1609.                         #if ALLOW_EDIT_OBJECT_ON_CREATE == true
  1610.                             if(pInfo[playerid][EditObjectOnCreate] == true)
  1611.                                 pInfo[playerid][EditObjectOnCreate] = false;
  1612.                             else
  1613.                                 pInfo[playerid][EditObjectOnCreate] = true;
  1614.                         #endif
  1615.                     }
  1616.                     case 1:
  1617.                     {
  1618.                         #if ALLOW_EDIT_OBJECT_ON_DUPLICATE == true
  1619.                             if(pInfo[playerid][EditObjectOnDuplicate] == true)
  1620.                                 pInfo[playerid][EditObjectOnDuplicate] = false;
  1621.                             else
  1622.                                 pInfo[playerid][EditObjectOnDuplicate] = true;
  1623.                         #endif
  1624.                     }
  1625.                     case 2:
  1626.                     {
  1627.                         #if ALLOW_USE_MATERIAL_CHANGE_DIALOG == true
  1628.                             if(pInfo[playerid][UseMaterialDialog] == true)
  1629.                                 pInfo[playerid][UseMaterialDialog] = false;
  1630.                             else
  1631.                                 pInfo[playerid][UseMaterialDialog] = true;
  1632.                         #endif
  1633.                     }
  1634.                     case 3:
  1635.                     {
  1636.                         #if ALLOW_TRANSFER_MATERIAL == true
  1637.                             if(pInfo[playerid][TransferMaterial] == true)
  1638.                                 pInfo[playerid][TransferMaterial] = false;
  1639.                             else
  1640.                                 pInfo[playerid][TransferMaterial] = true;
  1641.                         #endif
  1642.                     }
  1643.                     case 4:
  1644.                     {
  1645.                         #if ALLOW_KEEP_MATERIAL == true
  1646.                             if(pInfo[playerid][KeepMaterial] == true)
  1647.                                 pInfo[playerid][KeepMaterial] = false;
  1648.                             else
  1649.                                 pInfo[playerid][KeepMaterial] = true;
  1650.                         #endif
  1651.                     }
  1652.                     case 5:
  1653.                     {
  1654.                         #if ALLOW_USE_CROSS == true
  1655.                             if(pInfo[playerid][UseCross] == true)
  1656.                             {
  1657.                                 pInfo[playerid][UseCross] = false;
  1658.                                 PlayerTextDrawHide(playerid, Cross[0]);
  1659.                                 PlayerTextDrawHide(playerid, Cross[1]);
  1660.                             }
  1661.                             else
  1662.                             {
  1663.                                 pInfo[playerid][UseCross] = true;
  1664.                                 if(pInfo[playerid][flyeditor] == 1)
  1665.                                 {
  1666.                                     PlayerTextDrawShow(playerid, Cross[0]);
  1667.                                     PlayerTextDrawShow(playerid, Cross[1]);
  1668.                                 }
  1669.                             }
  1670.                         #endif
  1671.                     }
  1672.                 }
  1673.                 ShowPlayerSettingsMenu(playerid);
  1674.             }
  1675.         }
  1676.         case DIALOG_MATERIALS:
  1677.         {
  1678.             if(response)
  1679.             {
  1680.                 switch(listitem)
  1681.                 {
  1682.                     case 0: //materialindex
  1683.                     {
  1684.                         ShowPlayerDialog(playerid, DIALOG_MATERIALINDEX, DIALOG_STYLE_INPUT, "Materialindex","Enter the index (part) you want to change of the object:","Set","Back");
  1685.                     }
  1686.                     case 1: //modelid
  1687.                     {
  1688.                         new dg1[135];
  1689.                         format(dg1, sizeof(dg1), "Enter the model ID of the object on which the replacement texture is located\n\n{F5F582}Note: {A9C4E4}Use \"0\" for alpha (transparent)");
  1690.                         ShowPlayerDialog(playerid, DIALOG_MODELID, DIALOG_STYLE_INPUT,"Model ID",dg1,"Set","Back");
  1691.                     }
  1692.                     case 2: //txdname
  1693.                     {
  1694.                         new dg1[131];
  1695.                         format(dg1, sizeof(dg1), "Enter the name of the .txd file the replacement texture is located at\n\n{F5F582}Note: {A9C4E4}Use \"none\" for alpha (transparent)");
  1696.                         ShowPlayerDialog(playerid, DIALOG_TXDNAME, DIALOG_STYLE_INPUT,"TXD file name",dg1,"Set","Back");
  1697.                     }
  1698.                     case 3: //texturename
  1699.                     {
  1700.                         new dg1[121];
  1701.                         format(dg1, sizeof(dg1), "Enter the name of the texture you want to put on the object\n\n{F5F582}Note: {A9C4E4}Use \"none\" for alpha (transparent)");
  1702.                         ShowPlayerDialog(playerid, DIALOG_TEXTURENAME, DIALOG_STYLE_INPUT,"Texture name",dg1,"Set","Back");
  1703.                     }
  1704.                     case 4: //color
  1705.                     {
  1706.                         new dg1[64], dg2[150], dg3[64], dial[300];
  1707.                         format(dg1, sizeof(dg1), "Enter a color you want to pain the texture with");
  1708.                         format(dg2, sizeof(dg2), "{F58282}Important: {A9C4E4}The color has to be in {FFFFFF}AA{0069FF}BB{00FF00}GG{FF0000}RR {A9C4E4}format.\nExample: FF00FF00 (green)");
  1709.                         format(dg3, sizeof(dg3), "\n{F5F582}Note: {A9C4E4}Use \"0\" to use the default color of the texture.");
  1710.                         format(dial, sizeof(dial), "%s\n%s\n%s", dg1, dg2, dg3);
  1711.                         ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_INPUT,"Color",dial,"Set","Back");
  1712.                     }
  1713.                     case 5: //continue
  1714.                     {
  1715.                         if(IsAllFilledOut(playerid, pInfo[playerid][editobject]))
  1716.                             ChangeObjectMaterial(playerid, pInfo[playerid][editobject]);
  1717.                         else ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1718.                     }
  1719.                     case 6: //remove texture
  1720.                     {
  1721.                         if(oInfo[playerid][pInfo[playerid][editobject]][usesmaterial] == 1)
  1722.                             ResetObjectMaterial(playerid, pInfo[playerid][editobject]);
  1723.                         else ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1724.                     }
  1725.                 }
  1726.             }
  1727.         }
  1728.         case DIALOG_MATERIALINDEX:
  1729.         {
  1730.             if(response)
  1731.             {
  1732.                 if(strlen(inputtext))
  1733.                 {
  1734.                     if(IsNumeric(inputtext))
  1735.                     {
  1736.                         oInfo[playerid][pInfo[playerid][editobject]][indexused] = 1;
  1737.                         oInfo[playerid][pInfo[playerid][editobject]][matindex] = strval(inputtext);
  1738.                         ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1739.                     }
  1740.                     else ShowPlayerDialog(playerid, DIALOG_MATERIALINDEX, DIALOG_STYLE_INPUT, "Materialindex","Enter the index (part) you want to change of the object:\n{F58282}You may enter numbers only.","Set","Back");
  1741.                 }
  1742.                 else ShowPlayerDialog(playerid, DIALOG_MATERIALINDEX, DIALOG_STYLE_INPUT, "Materialindex","Enter the index (part) you want to change of the object:\n{F58282}You need to enter a value.","Set","Back");
  1743.             }
  1744.             else ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1745.         }
  1746.         case DIALOG_MODELID:
  1747.         {
  1748.             if(response)
  1749.             {
  1750.                 if(strlen(inputtext))
  1751.                 {
  1752.                     if(IsNumeric(inputtext))
  1753.                     {
  1754.                         oInfo[playerid][pInfo[playerid][editobject]][modelused] = 1;
  1755.                         oInfo[playerid][pInfo[playerid][editobject]][matmodel] = strval(inputtext);
  1756.                         ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1757.                     }
  1758.                     else
  1759.                     {
  1760.                         new dg1[135], dg2[35], dial[200];
  1761.                         format(dg1, sizeof(dg1), "Enter the model ID of the object on which the replacement texture is located\n\n{F5F582}Note: {A9C4E4}Use \"0\" for alpha (transparent)");
  1762.                         format(dg2, sizeof(dg2), "{F58282}You may only enter numbers.");
  1763.                         format(dial, sizeof(dial), "%s\n\n%s", dg1, dg2);
  1764.                         ShowPlayerDialog(playerid, DIALOG_MODELID, DIALOG_STYLE_INPUT,"Model ID",dial,"Set","Back");
  1765.                     }
  1766.                 }
  1767.                 else
  1768.                 {
  1769.                     new dg1[135], dg2[35], dial[200];
  1770.                     format(dg1, sizeof(dg1), "Enter the model ID of the object on which the replacement texture is located\n\n{F5F582}Note: {A9C4E4}Use \"0\" for alpha (transparent)");
  1771.                     format(dg2, sizeof(dg2), "{F58282}You need to enter a value.");
  1772.                     format(dial, sizeof(dial), "%s\n\n%s", dg1, dg2);
  1773.                     ShowPlayerDialog(playerid, DIALOG_MODELID, DIALOG_STYLE_INPUT,"Model ID",dial,"Set","Back");
  1774.                 }
  1775.             }
  1776.             else ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1777.         }
  1778.         case DIALOG_TXDNAME:
  1779.         {
  1780.             if(response)
  1781.             {
  1782.                 if(strlen(inputtext))
  1783.                 {
  1784.                     new str[20];
  1785.                     format(str, sizeof(str), "%i_txdname", pInfo[playerid][editobject]);
  1786.                     SetPVarString(playerid, str, inputtext);
  1787.                     oInfo[playerid][pInfo[playerid][editobject]][txdused] = 1;
  1788.                     ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1789.                 }
  1790.                 else
  1791.                 {
  1792.                     new dg1[131], dg2[35], dial[200];
  1793.                     format(dg1, sizeof(dg1), "Enter the name of the .txd file the replacement texture is located at\n\n{F5F582}Note: {A9C4E4}Use \"none\" for alpha (transparent)");
  1794.                     format(dg2, sizeof(dg2), "{F58282}You need to enter a name.");
  1795.                     format(dial, sizeof(dial), "%s\n\n%s", dg1, dg2);
  1796.                     ShowPlayerDialog(playerid, DIALOG_TXDNAME, DIALOG_STYLE_INPUT,"TXD file name",dial,"Set","Back");
  1797.                 }
  1798.             }
  1799.             else ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1800.         }
  1801.         case DIALOG_TEXTURENAME:
  1802.         {
  1803.             if(response)
  1804.             {
  1805.                 if(strlen(inputtext))
  1806.                 {
  1807.                     new str[20];
  1808.                     format(str, sizeof(str), "%i_texturename", pInfo[playerid][editobject]);
  1809.                     SetPVarString(playerid, str, inputtext);
  1810.                     oInfo[playerid][pInfo[playerid][editobject]][textureused] = 1;
  1811.                     ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1812.                 }
  1813.                 else
  1814.                 {
  1815.                     new dg1[121], dg2[35], dial[200];
  1816.                     format(dg1, sizeof(dg1), "Enter the name of the texture you want to put on the object\n\n{F5F582}Note: {A9C4E4}Use \"none\" for alpha (transparent)");
  1817.                     format(dg2, sizeof(dg2), "{F58282}You need to enter a text.");
  1818.                     format(dial, sizeof(dial), "%s\n\n%s", dg1, dg2);
  1819.                     ShowPlayerDialog(playerid, DIALOG_TEXTURENAME, DIALOG_STYLE_INPUT,"Texture name",dial,"Set","Back");
  1820.                 }
  1821.             }
  1822.             else ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1823.         }
  1824.         case DIALOG_COLOR:
  1825.         {
  1826.             if(response)
  1827.             {
  1828.                 if(strlen(inputtext))
  1829.                 {
  1830.                     new str[20];
  1831.                     format(str, sizeof(str), "%i_color", pInfo[playerid][editobject]);
  1832.                     SetPVarString(playerid, str, inputtext);
  1833.                     oInfo[playerid][pInfo[playerid][editobject]][colorused] = 1;
  1834.                     ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1835.                 }
  1836.                 else
  1837.                 {
  1838.                     new dg1[50], dg2[150], dg3[50], dg4[50], dial[512];
  1839.                     format(dg1, sizeof(dg1), "Enter a color you want to paint the texture with.");
  1840.                     format(dg2, sizeof(dg2), "{F58282}Important: {A9C4E4}The color has to be in {FFFFFF}AA{0069FF}BB{00FF00}GG{FF0000}RR {A9C4E4}format.\n\tExample: FF00FF00 (green).");
  1841.                     format(dg3, sizeof(dg3), "\n{F5F582}Note: {A9C4E4}Use \"0\" for alpha (transparent).");
  1842.                     format(dg4, sizeof(dg4), "{F58282}You need to enter a color.");
  1843.                     format(dial, sizeof(dial), "%s\n%s\n\n%s\n\n%s", dg1, dg2, dg3, dg4);
  1844.                     ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_INPUT,"Color",dial,"Set","Back");
  1845.                 }
  1846.             }
  1847.             else ShowPlayerMaterialDialog(playerid, pInfo[playerid][editobject]);
  1848.         }
  1849.         case DIALOG_EDITORCOMMANDS:
  1850.         {
  1851.             if(!response)
  1852.             {
  1853.                 ShowPlayerCommandHelp2(playerid);
  1854.             }
  1855.         }
  1856.         case DIALOG_EDITORCOMMANDS2:
  1857.         {
  1858.             if(response)
  1859.             {
  1860.                 ShowPlayerCommandHelp(playerid);
  1861.             }
  1862.         }
  1863.     }
  1864.     return 1;
  1865. }
  1866.  
  1867. public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
  1868. {
  1869.     if(objectid == oInfo[playerid][pInfo[playerid][editobject]][objectID])
  1870.     {
  1871.         if(response == EDIT_RESPONSE_FINAL)
  1872.         {
  1873.             new object = pInfo[playerid][editobject];
  1874.             oInfo[playerid][object][XLoc] = fX;
  1875.             oInfo[playerid][object][YLoc] = fY;
  1876.             oInfo[playerid][object][ZLoc] = fZ;
  1877.             oInfo[playerid][object][XRot] = fRotX;
  1878.             oInfo[playerid][object][YRot] = fRotY;
  1879.             oInfo[playerid][object][ZRot] = fRotZ;
  1880.             SetObjectPos(oInfo[playerid][object][objectID], fX, fY, fZ);
  1881.             SetObjectRot(oInfo[playerid][object][objectID], fRotX, fRotY, fRotZ);
  1882.             new string[128];
  1883.             format(string, sizeof(string),"You have finished editing object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}).", object, oInfo[playerid][object][modelID]);
  1884.             SendClientInfoMessage(playerid, string);
  1885.         }
  1886.     }  
  1887.     return 1;
  1888. }
  1889.  
  1890. public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
  1891. {
  1892.     CancelEdit(playerid);
  1893.     for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  1894.     {
  1895.         if(oInfo[playerid][i][objectID] == objectid)
  1896.         {
  1897.             if(pInfo[playerid][flyeditor] != 1)
  1898.             {
  1899.                 ShowPlayerDialog(playerid, DIALOG_SELECTMENU, DIALOG_STYLE_LIST,"Select Action","Edit\nChange Model\nDelete","Select","Cancel");
  1900.                 pInfo[playerid][editobject] = i;
  1901.             }
  1902.             else
  1903.             {
  1904.                 pInfo[playerid][editobject] = 1;
  1905.                 EditObject(playerid, oInfo[playerid][i][objectID]);
  1906.             }
  1907.             break;
  1908.         }
  1909.         else if(i == (MAX_CREATED_OBJECTS-1))
  1910.         {
  1911.             SendClientErrorMessage(playerid, 4);
  1912.         }
  1913.     }
  1914.     return 1;
  1915. }
  1916.  
  1917. stock SendClientErrorMessage(playerid, type)
  1918. {
  1919.     switch(type)
  1920.     {
  1921.         case 0: SendClientMessage(playerid, COLOR_WARNING, "This is not a valid object number.");
  1922.         case 1: SendClientMessage(playerid, COLOR_WARNING, "You haven't created any objects.");
  1923.         case 2:
  1924.         {
  1925.             new string[128];
  1926.             format(string, sizeof(string), "You can not create more objects, you have reached the maximum amount of {F58282}%i{F5F582} objects.", MAX_CREATED_OBJECTS);
  1927.             SendClientMessage(playerid, COLOR_WARNING, string);
  1928.         }
  1929.         case 3: SendClientMessage(playerid, COLOR_WARNING, "Sorry, you can not export object files as this function is restricted to RCON admins.");
  1930.         case 4: SendClientMessage(playerid, COLOR_WARNING, "The object you selected is not one of those you have created.");
  1931.         case 5:
  1932.         {
  1933.             new string[110];
  1934.             format(string, sizeof(string), "The value you entered is too big. Please choose a value smaller than or equal to {F58282}%.2f{F5F582}m.", MAX_CREATE_DISTANCE);
  1935.             SendClientMessage(playerid, COLOR_WARNING, string);
  1936.         }
  1937.         case 6:
  1938.         {
  1939.             new string[110];
  1940.             format(string, sizeof(string), "The value you entered is too big. Please choose a value smaller than or equal to {F58282}%.2f{F5F582}m.", MAX_MOVE_DISTANCE);
  1941.             SendClientMessage(playerid, COLOR_WARNING, string);
  1942.         }
  1943.         case 7: SendClientMessage(playerid, COLOR_WARNING, "Sorry, you can not use this command as you are not in the object editor.");
  1944.         case 8: SendClientMessage(playerid, COLOR_WARNING, "Sorry, the usage of command shortcuts for the object editor is disabled.");
  1945.         case 9: SendClientMessage(playerid, COLOR_WARNING, "Sorry, you can not use this command when you're in the flyeditor.");
  1946.         case 10: SendClientMessage(playerid, COLOR_WARNING, "This user is not connected.");
  1947.     }
  1948.     return 1;
  1949. }
  1950.  
  1951. stock SendClientInfoMessage(playerid, string[])
  1952. {
  1953.     SendClientMessage(playerid, COLOR_INFO, string);
  1954.     return 1;
  1955. }
  1956.  
  1957. forward ExportMap(playerid, inputtext[]);
  1958. public ExportMap(playerid, inputtext[])
  1959. {
  1960.     new string[60];
  1961.     format(string, sizeof(string), "ObjectEditor/Exports/%s.txt",inputtext);
  1962.     if(!dini_Exists(string))
  1963.     {
  1964.         new File:File = fopen(string, io_write);
  1965.         new def[50];
  1966.         new counter = 0;
  1967.         format(def, sizeof(def), "new %s[%i];\r\n\r\n", inputtext, pInfo[playerid][totalobjects]);
  1968.         fwrite(File, def);
  1969.         for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  1970.         {
  1971.             if(oInfo[playerid][i][created] == 1)
  1972.             {
  1973.                 new code[200];
  1974.                 format(code, sizeof(code), "%s[%i] = CreateObject(%i, %f, %f, %f, %f, %f, %f);\r\n",inputtext, counter, oInfo[playerid][i][modelID], oInfo[playerid][i][XLoc], oInfo[playerid][i][YLoc], oInfo[playerid][i][ZLoc], oInfo[playerid][i][XRot], oInfo[playerid][i][YRot], oInfo[playerid][i][ZRot]);
  1975.                 fwrite(File, code);
  1976.                 if(oInfo[playerid][i][usesmaterial] == 1)
  1977.                 {
  1978.                     new materialindex, matmodelid, txdname[50], texturename[50], color[15];
  1979.                     new str1[50], str2[50], str3[15];
  1980.                     new matcolor;
  1981.                     format(str1, sizeof(str1), "%i_txdname", i);
  1982.                     GetPVarString(playerid, str1, txdname, sizeof(txdname));
  1983.                     format(str2, sizeof(str2), "%i_texturename", i);
  1984.                     GetPVarString(playerid, str2, texturename, sizeof(texturename));
  1985.                     format(str3, sizeof(str3), "%i_color", i);
  1986.                     GetPVarString(playerid, str3, color, sizeof(color));
  1987.                     matcolor = HexToInt(color);
  1988.                     materialindex = oInfo[playerid][i][matindex];
  1989.                     matmodelid =  oInfo[playerid][i][matmodel];
  1990.                     new code2[200];
  1991.                     format(code2, sizeof(code2), "SetObjectMaterial(%s[%i], %i, %i, \"%s\", \"%s\", %i);\r\n", inputtext, counter, materialindex, matmodelid, txdname, texturename, matcolor);
  1992.                     fwrite(File, code2);
  1993.                 }
  1994.                 counter++;
  1995.             }
  1996.         }
  1997.         fclose(File);
  1998.         new msg[100];
  1999.         format(msg, sizeof(msg), "You have successfully exported all objects to the file {F58282}%s{F5F582}.txt.", inputtext);
  2000.         SendClientInfoMessage(playerid, msg);
  2001.     }
  2002.     else
  2003.     {
  2004.         new dg1[141];
  2005.         format(dg1, sizeof(dg1), "Enter the name of the file you want to export the objects to:\n\n{F58282}Sorry, this file already exists. {A9C4E4}Please choose another name.");
  2006.         ShowPlayerDialog(playerid, DIALOG_MAP_EXPORTNAME, DIALOG_STYLE_INPUT,"Save name",dg1,"Export","Cancel");
  2007.     }
  2008.     return 1;
  2009. }
  2010.  
  2011. forward SaveMap(playerid, inputtext[]);
  2012. public SaveMap(playerid, inputtext[])
  2013. {
  2014.     new oFile[100];
  2015.     format(oFile, sizeof(oFile), "/ObjectEditor/Saves/%s.txt", inputtext);
  2016.     if(!dini_Exists(oFile))
  2017.     {
  2018.         new oCounter = 0;
  2019.         new pName[MAX_PLAYER_NAME];
  2020.         GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  2021.         dini_Create(oFile);
  2022.         dini_Set(oFile, "creator", pName);
  2023.         dini_IntSet(oFile, "totalobjects", pInfo[playerid][totalobjects]);
  2024.         for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  2025.         {
  2026.             if(oInfo[playerid][i][created] == 1)
  2027.             {
  2028.                 new towrite[60];
  2029.                 format(towrite, sizeof(towrite), "o%i_modelID", oCounter);
  2030.                 dini_IntSet(oFile, towrite, oInfo[playerid][i][modelID]);
  2031.                 format(towrite, sizeof(towrite), "o%i_XLoc", oCounter);
  2032.                 dini_FloatSet(oFile, towrite, oInfo[playerid][i][XLoc]);
  2033.                 format(towrite, sizeof(towrite), "o%i_YLoc", oCounter);
  2034.                 dini_FloatSet(oFile, towrite, oInfo[playerid][i][YLoc]);
  2035.                 format(towrite, sizeof(towrite), "o%i_ZLoc", oCounter);
  2036.                 dini_FloatSet(oFile, towrite, oInfo[playerid][i][ZLoc]);
  2037.                 format(towrite, sizeof(towrite), "o%i_XRot", oCounter);
  2038.                 dini_FloatSet(oFile, towrite, oInfo[playerid][i][XRot]);
  2039.                 format(towrite, sizeof(towrite), "o%i_YRot", oCounter);
  2040.                 dini_FloatSet(oFile, towrite, oInfo[playerid][i][YRot]);
  2041.                 format(towrite, sizeof(towrite), "o%i_ZRot", oCounter);
  2042.                 dini_FloatSet(oFile, towrite, oInfo[playerid][i][ZRot]);
  2043.                 if(oInfo[playerid][i][usesmaterial] == 1)
  2044.                 {
  2045.                     new txdname[50], texturename[50], color[15];
  2046.                     new str1[50], str2[50], str3[15];
  2047.                     format(towrite, sizeof(towrite), "o%i_usesmaterial", oCounter);
  2048.                     dini_IntSet(oFile, towrite, 1);
  2049.                     format(str1, sizeof(str1), "%i_txdname", i);
  2050.                     GetPVarString(playerid, str1, txdname, sizeof(txdname));
  2051.                     format(str2, sizeof(str2), "%i_texturename", i);
  2052.                     GetPVarString(playerid, str2, texturename, sizeof(texturename));
  2053.                     format(str3, sizeof(str3), "%i_color", i);
  2054.                     GetPVarString(playerid, str3, color, sizeof(color));
  2055.                     format(towrite, sizeof(towrite), "o%i_matindex", oCounter);
  2056.                     dini_IntSet(oFile, towrite, oInfo[playerid][i][matindex]);
  2057.                     format(towrite, sizeof(towrite), "o%i_matmodelid", oCounter);
  2058.                     dini_IntSet(oFile, towrite, oInfo[playerid][i][matmodel]);
  2059.                     format(towrite, sizeof(towrite), "o%i_txdname", oCounter);
  2060.                     dini_Set(oFile, towrite, txdname);
  2061.                     format(towrite, sizeof(towrite), "o%i_texturename", oCounter);
  2062.                     dini_Set(oFile, towrite, texturename);
  2063.                     format(towrite, sizeof(towrite), "o%i_matcolor", oCounter);
  2064.                     dini_Set(oFile, towrite, color);
  2065.                 }
  2066.                 else
  2067.                 {
  2068.                     format(towrite, sizeof(towrite), "o%i_usesmaterial", oCounter);
  2069.                     dini_IntSet(oFile, towrite, 0);
  2070.                 }
  2071.                 oCounter++;
  2072.             }
  2073.         }
  2074.         new msg[100];
  2075.         format(msg, sizeof(msg), "You have successfully saved all objects to the file {F58282}%s{F5F582}.txt.", inputtext);
  2076.         SendClientInfoMessage(playerid, msg);
  2077.     }
  2078.     else
  2079.     {
  2080.         new dg1[139];
  2081.         format(dg1, sizeof(dg1), "Enter the name of the file you want to save the objects in:\n\n{F58282}Sorry, this file already exists. {A9C4E4}Please choose another name.");
  2082.         ShowPlayerDialog(playerid, DIALOG_MAP_SAVENAME, DIALOG_STYLE_INPUT,"Save name",dg1,"Save","Cancel");
  2083.     }
  2084.     return 1;
  2085. }
  2086.  
  2087. forward LoadMap(playerid, inputtext[]);
  2088. public LoadMap(playerid, inputtext[])
  2089. {
  2090.     new oFile[100];
  2091.     format(oFile, sizeof(oFile), "/ObjectEditor/Saves/%s.txt", inputtext);
  2092.     if(dini_Exists(oFile))
  2093.     {
  2094.         new amount = dini_Int(oFile, "totalobjects");
  2095.         if((pInfo[playerid][totalobjects] + amount) <= MAX_CREATED_OBJECTS)
  2096.         {
  2097.             new oCount = 0;
  2098.             new i = 0;
  2099.             do
  2100.             {
  2101.                 if(oInfo[playerid][oCount][created] == 0)
  2102.                 {
  2103.                     new dir0[50], dir1[50], dir2[50], dir3[50], dir4[50], dir5[50], dir6[50], dir7[50];
  2104.                     format(dir0, sizeof(dir0), "o%i_modelID", i);
  2105.                     format(dir1, sizeof(dir1), "o%i_XLoc", i);
  2106.                     format(dir2, sizeof(dir2), "o%i_YLoc", i);
  2107.                     format(dir3, sizeof(dir3), "o%i_ZLoc", i);
  2108.                     format(dir4, sizeof(dir4), "o%i_XRot", i);
  2109.                     format(dir5, sizeof(dir5), "o%i_YRot", i);
  2110.                     format(dir6, sizeof(dir6), "o%i_ZRot", i);
  2111.                     oInfo[playerid][oCount][created]  = 1;
  2112.                     oInfo[playerid][oCount][modelID]  = dini_Int(oFile, dir0);
  2113.                     oInfo[playerid][oCount][XLoc]     = dini_Float(oFile, dir1);
  2114.                     oInfo[playerid][oCount][YLoc]     = dini_Float(oFile, dir2);
  2115.                     oInfo[playerid][oCount][ZLoc]     = dini_Float(oFile, dir3);
  2116.                     oInfo[playerid][oCount][XRot]     = dini_Float(oFile, dir4);
  2117.                     oInfo[playerid][oCount][YRot]     = dini_Float(oFile, dir5);
  2118.                     oInfo[playerid][oCount][ZRot]     = dini_Float(oFile, dir6);
  2119.                     oInfo[playerid][oCount][objectID] = CreateObject(oInfo[playerid][oCount][modelID], oInfo[playerid][oCount][XLoc], oInfo[playerid][oCount][YLoc], oInfo[playerid][oCount][ZLoc], oInfo[playerid][oCount][XRot], oInfo[playerid][oCount][YRot], oInfo[playerid][oCount][ZRot]);
  2120.                     format(dir7, sizeof(dir7), "o%i_usesmaterial", i);
  2121.                     if(dini_Int(oFile, dir7) == 1)
  2122.                     {
  2123.                         new dir8[50], dir9[50], dir10[50], dir11[50], dir12[50];
  2124.                         new str[20], str2[20], str3[20];
  2125.                         new txdname[50], texturename[50], color[50];
  2126.                         format(dir8, sizeof(dir8), "o%i_matindex", i);
  2127.                         format(dir9, sizeof(dir9), "o%i_matmodelid", i);
  2128.                         format(dir10, sizeof(dir10), "o%i_txdname", i);
  2129.                         format(dir11, sizeof(dir11), "o%i_texturename", i);
  2130.                         format(dir12, sizeof(dir12), "o%i_matcolor", i);
  2131.                         format(txdname, sizeof(txdname), "%s", dini_Get(oFile, dir10));
  2132.                         format(texturename, sizeof(texturename), "%s", dini_Get(oFile, dir11));
  2133.                         format(color, sizeof(color), "%s", dini_Get(oFile, dir12));
  2134.                         oInfo[playerid][oCount][indexused]      = 1;
  2135.                         oInfo[playerid][oCount][modelused]      = 1;
  2136.                         oInfo[playerid][oCount][txdused]        = 1;
  2137.                         oInfo[playerid][oCount][textureused]    = 1;
  2138.                         oInfo[playerid][oCount][colorused]      = 1;
  2139.                         oInfo[playerid][oCount][matindex]       = dini_Int(oFile, dir8);
  2140.                         oInfo[playerid][oCount][matmodel]       = dini_Int(oFile, dir9);
  2141.                         format(str, sizeof(str), "%i_txdname", oCount);
  2142.                         format(str2, sizeof(str2), "%i_texturename", oCount);
  2143.                         format(str3, sizeof(str3), "%i_color", oCount);
  2144.                         SetPVarString(playerid, str, txdname);
  2145.                         SetPVarString(playerid, str2, texturename);
  2146.                         SetPVarString(playerid, str3, color);
  2147.                         oInfo[playerid][oCount][usesmaterial] = 1;
  2148.                         SetObjectMaterial(oInfo[playerid][oCount][objectID], oInfo[playerid][oCount][matindex], oInfo[playerid][oCount][matmodel], txdname, texturename, HexToInt(color));
  2149.                     }
  2150.                     else
  2151.                     {
  2152.                         oInfo[playerid][oCount][usesmaterial] = 0;
  2153.                     }
  2154.                     i++;
  2155.                 }
  2156.                 oCount++;
  2157.             }
  2158.             while(i < amount);
  2159.             pInfo[playerid][totalobjects]+=amount;
  2160.             new string[256];
  2161.             format(string, sizeof(string), "You loaded {F58282}%i{F5F582} objects from file {F58282}%s{F5F582}.txt. | Total current objects: {F58282}%i{F5F582}.", amount, inputtext, pInfo[playerid][totalobjects]);
  2162.             SendClientInfoMessage(playerid, string);
  2163.         }
  2164.         else
  2165.         {
  2166.             new string[128];
  2167.             format(string, sizeof(string), "You can not load this file as you would exceed the maximum amount of {F58282}%i{F5F582} objects.", MAX_CREATED_OBJECTS);
  2168.             SendClientMessage(playerid, COLOR_WARNING, string);
  2169.         }
  2170.     }
  2171.     else
  2172.     {
  2173.         new dg1[256];
  2174.         format(dg1, sizeof(dg1), "Enter the name of the file you want to load:\n\n{F58282}Sorry, this file does not exist.");
  2175.         ShowPlayerDialog(playerid, DIALOG_MAP_LOAD, DIALOG_STYLE_INPUT, "Load map",dg1,"Load","Cancel");
  2176.     }
  2177.     return 1;
  2178. }
  2179.  
  2180. stock DeleteAllObjects(playerid)
  2181. {
  2182.     for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  2183.     {
  2184.         DestroyObject(oInfo[playerid][i][objectID]);
  2185.         oInfo[playerid][i][objectID]        = INVALID_OBJECT_ID;
  2186.         oInfo[playerid][i][modelID]         = 0;
  2187.         oInfo[playerid][i][XLoc]            = 0.0;
  2188.         oInfo[playerid][i][YLoc]            = 0.0;
  2189.         oInfo[playerid][i][ZLoc]            = 0.0;
  2190.         oInfo[playerid][i][XRot]            = 0.0;
  2191.         oInfo[playerid][i][YRot]            = 0.0;
  2192.         oInfo[playerid][i][ZRot]            = 0.0;
  2193.         pInfo[playerid][totalobjects]       = 0;
  2194.         oInfo[playerid][i][created]         = 0;
  2195.         oInfo[playerid][i][indexused]       = 0;
  2196.         oInfo[playerid][i][modelused]       = 0;
  2197.         oInfo[playerid][i][txdused]         = 0;
  2198.         oInfo[playerid][i][textureused]     = 0;
  2199.         oInfo[playerid][i][colorused]       = 0;
  2200.         oInfo[playerid][i][matindex]        = -1;
  2201.         oInfo[playerid][i][matmodel]        = -1;
  2202.         new str1[20], str2[20], str3[20];
  2203.         format(str1, sizeof(str1), "%i_txdname", i);
  2204.         format(str2, sizeof(str2), "%i_texturename", i);
  2205.         format(str3, sizeof(str3), "%i_color", i);
  2206.         DeletePVar(playerid, str1);
  2207.         DeletePVar(playerid, str2);
  2208.         DeletePVar(playerid, str3);
  2209.         oInfo[playerid][i][usesmaterial]    = 0;
  2210.     }
  2211.     return 1;
  2212. }
  2213.  
  2214. forward ShowPlayerSettingsMenu(playerid);
  2215. public ShowPlayerSettingsMenu(playerid)
  2216. {
  2217.     new setting1[128], setting2[128], setting3[128], setting4[128], setting5[128], setting6[128], dialog[512];
  2218.     #if ALLOW_EDIT_OBJECT_ON_CREATE == true
  2219.     if(pInfo[playerid][EditObjectOnCreate] == true)
  2220.         format(setting1, sizeof(setting1), "Auto edit object after creation\t\t\t\t{91FF91}Enabled");
  2221.     else
  2222.         format(setting1, sizeof(setting1), "Auto edit object after creation\t\t\t\t{F58282}Disabled");
  2223.     #else
  2224.         format(setting1, sizeof(setting1), "{323232}Auto edit object after creation\t\t\t\tNot available");
  2225.     #endif
  2226.     #if ALLOW_EDIT_OBJECT_ON_DUPLICATE == true
  2227.     if(pInfo[playerid][EditObjectOnDuplicate] == true)
  2228.         format(setting2, sizeof(setting2), "Auto edit object after duplication\t\t\t{91FF91}Enabled");
  2229.     else
  2230.         format(setting2, sizeof(setting2), "Auto edit object after duplication\t\t\t{F58282}Disabled");
  2231.     #else
  2232.         format(setting2, sizeof(setting2), "{323232}Auto edit object after duplication\t\t\tNot available");
  2233.     #endif
  2234.     #if ALLOW_USE_MATERIAL_CHANGE_DIALOG == true
  2235.     if(pInfo[playerid][UseMaterialDialog] == true)
  2236.         format(setting3, sizeof(setting3), "Use material change dialog\t\t\t\t{91FF91}Enabled");
  2237.     else
  2238.         format(setting3, sizeof(setting3), "Use material change dialog\t\t\t\t{F58282}Disabled");
  2239.     #else
  2240.         format(setting3, sizeof(setting3), "{323232}Use material change dialog\t\t\t\tNot available");
  2241.     #endif
  2242.     #if ALLOW_TRANSFER_MATERIAL == true
  2243.     if(pInfo[playerid][TransferMaterial] == true)
  2244.         format(setting4, sizeof(setting4), "Copy texture to duplicated object\t\t\t{91FF91}Enabled");
  2245.     else
  2246.         format(setting4, sizeof(setting4), "Copy texture to duplicated object\t\t\t{F58282}Disabled");
  2247.     #else
  2248.         format(setting4, sizeof(setting4), "{323232}Copy texture to duplicated object\t\t\tNot available");
  2249.     #endif
  2250.     #if ALLOW_KEEP_MATERIAL == true
  2251.     if(pInfo[playerid][KeepMaterial] == true)
  2252.         format(setting5, sizeof(setting5), "Keep custom texture after changing object model\t{91FF91}Enabled");
  2253.     else
  2254.         format(setting5, sizeof(setting5), "Keep custom texture after changing object model\t{F58282}Disabled");
  2255.     #else
  2256.         format(setting5, sizeof(setting5), "{323232}Keep custom texture after changing object model\tNot available");
  2257.     #endif
  2258.     #if ALLOW_USE_CROSS == true
  2259.     if(pInfo[playerid][UseCross] == true)
  2260.         format(setting6, sizeof(setting6), "Use fade cross when in flyeditor editor mode\t\t{91FF91}Enabled");
  2261.     else
  2262.         format(setting6, sizeof(setting6), "Use fade cross when in flyeditor editor mode\t\t{F58282}Disabled");
  2263.     #else
  2264.         format(setting6, sizeof(setting6), "{323232}Use fade cross when in flyeditor editor mode\t\tNot available");
  2265.     #endif
  2266.     format(dialog, sizeof(dialog),"%s\n%s\n%s\n%s\n%s\n%s", setting1, setting2, setting3, setting4, setting5, setting6);
  2267.     ShowPlayerDialog(playerid, DIALOG_SETTINGS, DIALOG_STYLE_LIST, "Editor settings",dialog,"Change","Close");
  2268.     return 1;
  2269. }
  2270.  
  2271. forward ShowPlayerMaterialDialog(playerid, object);
  2272. public ShowPlayerMaterialDialog(playerid, object)
  2273. {
  2274.     new l1[128], l2[128], l3[128], l4[128], l5[128], dialog[512];
  2275.     if(oInfo[playerid][pInfo[playerid][editobject]][indexused] == 0)
  2276.         format(l1, sizeof(l1), "Materialindex\t{F58282}-");
  2277.     else
  2278.         format(l1, sizeof(l1), "Materialindex\t{91FF91}%i", oInfo[playerid][pInfo[playerid][editobject]][matindex]);
  2279.     if(oInfo[playerid][pInfo[playerid][editobject]][modelused] == 0)
  2280.         format(l2, sizeof(l2), "Model ID\t{F58282}-");
  2281.     else
  2282.         format(l2, sizeof(l2), "Model ID\t{91FF91}%i", oInfo[playerid][pInfo[playerid][editobject]][matmodel]);
  2283.     if(oInfo[playerid][pInfo[playerid][editobject]][txdused] == 0)
  2284.         format(l3, sizeof(l3), "TXD Name\t{F58282}-");
  2285.     else
  2286.     {
  2287.         new str[20], input[50];
  2288.         format(str, sizeof(str), "%i_txdname", pInfo[playerid][editobject]);
  2289.         GetPVarString(playerid, str, input, sizeof(input));
  2290.         format(l3, sizeof(l3), "TXD Name\t{91FF91}%s", input);
  2291.     }
  2292.     if(oInfo[playerid][pInfo[playerid][editobject]][textureused] == 0)
  2293.         format(l4, sizeof(l4), "Texture name\t{F58282}-");
  2294.     else
  2295.     {
  2296.         new str[20], input[50];
  2297.         format(str, sizeof(str), "%i_texturename", pInfo[playerid][editobject]);
  2298.         GetPVarString(playerid, str, input, sizeof(input));
  2299.         format(l4, sizeof(l4), "Texture Name\t{91FF91}%s", input);
  2300.     }
  2301.     if(oInfo[playerid][pInfo[playerid][editobject]][colorused] == 0)
  2302.         format(l5, sizeof(l5), "Color\t\t{F58282}-");
  2303.     else
  2304.     {
  2305.         new str[20], input[50];
  2306.         format(str, sizeof(str), "%i_color", pInfo[playerid][editobject]);
  2307.         GetPVarString(playerid, str, input, sizeof(input));
  2308.         if(strcmp(input, "0", true) == 0)
  2309.             format(l5, sizeof(l5), "Color\t\t{91FF91}no color (texture default)");
  2310.         else
  2311.             format(l5, sizeof(l5), "Color\t\t{91FF91}%s", input);
  2312.     }
  2313.     if(oInfo[playerid][pInfo[playerid][editobject]][usesmaterial] == 0)
  2314.     {
  2315.         if(IsAllFilledOut(playerid, pInfo[playerid][editobject]))
  2316.         {
  2317.             format(dialog, sizeof(dialog),"%s\n%s\n%s\n%s\n%s\n{91FF91}Continue\n{323232}Remove texture", l1, l2, l3, l4, l5);
  2318.             ShowPlayerDialog(playerid, DIALOG_MATERIALS, DIALOG_STYLE_LIST, "Change material",dialog,"Change","Cancel");
  2319.         }
  2320.         else
  2321.         {
  2322.             format(dialog, sizeof(dialog),"%s\n%s\n%s\n%s\n%s\n{323232}Continue\n{323232}Remove texture", l1, l2, l3, l4, l5);
  2323.             ShowPlayerDialog(playerid, DIALOG_MATERIALS, DIALOG_STYLE_LIST, "Change material",dialog,"Change","Cancel");
  2324.         }
  2325.     }
  2326.     else
  2327.     {
  2328.         if(IsAllFilledOut(playerid, pInfo[playerid][editobject]))
  2329.         {
  2330.             format(dialog, sizeof(dialog),"%s\n%s\n%s\n%s\n%s\n{91FF91}Continue\n{F58282}Remove texture", l1, l2, l3, l4, l5);
  2331.             ShowPlayerDialog(playerid, DIALOG_MATERIALS, DIALOG_STYLE_LIST, "Change material",dialog,"Change","Cancel");
  2332.         }
  2333.         else
  2334.         {
  2335.             format(dialog, sizeof(dialog),"%s\n%s\n%s\n%s\n%s\n{323232}Continue\n{F58282}Remove texture", l1, l2, l3, l4, l5);
  2336.             ShowPlayerDialog(playerid, DIALOG_MATERIALS, DIALOG_STYLE_LIST, "Change material",dialog,"Change","Cancel");
  2337.         }
  2338.     }
  2339.     return 1;
  2340. }
  2341.  
  2342. forward IsAllFilledOut(playerid, object);
  2343. public IsAllFilledOut(playerid, object)
  2344. {
  2345.     if(oInfo[playerid][object][indexused] == 1)
  2346.     {
  2347.         if(oInfo[playerid][object][modelused] == 1)
  2348.         {
  2349.             if(oInfo[playerid][object][txdused] == 1)
  2350.             {
  2351.                 if(oInfo[playerid][object][textureused] == 1)
  2352.                 {
  2353.                     if(oInfo[playerid][object][colorused] == 1)
  2354.                     {
  2355.                         return 1;
  2356.                     }
  2357.                     else return 0;
  2358.                 }
  2359.                 else return 0;
  2360.             }
  2361.             else return 0;
  2362.         }
  2363.         else return 0;
  2364.     }
  2365.     else return 0;
  2366. }
  2367.  
  2368. forward ChangeObjectMaterial(playerid, object);
  2369. public ChangeObjectMaterial(playerid, object)
  2370. {
  2371.     oInfo[playerid][object][usesmaterial] = 1;
  2372.     new txdname[50], texturename[50], color[15];
  2373.     new str1[50], str2[50], str3[15];
  2374.     format(str1, sizeof(str1), "%i_txdname", object);
  2375.     GetPVarString(playerid, str1, txdname, sizeof(txdname));
  2376.     format(str2, sizeof(str2), "%i_texturename", object);
  2377.     GetPVarString(playerid, str2, texturename, sizeof(texturename));
  2378.     format(str3, sizeof(str3), "%i_color", object);
  2379.     GetPVarString(playerid, str3, color, sizeof(color));
  2380.     new rescolor = HexToInt(color);
  2381.     SetObjectMaterial(oInfo[playerid][object][objectID], oInfo[playerid][object][matindex], oInfo[playerid][object][matmodel], txdname, texturename, rescolor);
  2382.     return 1;
  2383. }
  2384.  
  2385. forward ResetObjectMaterial(playerid, object);
  2386. public ResetObjectMaterial(playerid, object)
  2387. {  
  2388.     oInfo[playerid][object][indexused]      = 0;
  2389.     oInfo[playerid][object][modelused]      = 0;
  2390.     oInfo[playerid][object][txdused]        = 0;
  2391.     oInfo[playerid][object][textureused]    = 0;
  2392.     oInfo[playerid][object][colorused]      = 0;
  2393.     oInfo[playerid][object][matindex]       = -1;
  2394.     oInfo[playerid][object][matmodel]       = -1;
  2395.     new str1[20], str2[20], str3[20];
  2396.     format(str1, sizeof(str1), "%i_txdname", object);
  2397.     format(str2, sizeof(str2), "%i_texturename", object);
  2398.     format(str3, sizeof(str3), "%i_color", object);
  2399.     DeletePVar(playerid, str1);
  2400.     DeletePVar(playerid, str2);
  2401.     DeletePVar(playerid, str3);
  2402.     oInfo[playerid][object][usesmaterial]   = 0;
  2403.     DestroyObject(oInfo[playerid][object][objectID]);
  2404.     oInfo[playerid][object][objectID] = CreateObject(oInfo[playerid][object][modelID], oInfo[playerid][object][XLoc], oInfo[playerid][object][YLoc], oInfo[playerid][object][ZLoc], oInfo[playerid][object][XRot], oInfo[playerid][object][YRot], oInfo[playerid][object][ZRot]);
  2405.     new msg[128];
  2406.     format(msg, sizeof(msg), "You have reset the texture of object number {F58282}%i{F5F582} (Model {F58282}%i{F5F582}) to default.", object, oInfo[playerid][object][modelID]);
  2407.     SendClientInfoMessage(playerid, msg);
  2408.     return 1;
  2409. }
  2410.  
  2411. forward ResetAllValues(playerid);
  2412. public ResetAllValues(playerid)
  2413. {
  2414.     for(new i = 0; i < MAX_CREATED_OBJECTS; i++)
  2415.     {
  2416.         oInfo[playerid][i][created]             = 0;
  2417.         oInfo[playerid][i][objectID]            = 0;
  2418.         oInfo[playerid][i][modelID]             = 0;
  2419.         oInfo[playerid][i][XLoc]                = 0.0;
  2420.         oInfo[playerid][i][YLoc]                = 0.0;
  2421.         oInfo[playerid][i][ZLoc]                = 0.0;
  2422.         oInfo[playerid][i][XRot]                = 0.0;
  2423.         oInfo[playerid][i][YRot]                = 0.0;
  2424.         oInfo[playerid][i][ZRot]                = 0.0;
  2425.         oInfo[playerid][i][usesmaterial]        = 0;
  2426.         oInfo[playerid][i][indexused]           = 0;
  2427.         oInfo[playerid][i][modelused]           = 0;
  2428.         oInfo[playerid][i][txdused]             = 0;
  2429.         oInfo[playerid][i][textureused]         = 0;
  2430.         oInfo[playerid][i][colorused]           = 0;
  2431.         oInfo[playerid][i][matindex]            = 0;
  2432.         oInfo[playerid][i][matmodel]            = 0;
  2433.         new str1[20], str2[20], str3[20];
  2434.         format(str1, sizeof(str1), "%i_txdname", i);
  2435.         format(str2, sizeof(str2), "%i_texturename", i);
  2436.         format(str3, sizeof(str3), "%i_color", i);
  2437.         DeletePVar(playerid, str1);
  2438.         DeletePVar(playerid, str2);
  2439.         DeletePVar(playerid, str3);
  2440.     }
  2441.     pInfo[playerid][EditObjectOnCreate]         = false;
  2442.     pInfo[playerid][EditObjectOnDuplicate]      = false;
  2443.     pInfo[playerid][UseMaterialDialog]          = false;
  2444.     pInfo[playerid][TransferMaterial]           = false;
  2445.     pInfo[playerid][totalobjects]               = 0;
  2446.     pInfo[playerid][editobject]                 = INVALID_OBJECT_NUMBER;
  2447.     pInfo[playerid][editing]                    = false;
  2448.     return 1;
  2449. }
  2450.  
  2451. forward ShowPlayerCommandHelp(playerid);
  2452. public ShowPlayerCommandHelp(playerid)
  2453. {  
  2454.     new l1[65], l2[27], l3[210], l4[247], l5[262], l6[262], l7[195];
  2455.     new dialog[1200];
  2456.     l1  = "Below is a list of all available commands for the object editor:";
  2457.     l2  = "Command\t\tShortcut\tEffect";
  2458.     l3  =  "{87FF87}/createnewobject\t{F5F582}/cno\t\t{A9C4E4}Creates a new object\n"\
  2459.            "{87FF87}/deleteobject\t\t{F5F582}/deo\t\t{A9C4E4}Deletes an object\n"\
  2460.            "{87FF87}/deleteallobjects\t{F5F582}/deao\t\t{A9C4E4}Deletes all object";
  2461.     l4  =  "{87FF87}/setobjectxoffset\t{F5F582}/soxo\t\t{A9C4E4}Moves an object on the X axis\n"\
  2462.            "{87FF87}/setobjectyoffset\t{F5F582}/soyo\t\t{A9C4E4}Moves an object on the Y axis\n"\
  2463.            "{87FF87}/setobjectzoffset\t{F5F582}/sozo\t\t{A9C4E4}Moves an object on the Z axis";
  2464.     l5  =  "{87FF87}/setallobjectsxoffset\t{F5F582}/saoxo\t\t{A9C4E4}Move all object on the X axis\n"\
  2465.            "{87FF87}/setallobjectsyoffset\t{F5F582}/saoyo\t\t{A9C4E4}Move all object on the Y axis\n"\
  2466.            "{87FF87}/setallobjectszoffset\t{F5F582}/saozo\t\t{A9C4E4}Move all object on the Z axis";
  2467.     l6  =  "{87FF87}/setobjectxrotation\t{F5F582}/soxr\t\t{A9C4E4}Sets the X rotation of an object\n"\
  2468.            "{87FF87}/setobjectyrotation\t{F5F582}/soyr\t\t{A9C4E4}Sets the Y rotation of an object\n"\
  2469.            "{87FF87}/setobjectzrotation\t{F5F582}/sozr\t\t{A9C4E4}Sets the Z rotation of an object";
  2470.     l7 =  "{F5F582}Note: {A9C4E4}You can also type the command to get extra information about each command and the parameters.";
  2471.     format(dialog, sizeof(dialog), "%s\n\n%s\n%s\n\n%s\n%s\n\n%s\n\n%s",l1, l2, l3, l4, l5, l6, l7);
  2472.     ShowPlayerDialog(playerid, DIALOG_EDITORCOMMANDS, DIALOG_STYLE_MSGBOX, "Object Editor Commands #1", dialog, "Close","Page 2 >");
  2473.     return 1;
  2474. }
  2475.  
  2476. forward ShowPlayerCommandHelp2(playerid);
  2477. public ShowPlayerCommandHelp2(playerid)
  2478. {  
  2479.     new l1[65], l2[27], l3[250], l4[247], l5[262], l6[262], l7[470];
  2480.     new dialog[1630];
  2481.     l1  = "Below is a list of all available commands for the object editor:";
  2482.     l2  = "Command\t\tShortcut\tEffect";
  2483.     l3  =  "{87FF87}/nearestobject\t{F5F582}/neo\t\t{A9C4E4}Gets the closes object to your position\n"\
  2484.            "{87FF87}/gotoobject\t\t{F5F582}/goo\t\t{A9C4E4}Teleports you to an object\n"\
  2485.            "{87FF87}/replaceobjectmodel\t{F5F582}/rpom\t\t{A9C4E4}Replaces an object with a new object";
  2486.     l4  =  "{87FF87}/duplicateobject\t{F5F582}/duo\t\t{A9C4E4}Duplicates an object\n"\
  2487.            "{87FF87}/setobjectmaterial\t{F5F582}/som\t\t{A9C4E4}Changes the texture of an object\n"\
  2488.            "{87FF87}/setobjectpos\t\t{F5F582}/sop\t\t{A9C4E4}Sets an object to an exact position";
  2489.     l5  =  "{87FF87}/editobject\t\t{F5F582}/edo\t\t{A9C4E4}Modifies an object using the object editing tool\n"\
  2490.            "{87FF87}/selectobject\t\t{F5F582}/seo\t\t{A9C4E4}Selects an object by clicking on it\n"\
  2491.            "{87FF87}/flyeditor\t\t{F5F582}-\t\t{A9C4E4}Enters the flyeditor editor mode";
  2492.     #if ALLOW_EXPORT_MAP_FILE == true
  2493.     l6 =  "{87FF87}/saveobjects\t\t{F5F582}-\t\t{A9C4E4}Saves an object file\n"\
  2494.            "{87FF87}/loadobjects\t\t{F5F582}-\t\t{A9C4E4}Loads an object file\n"\
  2495.            "{87FF87}/exportobjects\t{F5F582}-\t\t{A9C4E4}Exports an object file in the CreateObject() format";
  2496.     #else
  2497.     l6 =  "{87FF87}/saveobjects\t\t{F5F582}-\t\t{A9C4E4}Saves an object file\n"\
  2498.            "{87FF87}/loadobjects\t\t{F5F582}-\t\t{A9C4E4}Loads an object file\n"\
  2499.            "{87FF87}/exportobjects\t{F5F582}-\t\t{A9C4E4}Exports an object file in the CreateObject() format\t{F58282}(RCON Admins only)";
  2500.     #endif
  2501.     l7 =  "{87FF87}/editorcommands\t{F5F582}-\t\t{A9C4E4}Shows the editor commands help\n"\
  2502.           "{87FF87}/esettingshelp\t{F5F582}-\t\t{A9C4E4}Shows editor settings help\n"\
  2503.           "{87FF87}/editorsettings\t{F5F582}-\t\t{A9C4E4}Shows the editor settings dialog to a player\n"\
  2504.           "{87FF87}/toggleeditor\t\t{F5F582}-\t\t{A9C4E4}Can be used by an RCON admin to allow a player to use the editor\n\n"\
  2505.           "{F5F582}Note: {A9C4E4}You can also type the command to get extra information about each command and the parameters.";
  2506.     format(dialog, sizeof(dialog), "%s\n\n%s\n%s\n%s\n%s\n%s\n\n%s",l1, l2, l3, l4, l5, l6, l7);
  2507.     //                               1     2   3     4   5     6     7   8     9    10  11
  2508.     ShowPlayerDialog(playerid, DIALOG_EDITORCOMMANDS2, DIALOG_STYLE_MSGBOX, "Object Editor Commands #2", dialog, "< Page 1","Close");
  2509.     return 1;
  2510. }
  2511.  
  2512. forward ShowPlayerSettingsHelp(playerid);
  2513. public ShowPlayerSettingsHelp(playerid)
  2514. {  
  2515.     new s1[220], s2[225], s3[233], s4[238], s5[216], s6[236], s7[74], dialog[1450];
  2516.     s1 = "{91FF91}Auto edit object after creation:\n"\
  2517.          "{A9C4E4}If this option is enabled you will be automatically be put into the editor mode after creating an object.\nBy this you can immediately modify it's position and rotation.";
  2518.     s2 = "{91FF91}Auto edit object after duplication:\n"\
  2519.          "{A9C4E4}If this option is enabled you will be automatically be put into the editor mode after duplicating an object.\nBy this you can immediately modify it's position and rotation.";
  2520.     s3 = "{91FF91}Use material change dialog:\n"\
  2521.          "{A9C4E4}This option allows you to use the dialog menu to change an object's texture.\nIf it is disabled, you must use /setobjectmaterial and enter all it's parameters together with the command.";
  2522.     s4 = "{91FF91}Copy texture to duplicated object:\n"\
  2523.          "{A9C4E4}If this is enabled, a duplicated object with automatically have the custom texture of it's \"mother object\".\nIf disabled, the duplicated object will have the object default texture.";
  2524.     s5 = "{91FF91}Keep custom texture after changing object model:\n"\
  2525.          "{A9C4E4}This option allows you to keep the custom texture after you changed the model of an object.\nIf it's disabled, the custom texture will be deleted.";
  2526.     s6 = "{91FF91}Use fade cross when in flyeditor editor mode:\n"\
  2527.          "{A9C4E4}If enabled, you will have a fade cross in the middle of your screen when you're in the flyeditor editor mode.\nYou can remove the fade cross by disabling this option.";
  2528.     s7 = "If an object is grayed out, this feature has been disabled by the server.";
  2529.     format(dialog, sizeof(dialog), "Below is a list of all options found in {F5F582}/editorsettings{A9C4E4}.\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s", s1, s2, s3, s4, s5, s6, s7);
  2530.     ShowPlayerDialog(playerid, DIALOG_SETTINGSHELP, DIALOG_STYLE_MSGBOX, "Editor settings help",dialog,"Close","");
  2531.     return 1;
  2532. }
  2533.  
  2534. forward Startflyeditor(playerid);
  2535. public Startflyeditor(playerid)
  2536. {
  2537.     pInfo[playerid][flyeditor] = 1;
  2538.     new Float:X, Float:Y, Float:Z;
  2539.     GetPlayerPos(playerid, X, Y, Z);
  2540.     pInfo[playerid][flyobject] = CreatePlayerObject(playerid, 19300, X, Y, Z, 0.0, 0.0, 0.0);
  2541.     TogglePlayerSpectating(playerid, true);
  2542.     AttachCameraToPlayerObject(playerid, pInfo[playerid][flyobject]);
  2543.     SendClientInfoMessage(playerid, "You have entered the fly mode.");
  2544.     SendClientInfoMessage(playerid, "Use {F58282}~k~~GO_FORWARD~ ~k~~GO_BACK~ ~k~~GO_LEFT~ ~k~~GO_RIGHT~{F5F582} to move the camera.");
  2545.     SendClientInfoMessage(playerid, "Press {F58282}~k~~VEHICLE_ENTER_EXIT~{F5F582} to select an object you want to edit.");
  2546.     SendClientInfoMessage(playerid, "While you are editing an object, you can move the camera around while holding down {F58282}~k~~PED_SPRINT~{F5F582}.");
  2547.     SendClientInfoMessage(playerid, "To exit the fly mode, type /flyeditor again.");
  2548.     if(pInfo[playerid][UseCross] == true)
  2549.     {
  2550.         PlayerTextDrawShow(playerid, Cross[0]);
  2551.         PlayerTextDrawShow(playerid, Cross[1]);
  2552.     }
  2553.     return 1;
  2554. }
  2555.  
  2556. forward Endflyeditor(playerid);
  2557. public Endflyeditor(playerid)
  2558. {
  2559.     pInfo[playerid][flyeditor] = 0;
  2560.     GetPlayerCameraPos(playerid, pInfo[playerid][poX], pInfo[playerid][poY], pInfo[playerid][poZ]);
  2561.     CancelEdit(playerid);
  2562.     TogglePlayerSpectating(playerid, false);
  2563.     DestroyPlayerObject(playerid, pInfo[playerid][flyobject]);
  2564.     PlayerTextDrawHide(playerid, Cross[0]);
  2565.     PlayerTextDrawHide(playerid, Cross[1]);
  2566.     SetTimer("SpawnDelay", 100, 0);
  2567.     return 1;
  2568. }
  2569.  
  2570. forward SpawnDelay(playerid);
  2571. public SpawnDelay(playerid)
  2572. {
  2573.     SetPlayerPos(playerid, pInfo[playerid][poX], pInfo[playerid][poY], pInfo[playerid][poZ]);
  2574. }
  2575.  
  2576. IsNumeric(szInput[])
  2577. {
  2578.     new iChar, i = 0;
  2579.     while ((iChar = szInput[i++])) if (!('0' <= iChar <= '9')) return 0;
  2580.     return 1;
  2581. }
  2582.  
  2583. HexToInt(string[]){
  2584.    if (string[0]==0) return 0;
  2585.    new i;
  2586.    new cur=1;
  2587.    new res=0;
  2588.    for (i=strlen(string);i>0;i--) {
  2589.      if (string[i-1]<58) res=res+cur*(string[i-1]-48); else res=res+cur*(string[i-1]-65+10);
  2590.      cur=cur*16;
  2591.    }
  2592.    return res;
  2593.  }
  2594.  
  2595. stock GetMoveDirectionFromKeys(ud, lr)
  2596. {
  2597.     new direction = 0;
  2598.    
  2599.     if(lr < 0)
  2600.     {
  2601.         if(ud < 0)      direction = MOVE_FORWARD_LEFT;
  2602.         else if(ud > 0) direction = MOVE_BACK_LEFT;
  2603.         else            direction = MOVE_LEFT;
  2604.     }
  2605.     else if(lr > 0)
  2606.     {
  2607.         if(ud < 0)      direction = MOVE_FORWARD_RIGHT;
  2608.         else if(ud > 0) direction = MOVE_BACK_RIGHT;
  2609.         else            direction = MOVE_RIGHT;
  2610.     }
  2611.     else if(ud < 0)     direction = MOVE_FORWARD;
  2612.     else if(ud > 0)     direction = MOVE_BACK;
  2613.    
  2614.     return direction;
  2615. }
  2616.  
  2617. stock MoveCamera(playerid)
  2618. {
  2619.     new Float:FV[3], Float:CP[3];
  2620.     GetPlayerCameraPos(playerid, CP[0], CP[1], CP[2]);
  2621.     GetPlayerCameraFrontVector(playerid, FV[0], FV[1], FV[2]);
  2622.     if(pInfo[playerid][accelmul] <= 1) pInfo[playerid][accelmul] += ACCEL_RATE;
  2623.     new Float:speed = MOVE_SPEED * pInfo[playerid][accelmul];
  2624.     new Float:X, Float:Y, Float:Z;
  2625.     GetNextCameraPosition(pInfo[playerid][mode], CP, FV, X, Y, Z);
  2626.     MovePlayerObject(playerid, pInfo[playerid][flyobject], X, Y, Z, speed);
  2627.     pInfo[playerid][lastmove] = GetTickCount();
  2628.     return 1;
  2629. }
  2630.  
  2631. stock GetNextCameraPosition(move_mode, Float:CP[3], Float:FV[3], &Float:X, &Float:Y, &Float:Z)
  2632. {
  2633.     #define OFFSET_X (FV[0]*6000.0)
  2634.     #define OFFSET_Y (FV[1]*6000.0)
  2635.     #define OFFSET_Z (FV[2]*6000.0)
  2636.     switch(move_mode)
  2637.     {
  2638.         case MOVE_FORWARD:
  2639.         {
  2640.             X = CP[0]+OFFSET_X;
  2641.             Y = CP[1]+OFFSET_Y;
  2642.             Z = CP[2]+OFFSET_Z;
  2643.         }
  2644.         case MOVE_BACK:
  2645.         {
  2646.             X = CP[0]-OFFSET_X;
  2647.             Y = CP[1]-OFFSET_Y;
  2648.             Z = CP[2]-OFFSET_Z;
  2649.         }
  2650.         case MOVE_LEFT:
  2651.         {
  2652.             X = CP[0]-OFFSET_Y;
  2653.             Y = CP[1]+OFFSET_X;
  2654.             Z = CP[2];
  2655.         }
  2656.         case MOVE_RIGHT:
  2657.         {
  2658.             X = CP[0]+OFFSET_Y;
  2659.             Y = CP[1]-OFFSET_X;
  2660.             Z = CP[2];
  2661.         }
  2662.         case MOVE_BACK_LEFT:
  2663.         {
  2664.             X = CP[0]+(-OFFSET_X - OFFSET_Y);
  2665.             Y = CP[1]+(-OFFSET_Y + OFFSET_X);
  2666.             Z = CP[2]-OFFSET_Z;
  2667.         }
  2668.         case MOVE_BACK_RIGHT:
  2669.         {
  2670.             X = CP[0]+(-OFFSET_X + OFFSET_Y);
  2671.             Y = CP[1]+(-OFFSET_Y - OFFSET_X);
  2672.             Z = CP[2]-OFFSET_Z;
  2673.         }
  2674.         case MOVE_FORWARD_LEFT:
  2675.         {
  2676.             X = CP[0]+(OFFSET_X  - OFFSET_Y);
  2677.             Y = CP[1]+(OFFSET_Y  + OFFSET_X);
  2678.             Z = CP[2]+OFFSET_Z;
  2679.         }
  2680.         case MOVE_FORWARD_RIGHT:
  2681.         {
  2682.             X = CP[0]+(OFFSET_X  + OFFSET_Y);
  2683.             Y = CP[1]+(OFFSET_Y  - OFFSET_X);
  2684.             Z = CP[2]+OFFSET_Z;
  2685.         }
  2686.     }
  2687. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement