Guest User

SA:MP Attached Object Editor [For 0.3e+] 0.1b

a guest
Mar 10th, 2013
655
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //                          ATTACHED OBJECT EDITOR                            //
  3. //                                by Robo_N1X                                 //
  4. //                           -Version: 0.1b Beta-                             //
  5. // ========================================================================== //
  6. // Note: This filterscript works in SA:MP 0.3e and upper                      //
  7. // License note:                                                              //
  8. // * You may not remove any credits that is written in the credits dialog in  //
  9. //   this script!                                                             //
  10. // * You may modify this script without removing any credits                  //
  11. // * You may copy the content(s) of this script without removing any credits  //
  12. // * You may use this script for non-commercial                               //
  13. // Credits: SA-MP Team, h02, DracoBlue, whoever made some functions here      //
  14. // Original thread: http://forum.sa-mp.com/showthread.php?t=416138            //
  15. ////////////////////////////////////////////////////////////////////////////////
  16.  
  17. #include <a_samp> // Credits to: SA-MP team
  18. #include <Dini> // Credits to: DracoBlue
  19. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 // Credits to: DracoBlue / Source: SA-MP Wiki
  20. #define MIN_ATTACHED_OBJECT_BONE    1
  21. #define MAX_ATTACHED_OBJECT_BONE    18
  22. #define MAX_ATTACHED_OBJECT_OFFSET  3000.00
  23. #define MIN_ATTACHED_OBJECT_OFFSET  -3000.00
  24. #define MAX_ATTACHED_OBJECT_ROT     360.00
  25. #define MIN_ATTACHED_OBJECT_ROT     -360.00
  26. #define MAX_ATTACHED_OBJECT_SIZE    1000.00
  27. #define MIN_ATTACHED_OBJECT_SIZE    -1000.00
  28. #define AOE_VERSION         "0.1b - Feb, 2013" // Version
  29. #define AO_FILENAME         "%s_pao.ini"    // Player attached/holding object (%s = name) located in scriptfiles folder by default
  30. #define AOC_FILENAME        "%s_exp.txt"    // Converted attached/holding object (%s = name) located in scriptfiles folder by default
  31. // COLOR DEFINES
  32. #define COLOR_WHITE     0xFFFFFFFF
  33. #define COLOR_RED       0xFF0000FF
  34. #define COLOR_YELLOW    0xFFFF00FF
  35. #define COLOR_GREEN     0x00FF00FF
  36. #define COLOR_CYAN      0x00FFFFFF
  37. #define COLOR_BLUE      0x0000FFFF
  38. #define COLOR_MAGENTA   0xFF00FFFF
  39.  
  40. // =============================================================================
  41.  
  42. new aoe_str[128], aoe_str2[256];
  43. new PlayerName[MAX_PLAYER_NAME];
  44. enum // Dialog ID enums
  45. {
  46.     AOED = 400,
  47.     AOED_HELP,
  48.     AOED_ABOUT,
  49.     AOED_CREATE_MODEL,
  50.     AOED_CREATE_BONE,
  51.     AOED_CREATE_SLOT,
  52.     AOED_CREATE_REPLACE,
  53.     AOED_CREATE_EDIT,
  54.     AOED_EDIT_SLOT,
  55.     AOED_REMOVE_SLOT,
  56.     AOED_REMOVE,
  57.     AOED_REMOVEALL,
  58.     AOED_STATS_SLOT,
  59.     AOED_STATS,
  60.     AOED_AO_LIST,
  61.     AOED_DUPLICATE_SLOT1,
  62.     AOED_DUPLICATE_SLOT2,
  63.     AOED_DUPLICATE_REPLACE,
  64.     AOED_SET_SLOT1,
  65.     AOED_SET_SLOT2,
  66.     AOED_SET_SLOT_REPLACE,
  67.     AOED_SET_MODEL_SLOT,
  68.     AOED_SET_MODEL,
  69.     AOED_SET_BONE_SLOT,
  70.     AOED_SET_BONE,
  71.     AOED_SAVE,
  72.     AOED_SAVE_SLOT,
  73.     AOED_SAVE2,
  74.     AOED_LOAD,
  75.     AOED_LOAD_SLOT,
  76.     AOED_LOAD_REPLACE,
  77.     AOED_LOAD2,
  78.     AOED_CONVERT
  79. }
  80. enum AttachedObjectOptions {
  81.     aoValid = 0,
  82.     aoModelID, aoBoneID,
  83.     Float:aoX, Float:aoY, Float:aoZ,
  84.     Float:aoRX, Float:aoRY, Float:aoRZ,
  85.     Float:aoSX, Float:aoSY, Float:aoSZ,
  86.     aoMC1, aoMC2
  87. }
  88. new pao[MAX_PLAYERS][MAX_PLAYER_ATTACHED_OBJECTS][AttachedObjectOptions];
  89. new AttachedObjectBones[MAX_ATTACHED_OBJECT_BONE][24] = {
  90.     {"Spine"}, {"Head"}, {"Left upper arm"}, {"Right upper arm"}, {"Left hand"}, {"Right hand"},
  91.     {"Left thigh"}, {"Right thigh"}, {"Left foot"}, {"Right foot"}, {"Right calf"}, {"Left calf"},
  92.     {"Left forearm"}, {"Right forearm"}, {"Left clavicle"}, {"Right clavicle"}, {"Neck"}, {"Jaw"}
  93. };
  94.  
  95. // =============================================================================
  96.  
  97. public OnFilterScriptInit()
  98. {
  99.     for(new i = 0; i < GetMaxPlayers(); i++)
  100.     {
  101.         for(new s = 0; s < MAX_PLAYER_ATTACHED_OBJECTS; s++) {
  102.             if(IsPlayerAttachedObjectSlotUsed(i, s)) pao[i][s][aoValid] = 1;
  103.             else AOE_UnsetValues(i, s);
  104.         }
  105.     }
  106.     print("  [FilterScript] Attached Object Editor for SA:MP 0.3e+ has been loaded!");
  107.     printf("  Attached Objects Count: %d", GetAttachedObjectsCount());
  108.     return 1;
  109. }
  110.  
  111. public OnFilterScriptExit()
  112. {
  113.     print("  [FilterScript] Attached Object Editor for SA:MP 0.3e+ has been unloaded!");
  114.     printf("  Attached Objects Count: %d", GetAttachedObjectsCount());
  115.     for(new x = 0; x < GetMaxPlayers(); x++) if(IsPlayerConnected(x)) AOE_UnsetVars(x);
  116.     return 1;
  117. }
  118.  
  119. public OnPlayerConnect(playerid)
  120. {
  121.     for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) {
  122.         if(IsPlayerAttachedObjectSlotUsed(playerid, i)) pao[playerid][i][aoValid] = 1;
  123.         else RemovePlayerAttachedObject(playerid, i), AOE_UnsetValues(playerid, i);
  124.     }
  125.     return 1;
  126. }
  127.  
  128. public OnPlayerSpawn(playerid)
  129. {
  130.     new slots = 0;
  131.     for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++) if(pao[playerid][i][aoValid]) RestorePlayerAttachedObject(playerid, i), slots++;
  132.     if(0 < slots <= MAX_PLAYER_ATTACHED_OBJECTS) {
  133.         format(aoe_str2, sizeof(aoe_str2), "* Automatically restored your attached object(s) [Total: %d]!", slots);
  134.         SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  135.     }
  136.     return 1;
  137. }
  138.  
  139. public OnPlayerCommandText(playerid, cmdtext[])
  140. {
  141.     if(!strcmp(cmdtext, "/attachedobjecteditor", true) || !strcmp(cmdtext, "/aoe", true))
  142.     {
  143.         if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  144.             return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  145.         else AOE_ShowPlayerDialog(playerid, 0, AOED, "Attached Object Editor", "Select", "Close");
  146.         return 1;
  147.     }
  148.     if(!strcmp(cmdtext, "/removeattachedobjects", true) || !strcmp(cmdtext, "/raos", true))
  149.     {
  150.         if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  151.             return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  152.         else if(!GetPlayerAttachedObjectsCount(playerid)) {
  153.             SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  154.             GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  155.             return 1;
  156.         }
  157.         else AOE_ShowPlayerDialog(playerid, 12, AOED_REMOVEALL, "Remove All Attached Object(s)", "Yes", "Cancel");
  158.         return 1;
  159.     }
  160.     if(!strcmp(cmdtext, "/undodeleteattachedobject", true) || !strcmp(cmdtext, "/undeleteattachedobject", true) || !strcmp(cmdtext, "/udao", true))
  161.     {
  162.         if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  163.             return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  164.         else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) {
  165.             SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!");
  166.             SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!");
  167.             GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3);
  168.             return 1;
  169.         }
  170.         else if(!GetPVarType(playerid, "LastAttachedObjectRemoved")) {
  171.             SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object removed with /rao command!");
  172.             GameTextForPlayer(playerid, "~r~~h~No attached object can be restored!", 5000, 3);
  173.             return 1;
  174.         }
  175.         else
  176.         {
  177.             new slot = GetPVarInt(playerid, "LastAttachedObjectRemoved");
  178.             if(!IsValidPlayerAttachedObject(playerid, slot)) {
  179.                 format(aoe_str, sizeof(aoe_str), "* Sorry, you can't restore your last attached object from slot/index number %i as it's not valid!", slot);
  180.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str);
  181.                 GameTextForPlayer(playerid, "~r~~h~Cannot restore attached object!", 5000, 3);
  182.                 return 1;
  183.             }
  184.             else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) {
  185.                 format(aoe_str, sizeof(aoe_str), "* Sorry, you can't restore your last attached object as you had an attached object in that slot already (%i)!", slot);
  186.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str);
  187.                 GameTextForPlayer(playerid, "~r~~h~Cannot restore attached object!", 5000, 3);
  188.                 return 1;
  189.             }
  190.             RestorePlayerAttachedObject(playerid, slot);
  191.             format(aoe_str2, sizeof(aoe_str2), "* You've restored your attaced object from slot/index number %i [Model: %d - Bone: %s (%i)]!", slot, pao[playerid][slot][aoModelID],
  192.             GetAttachedObjectBoneName(pao[playerid][slot][aoBoneID]), pao[playerid][slot][aoBoneID]);
  193.             format(aoe_str, sizeof(aoe_str), "~g~Restored your attached object~n~~w~index/number: %i~n~Model: %d - Bone: %i", slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]);
  194.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  195.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  196.         }
  197.         return 1;
  198.     }
  199.     if(!strcmp(cmdtext, "/attachedobjectlist", true) || !strcmp(cmdtext, "/aol", true))
  200.     {
  201.         if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  202.             return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  203.         else if(!GetPlayerAttachedObjectsCount(playerid)) {
  204.             SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  205.             GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  206.             return 1;
  207.         }
  208.         else AOE_ShowPlayerDialog(playerid, 7, AOED_AO_LIST, "Attached Object List", "Edit", "Cancel");
  209.         return 1;
  210.     }
  211.     if(!strcmp(cmdtext, "/totalattachedobjects", true) || !strcmp(cmdtext, "/taos", true))
  212.     {
  213.         SendClientMessage(playerid, COLOR_CYAN, "----------------------------------------------------------------------------------------------------");
  214.         format(aoe_str2, sizeof(aoe_str2), "-- Total attached object(s) attached on you: %d", GetPlayerAttachedObjectsCount(playerid));
  215.         SendClientMessage(playerid, 0x00DDDDFF, aoe_str2);
  216.         format(aoe_str2, sizeof(aoe_str2), "-- Total of all attached object(s) in server: %d", GetAttachedObjectsCount());
  217.         SendClientMessage(playerid, 0x00DDDDFF, aoe_str2);
  218.         SendClientMessage(playerid, COLOR_CYAN, "----------------------------------------------------------------------------------------------------");
  219.         return 1;
  220.     }
  221.  
  222.     dcmd(createattachedobject, 20, cmdtext);
  223.     dcmd(cao, 3, cmdtext);
  224.     dcmd(editattachedobject, 18, cmdtext);
  225.     dcmd(eao, 3, cmdtext);
  226.     dcmd(removeattachedobject, 20, cmdtext);
  227.     dcmd(rao, 3, cmdtext);
  228.     dcmd(saveattachedobject, 18, cmdtext);
  229.     dcmd(sao, 3, cmdtext);
  230.     dcmd(saveattachedobjects, 19, cmdtext);
  231.     dcmd(saos, 4, cmdtext);
  232.     dcmd(loadattachedobject, 18, cmdtext);
  233.     dcmd(lao, 3, cmdtext);
  234.     dcmd(loadattachedobjects, 19, cmdtext);
  235.     dcmd(laos, 4, cmdtext);
  236.     dcmd(convertattachedobjectfile, 25, cmdtext);
  237.     dcmd(convertattachedobject, 21, cmdtext);
  238.     dcmd(caof, 4, cmdtext);
  239.     dcmd(attachedobjectstats, 19, cmdtext);
  240.     dcmd(aos, 3, cmdtext);
  241.     dcmd(duplicateattachedobject, 23, cmdtext);
  242.     dcmd(dao, 3, cmdtext);
  243.     dcmd(setattachedobjectslot, 21, cmdtext);
  244.     dcmd(setattachedobjectindex, 22, cmdtext);
  245.     dcmd(saoi, 4, cmdtext);
  246.     dcmd(setattachedobjectmodel, 22, cmdtext);
  247.     dcmd(saom, 4, cmdtext);
  248.     dcmd(setattachedobjectbone, 21, cmdtext);
  249.     dcmd(saob, 4, cmdtext);
  250.     dcmd(setattachedobjectoffsetx, 24, cmdtext);
  251.     dcmd(saoox, 5, cmdtext);
  252.     dcmd(setattachedobjectoffsety, 24, cmdtext);
  253.     dcmd(saooy, 5, cmdtext);
  254.     dcmd(setattachedobjectoffsetz, 24, cmdtext);
  255.     dcmd(saooz, 5, cmdtext);
  256.     dcmd(setattachedobjectrotx, 21, cmdtext);
  257.     dcmd(saorx, 5, cmdtext);
  258.     dcmd(setattachedobjectroty, 21, cmdtext);
  259.     dcmd(saory, 5, cmdtext);
  260.     dcmd(setattachedobjectrotz, 21, cmdtext);
  261.     dcmd(saorz, 5, cmdtext);
  262.     dcmd(setattachedobjectscalex, 23, cmdtext);
  263.     dcmd(saosx, 5, cmdtext);
  264.     dcmd(setattachedobjectscaley, 23, cmdtext);
  265.     dcmd(saosy, 5, cmdtext);
  266.     dcmd(setattachedobjectscalez, 23, cmdtext);
  267.     dcmd(saosz, 5, cmdtext);
  268.     dcmd(setattachedobjectmc1, 20, cmdtext);
  269.     dcmd(saomc1, 6, cmdtext);
  270.     dcmd(setattachedobjectmc2, 20, cmdtext);
  271.     dcmd(saomc2, 6, cmdtext);
  272.     return 0;
  273. }
  274.  
  275. // -----------------------------------------------------------------------------
  276.  
  277. dcmd_createattachedobject(playerid, params[])
  278. {
  279.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  280.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  281.     else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) {
  282.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!");
  283.         SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!");
  284.         GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3);
  285.         return 1;
  286.     }
  287.     else
  288.     {
  289.         new idx, tmp[24], tmp2[24], tmp3[24], model, bone, slot;
  290.         tmp = strtok(params, idx), model = strval(tmp), SetPVarInt(playerid, "CreateAttachedObjectModel", model);
  291.         if(!strlen(tmp)) return AOE_ShowPlayerDialog(playerid, 4, AOED_CREATE_MODEL, "Create Attached Object", "Enter", "Cancel"), 1;
  292.         else if(!IsValidObjectModel(model) || !IsNumeric(tmp)) {
  293.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid object model number/id [%s]!", tmp);
  294.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  295.             GameTextForPlayer(playerid, "~r~~h~Invalid object model!", 5000, 3);
  296.             return 1;
  297.         }
  298.         else
  299.         {
  300.             tmp2 = strtok(params, idx), bone = strval(tmp2), SetPVarInt(playerid, "CreateAttachedObjectBone", bone);
  301.             if(!strlen(tmp2)) return AOE_ShowPlayerDialog(playerid, 5, AOED_CREATE_BONE, "Create Attached Object", "Select", "Cancel"), 1;
  302.             else if(!IsValidAttachedObjectBone(bone) || !IsNumeric(tmp2)) {
  303.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object bone number/id [%s]!", tmp2);
  304.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  305.                 GameTextForPlayer(playerid, "~r~~h~Invalid attached object bone!", 5000, 3);
  306.                 return 1;
  307.             }
  308.             else
  309.             {
  310.                 tmp3 = strtok(params, idx), slot = strval(tmp3), SetPVarInt(playerid, "CreateAttachedObjectIndex", slot);
  311.                 if(!strlen(tmp3)) return AOE_ShowPlayerDialog(playerid, 6, AOED_CREATE_SLOT, "Create Attached Object", "Select", "Cancel"), 1;
  312.                 else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp3)) {
  313.                     format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp3);
  314.                     SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  315.                     GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  316.                     return 1;
  317.                 }
  318.                 else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) return AOE_ShowPlayerDialog(playerid, 9, AOED_CREATE_REPLACE, "Create Attached Object (Replace)", "Yes", "Cancel"), 1;
  319.                 else
  320.                 {
  321.                     CreatePlayerAttachedObject(playerid, slot, model, bone);
  322.                     format(aoe_str2, sizeof(aoe_str2), "* Created attached object model %d at slot/index number %i [Bone: %s (%i)]!", model, slot, GetAttachedObjectBoneName(bone), bone);
  323.                     format(aoe_str, sizeof(aoe_str), "~b~Created attached object~n~~w~index/number: %i~n~Model: %d - Bone: %i", slot, model, bone);
  324.                     SendClientMessage(playerid, COLOR_BLUE, aoe_str2);
  325.                     GameTextForPlayer(playerid, aoe_str, 5000, 3);
  326.                     AOE_ShowPlayerDialog(playerid, 10, AOED_CREATE_EDIT, "Create Attached Object (Edit)", "Edit", "Skip");
  327.                 }
  328.             }
  329.         }
  330.     }
  331.     return 1;
  332. }
  333.  
  334. dcmd_cao(playerid, params[]) return dcmd_createattachedobject(playerid, params);
  335.  
  336. dcmd_editattachedobject(playerid, params[])
  337. {
  338.     if(GetPVarInt(playerid, "EditingAttachedObject") == 1) return CancelEdit(playerid);
  339.     else if(GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  340.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  341.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  342.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  343.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  344.         return 1;
  345.     }
  346.     else if(!strlen(params)) return AOE_ShowPlayerDialog(playerid, 7, AOED_EDIT_SLOT, "Edit Attached Object", "Edit", "Cancel"), 1;
  347.     else
  348.     {
  349.         new slot = strval(params);
  350.         SetPVarInt(playerid, "EditAttachedObjectIndex", slot);
  351.         if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(params)) {
  352.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", params);
  353.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  354.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  355.             return 1;
  356.         }
  357.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  358.         {
  359.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  360.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  361.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  362.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  363.             return 1;
  364.         }
  365.         else
  366.         {
  367.             EditAttachedObject(playerid, slot);
  368.             format(aoe_str2, sizeof(aoe_str2), "* You're now editing your attached object from slot/index number %i!", slot);
  369.             format(aoe_str, sizeof(aoe_str), "~g~Editing your attached object~n~~w~index/number: %i", slot);
  370.             SetPVarInt(playerid, "EditingAttachedObject", 1);
  371.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  372.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  373.             if(pao[playerid][slot][aoValid] != 1) SendClientMessage(playerid, COLOR_RED, "Warning: This attached object is having unknown data, please save it first to refresh the data!");
  374.             if(IsPlayerInAnyVehicle(playerid))  SendClientMessage(playerid, COLOR_YELLOW, "** Hint: Use {FFFFFF}~k~~VEHICLE_ACCELERATE~{FFFF00} key to look around");
  375.             else SendClientMessage(playerid, COLOR_YELLOW, "** Hint: Use {FFFFFF}~k~~PED_SPRINT~{FFFF00} key to look around");
  376.         }
  377.     }
  378.     return 1;
  379. }
  380.  
  381. dcmd_eao(playerid, params[]) return dcmd_editattachedobject(playerid, params);
  382.  
  383. dcmd_removeattachedobject(playerid, params[])
  384. {
  385.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  386.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  387.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  388.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  389.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  390.         return 1;
  391.     }
  392.     else if(!strlen(params)) return AOE_ShowPlayerDialog(playerid, 7, AOED_REMOVE_SLOT, "Remove Attached Object", "Remove", "Cancel"), 1;
  393.     else
  394.     {
  395.         new slot = strval(params);
  396.         SetPVarInt(playerid, "RemoveAttachedObjectIndex", slot);
  397.         if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(params)) {
  398.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", params);
  399.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  400.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  401.             return 1;
  402.         }
  403.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  404.         {
  405.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  406.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  407.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  408.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  409.             return 1;
  410.         }
  411.         else
  412.         {
  413.             RemovePlayerAttachedObjectEx(playerid, slot);
  414.             format(aoe_str2, sizeof(aoe_str2), "* You've removed your attached object from slot/index number %i!", slot);
  415.             format(aoe_str, sizeof(aoe_str), "~r~Removed your attached object~n~~w~index/number: %i", slot);
  416.             SendClientMessage(playerid, COLOR_RED, aoe_str2);
  417.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  418.         }
  419.     }
  420.     return 1;
  421. }
  422.  
  423. dcmd_rao(playerid, params[]) return dcmd_removeattachedobject(playerid, params);
  424.  
  425. dcmd_saveattachedobject(playerid, params[])
  426. {
  427.     GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  428.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  429.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  430.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  431.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  432.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  433.         return 1;
  434.     }
  435.     else
  436.     {
  437.         new idx, tmp[24], tmp2[32], slot, ao_file[64];
  438.         tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SaveAttachedObjectIndex", slot);
  439.         if(!strlen(tmp)) return AOE_ShowPlayerDialog(playerid, 7, AOED_SAVE_SLOT, "Save Attached Object", "Select", "Cancel"), 1;
  440.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  441.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  442.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  443.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  444.             return 1;
  445.         }
  446.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  447.         {
  448.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  449.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  450.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  451.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  452.             return 1;
  453.         }
  454.         else
  455.         {
  456.             tmp2 = strtok(params, idx);
  457.             if(!strlen(tmp2)) return AOE_ShowPlayerDialog(playerid, 15, AOED_SAVE, "Save Attached Object", "Save", "Cancel"), 1;
  458.             else if(!IsValidFileName(tmp2)) {
  459.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", tmp2);
  460.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  461.                 SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .");
  462.                 GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3);
  463.                 return 1;
  464.             }
  465.             else
  466.             {
  467.                 format(ao_file, sizeof(ao_file), AO_FILENAME, tmp2);
  468.                 if(dini_Exists(ao_file)) {
  469.                     format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object file \"%s\" already exists!", tmp2);
  470.                     SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  471.                     GameTextForPlayer(playerid, "~r~~h~File already exists!", 5000, 3);
  472.                     return 1;
  473.                 }
  474.                 else
  475.                 {
  476.                     if(IsValidPlayerAttachedObject(playerid, slot) != 1) {
  477.                         SendClientMessage(playerid, COLOR_RED, "* Error: Invalid attached object data, save canceled");
  478.                         GameTextForPlayer(playerid, "~r~~h~Invalid attached object data!", 5000, 3);
  479.                         return 1;
  480.                     }
  481.                     else
  482.                     {
  483.                         SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object file, please wait...");
  484.                         AOE_SavePlayerAttachedObject(playerid, slot, ao_file);
  485.                         format(aoe_str2, sizeof(aoe_str2), "** Your attached object from index %i has been saved as \"%s\" (Model: %d - Bone: %i)!", slot, tmp2, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]);
  486.                         SendClientMessage(playerid, COLOR_BLUE, aoe_str2);
  487.                     }
  488.                 }
  489.             }
  490.         }
  491.     }
  492.     return 1;
  493. }
  494.  
  495. dcmd_sao(playerid, params[]) return dcmd_saveattachedobject(playerid, params);
  496.  
  497. dcmd_saveattachedobjects(playerid, params[])
  498. {
  499.     GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  500.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  501.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  502.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  503.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  504.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  505.         return 1;
  506.     }
  507.     else
  508.     {
  509.         if(!strlen(params)) return AOE_ShowPlayerDialog(playerid, 15, AOED_SAVE2, "Save Attached Object(s) Set", "Save", "Cancel"), 1;
  510.         else if(!IsValidFileName(params)) {
  511.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", params);
  512.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  513.             SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .");
  514.             GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3);
  515.             return 1;
  516.         }
  517.         else
  518.         {
  519.             new ao_file[64], slots;
  520.             format(ao_file, sizeof(ao_file), AO_FILENAME, params);
  521.             if(dini_Exists(ao_file)) {
  522.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object(s) set file \"%s\" already exists!", params);
  523.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  524.                 GameTextForPlayer(playerid, "~r~~h~File already exists!", 5000, 3);
  525.                 return 1;
  526.             }
  527.             else
  528.             {
  529.                 SendClientMessage(playerid, COLOR_WHITE, "* Saving attached object(s) set file, please wait...");
  530.                 for(new slot = 0; slot < MAX_PLAYER_ATTACHED_OBJECTS; slot++)
  531.                 {
  532.                     if(IsValidPlayerAttachedObject(playerid, slot) != 1) continue;
  533.                     else {
  534.                         slots += AOE_SavePlayerAttachedObject(playerid, slot, ao_file);
  535.                     }
  536.                 }
  537.                 if(!slots && dini_Exists(ao_file)) {
  538.                     dini_Remove(ao_file);
  539.                     SendClientMessage(playerid, COLOR_RED, "** Error: file saving was canceled because there were no valid attached object!");
  540.                     return 1;
  541.                 }
  542.                 else {
  543.                     format(aoe_str2, sizeof(aoe_str2), "** Your attached object set has been saved as \"%s\" (Total: %i)!", params, slots);
  544.                     SendClientMessage(playerid, COLOR_BLUE, aoe_str2);
  545.                 }
  546.             }
  547.         }
  548.     }
  549.     return 1;
  550. }
  551.  
  552. dcmd_saos(playerid, params[]) return dcmd_saveattachedobjects(playerid, params);
  553.  
  554. dcmd_loadattachedobject(playerid, params[])
  555. {
  556.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  557.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  558.     else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) {
  559.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!");
  560.         SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!");
  561.         GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3);
  562.         return 1;
  563.     }
  564.     else
  565.     {
  566.         new idx, tmp[32], tmp2[24], ao_file[64], slot;
  567.         tmp = strtok(params, idx), SetPVarString(playerid, "LoadAttachedObjectName", tmp);
  568.         if(!strlen(tmp)) return AOE_ShowPlayerDialog(playerid, 16, AOED_LOAD, "Load Attached Object", "Enter", "Cancel"), 1;
  569.         else if(!IsValidFileName(tmp)) {
  570.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", tmp);
  571.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  572.             SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .");
  573.             GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3);
  574.             return 1;
  575.         }
  576.         else
  577.         {
  578.             format(ao_file, sizeof(ao_file), AO_FILENAME, tmp);
  579.             if(!dini_Exists(ao_file)) {
  580.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object file \"%s\" does not exist!", tmp);
  581.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  582.                 GameTextForPlayer(playerid, "~r~~h~File does not exist!", 5000, 3);
  583.                 return 1;
  584.             }
  585.             else
  586.             {
  587.                 tmp2 = strtok(params, idx), slot = strval(tmp2), SetPVarInt(playerid, "LoadAttachedObjectIndex", slot);
  588.                 if(!strlen(tmp2)) {
  589.                     SendClientMessage(playerid, COLOR_WHITE, "* Load Attached Object: Please specify attached object index...");
  590.                     ShowPlayerDialog(playerid, AOED_LOAD_SLOT, DIALOG_STYLE_INPUT, "Load Attached Object", "Enter the index number of attached object in the file:", "Load", "Cancel");
  591.                     return 1;
  592.                 }
  593.                 else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp2)) {
  594.                     format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp2);
  595.                     SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  596.                     GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  597.                     return 1;
  598.                 }
  599.                 else
  600.                 {
  601.                     if(!AOE_IsValidAttachedObjectInFile(slot, ao_file)) {
  602.                         format(aoe_str2, sizeof(aoe_str2), "* Sorry, there is no valid attached object from slot/index number %i!", slot);
  603.                         SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  604.                         GameTextForPlayer(playerid, "~r~~h~Attached object slot not found!", 5000, 3);
  605.                         return 1;
  606.                     }
  607.                     else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) return AOE_ShowPlayerDialog(playerid, 17, AOED_LOAD_REPLACE, "Load & Replace Attached Object", "Yes", "Cancel"), 1;
  608.                     else if(!AOE_LoadPlayerAttachedObject(playerid, slot, ao_file)) {
  609.                         SendClientMessage(playerid, COLOR_RED, "* Error: Invalid attached object data, load canceled");
  610.                         pao[playerid][slot][aoValid] = 0;
  611.                         GameTextForPlayer(playerid, "~r~~h~Invalid attached object data!", 5000, 3);
  612.                         return 1;
  613.                     }
  614.                     else
  615.                     {
  616.                         SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object file, please wait...");
  617.                         format(aoe_str2, sizeof(aoe_str2), "** You've loaded attached object from file \"%s\" by %s from skin %i (Index: %i - Model: %d - Bone: %i)!", tmp, dini_Get(ao_file, "auth"), dini_Int(ao_file, "skin"),
  618.                         slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]);
  619.                         SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  620.                     }
  621.                 }
  622.             }
  623.         }
  624.     }
  625.     return 1;
  626. }
  627.  
  628. dcmd_lao(playerid, params[]) return dcmd_loadattachedobject(playerid, params);
  629.  
  630. dcmd_loadattachedobjects(playerid, params[])
  631. {
  632.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  633.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command when editing an attached object!");
  634.     else if(GetPlayerAttachedObjectsCount(playerid) >= MAX_PLAYER_ATTACHED_OBJECTS) {
  635.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't have more attached object(s) [Limit exceed]!");
  636.         SendClientMessage(playerid, COLOR_YELLOW, "* You can only hold "#MAX_PLAYER_ATTACHED_OBJECTS" attached objects!");
  637.         GameTextForPlayer(playerid, "~r~~h~Too many attached objects!", 5000, 3);
  638.         return 1;
  639.     }
  640.     else
  641.     {
  642.         if(!strlen(params)) return AOE_ShowPlayerDialog(playerid, 16, AOED_LOAD2, "Load Attached Object(s) Set", "Load", "Cancel"), 1;
  643.         else if(!IsValidFileName(params)) {
  644.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid file name [%s]!", params);
  645.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  646.             SendClientMessage(playerid, COLOR_YELLOW, "Valid characters are: A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .");
  647.             GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3);
  648.             return 1;
  649.         }
  650.         else
  651.         {
  652.             new ao_file[64], slots;
  653.             format(ao_file, sizeof(ao_file), AO_FILENAME, params);
  654.             if(!dini_Exists(ao_file)) {
  655.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object file \"%s\" does not exist!", params);
  656.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  657.                 GameTextForPlayer(playerid, "~r~~h~File does not exist!", 5000, 3);
  658.                 return 1;
  659.             }
  660.             else
  661.             {
  662.                 SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object(s) set file, please wait...");
  663.                 for(new slot = 0; slot < MAX_PLAYER_ATTACHED_OBJECTS; slot++)
  664.                 {
  665.                     if(!AOE_IsValidAttachedObjectInFile(slot, ao_file)) continue;
  666.                     else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) {
  667.                         format(aoe_str2, sizeof(aoe_str2), "** Attached object slot %i is used, load canceled", slot);
  668.                         SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  669.                         return 1;
  670.                     }
  671.                     else slots += AOE_LoadPlayerAttachedObject(playerid, slot, ao_file);
  672.                 }
  673.                 format(aoe_str2, sizeof(aoe_str2), "** You've loaded attached object(s) set from file \"%s\" by %s from skin %i (Total: %i)!", params, dini_Get(ao_file, "auth"), dini_Int(ao_file, "skin"), slots);
  674.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  675.             }
  676.         }
  677.     }
  678.     return 1;
  679. }
  680.  
  681. dcmd_laos(playerid, params[]) return dcmd_loadattachedobjects(playerid, params);
  682.  
  683. dcmd_convertattachedobjectfile(playerid, params[])
  684. {
  685.     GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  686.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  687.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  688.     else
  689.     {
  690.         new ao_file[64], ao_filename[64], slots, ao_filelen;
  691.         format(ao_file, sizeof(ao_file), AO_FILENAME, params);
  692.         format(ao_filename, sizeof(ao_filename), AOC_FILENAME, params);
  693.         if(!strlen(params)) return AOE_ShowPlayerDialog(playerid, 2, AOED_CONVERT, "Convert Attached Object(s) File", "Convert", "Cancel"), 1;
  694.         else if(!IsValidFileName(ao_file)) {
  695.             SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you've entered an invalid file name! Valid characters are:");
  696.             SendClientMessage(playerid, COLOR_YELLOW, "A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .");
  697.             GameTextForPlayer(playerid, "~r~~h~Invalid file name!", 5000, 3);
  698.             return 1;
  699.         }
  700.         else
  701.         {
  702.             if(!fexist(ao_file)) {
  703.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, attached object(s) file \"%s\" does not exist!", params);
  704.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  705.                 GameTextForPlayer(playerid, "~r~~h~File does not exist!", 5000, 3);
  706.                 return 1;
  707.             }
  708.             else
  709.             {
  710.                 slots += AOE_ConvertAttachedObjectFile(playerid, ao_file, ao_filename, ao_filelen);
  711.                 SendClientMessage(playerid, COLOR_WHITE, "* Converting file, please wait...");
  712.                 format(aoe_str2, sizeof(aoe_str2), "** Attached object(s) file \"%s\" has been converted to \"%s\" raw code (%i objects, %i bytes)", ao_file, ao_filename, slots, ao_filelen);
  713.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  714.             }
  715.         }
  716.     }
  717.     return 1;
  718. }
  719.  
  720. dcmd_convertattachedobject(playerid, params[]) return dcmd_convertattachedobjectfile(playerid, params);
  721. dcmd_caof(playerid, params[]) return dcmd_convertattachedobjectfile(playerid, params);
  722.  
  723. dcmd_attachedobjectstats(playerid, params[])
  724. {
  725.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  726.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  727.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  728.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  729.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  730.         return 1;
  731.     }
  732.     else if(!strlen(params)) return AOE_ShowPlayerDialog(playerid, 7, AOED_STATS_SLOT, "Attached Object Stats", "Select", "Cancel"), 1;
  733.     else
  734.     {
  735.         new slot = strval(params);
  736.         SetPVarInt(playerid, "AttachedObjectStatsIndex", slot);
  737.         if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(params)) {
  738.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", params);
  739.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  740.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  741.             return 1;
  742.         }
  743.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  744.         {
  745.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  746.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  747.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  748.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  749.             return 1;
  750.         }
  751.         else
  752.         {
  753.             format(aoe_str, sizeof(aoe_str), "Your Attached Object Stats (%i)", slot);
  754.             AOE_ShowPlayerDialog(playerid, 8, AOED_STATS, aoe_str, "Print", "Close");
  755.             if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "* As you're an admin, you can print this attached object stats & usage to the console");
  756.         }
  757.     }
  758.     return 1;
  759. }
  760.  
  761. dcmd_aos(playerid, params[]) return dcmd_attachedobjectstats(playerid, params);
  762.  
  763. dcmd_duplicateattachedobject(playerid, params[])
  764. {
  765.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  766.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  767.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  768.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  769.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  770.         return 1;
  771.     }
  772.     else
  773.     {
  774.         new idx, tmp[24], tmp2[24], slot1, slot2;
  775.         tmp = strtok(params, idx), slot1 = strval(tmp), SetPVarInt(playerid, "DuplicateAttachedObjectIndex1", slot1);
  776.         if(!strlen(tmp)) return AOE_ShowPlayerDialog(playerid, 7, AOED_DUPLICATE_SLOT1, "Duplicate Attached Object Index (1)", "Select", "Cancel"), 1;
  777.         else if(!IsValidAttachedObjectSlot(slot1) || !IsNumeric(tmp)) {
  778.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  779.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  780.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  781.             return 1;
  782.         }
  783.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot1))
  784.         {
  785.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot1);
  786.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot1);
  787.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  788.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  789.             return 1;
  790.         }
  791.         else
  792.         {
  793.             tmp2 = strtok(params, idx), slot2 = strval(tmp2), SetPVarInt(playerid, "DuplicateAttachedObjectIndex2", slot2);
  794.             if(!strlen(tmp2)) return AOE_ShowPlayerDialog(playerid, 6, AOED_DUPLICATE_SLOT2, "Duplicate Attached Object Index (2)", "Select", "Cancel"), 1;
  795.             if(!IsValidAttachedObjectSlot(slot2) || !IsNumeric(tmp2)) {
  796.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp2);
  797.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  798.                 GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  799.                 return 1;
  800.             }
  801.             else if(slot1 == slot2) {
  802.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't duplicate attached object from slot/index number %i to the same slot (%i) as it's already there?!!", slot1, slot2);
  803.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  804.                 GameTextForPlayer(playerid, "~y~DOH!", 2500, 3);
  805.                 return 1;
  806.             }
  807.             else if(IsPlayerAttachedObjectSlotUsed(playerid, slot2)) return AOE_ShowPlayerDialog(playerid, 13, AOED_DUPLICATE_REPLACE, "Duplicate Attached Object (Replace)", "Yes", "Cancel"), 1;
  808.             else
  809.             {
  810.                 DuplicatePlayerAttachedObject(playerid, slot1, slot2);
  811.                 format(aoe_str2, sizeof(aoe_str2), "* Duplicated your attached object from slot/index number %i to %i!", slot1, slot2);
  812.                 format(aoe_str, sizeof(aoe_str), "~g~Attached object duplicated~n~~w~index/number:~n~%i to %i", slot1, slot2);
  813.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  814.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  815.             }
  816.         }
  817.     }
  818.     return 1;
  819. }
  820.  
  821. dcmd_dao(playerid, params[]) return dcmd_duplicateattachedobject(playerid, params);
  822.  
  823. dcmd_setattachedobjectindex(playerid, params[])
  824. {
  825.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  826.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  827.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  828.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  829.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  830.         return 1;
  831.     }
  832.     else
  833.     {
  834.         new idx, tmp[24], tmp2[24], slot, newslot;
  835.         tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SetAttachedObjectIndex1", slot);
  836.         if(!strlen(tmp)) AOE_ShowPlayerDialog(playerid, 7, AOED_SET_SLOT1, "Set Attached Object Index (1)", "Select", "Cancel");
  837.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  838.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  839.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  840.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  841.             return 1;
  842.         }
  843.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  844.         {
  845.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  846.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  847.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  848.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  849.             return 1;
  850.         }
  851.         else
  852.         {
  853.             tmp2 = strtok(params, idx), newslot = strval(tmp2), SetPVarInt(playerid, "SetAttachedObjectIndex2", newslot);
  854.             if(!strlen(tmp2)) return AOE_ShowPlayerDialog(playerid, 6, AOED_SET_SLOT2, "Set Attached Object Index (2)", "Select", "Cancel"), 1;
  855.             else if(!IsValidAttachedObjectSlot(newslot) || !IsNumeric(tmp2)) {
  856.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp2);
  857.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  858.                 GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  859.                 return 1;
  860.             }
  861.             else if(slot == newslot) {
  862.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't move attached object from slot/index number %i to the same slot (%i) as it's already there?!!", slot, newslot);
  863.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  864.                 GameTextForPlayer(playerid, "~y~DOH!", 2500, 3);
  865.                 return 1;
  866.             }
  867.             else if(IsPlayerAttachedObjectSlotUsed(playerid, newslot)) return AOE_ShowPlayerDialog(playerid, 14, AOED_SET_SLOT_REPLACE, "Set Attached Object Index (Replace)", "Yes", "Cancel"), 1;
  868.             else
  869.             {
  870.                 MovePlayerAttachedObjectIndex(playerid, slot, newslot);
  871.                 format(aoe_str2, sizeof(aoe_str2), "* Moved your attached object from slot/index number %i to %i!", slot, newslot);
  872.                 format(aoe_str, sizeof(aoe_str), "~g~Attached object moved~n~~w~index/number:~n~%i to %i", slot, newslot);
  873.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  874.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  875.             }
  876.         }
  877.     }
  878.     return 1;
  879. }
  880.  
  881. dcmd_setattachedobjectslot(playerid, params[]) return dcmd_setattachedobjectindex(playerid, params);
  882. dcmd_saoi(playerid, params[]) return dcmd_setattachedobjectindex(playerid, params);
  883.  
  884. dcmd_setattachedobjectmodel(playerid, params[])
  885. {
  886.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  887.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  888.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  889.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  890.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  891.         return 1;
  892.     }
  893.     else
  894.     {
  895.         new idx, tmp[24], tmp2[24], slot, newmodel;
  896.         tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SetAttachedObjectModelIndex", slot);
  897.         if(!strlen(tmp)) return AOE_ShowPlayerDialog(playerid, 7, AOED_SET_MODEL_SLOT, "Set Attached Object Model", "Select", "Cancel"), 1;
  898.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  899.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  900.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  901.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  902.             return 1;
  903.         }
  904.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  905.         {
  906.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  907.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  908.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  909.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  910.             return 1;
  911.         }
  912.         else
  913.         {
  914.             tmp2 = strtok(params, idx), newmodel = strval(tmp2), SetPVarInt(playerid, "SetAttachedObjectModel", newmodel);
  915.             if(!strlen(tmp2)) return AOE_ShowPlayerDialog(playerid, 4, AOED_SET_MODEL, "Set Attached Object Model", "Enter", "Cancel"), 1;
  916.             else if(!IsValidObjectModel(newmodel) || !IsNumeric(tmp2)) {
  917.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid object model number/id [%s]!", tmp2);
  918.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  919.                 GameTextForPlayer(playerid, "~r~~h~Invalid object model!", 5000, 3);
  920.                 return 1;
  921.             }
  922.             else if(newmodel == pao[playerid][slot][aoModelID]) {
  923.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't change this attached object (SID:%i) model from %d to the same model (%d)!!", slot, pao[playerid][slot][aoModelID], newmodel);
  924.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  925.                 GameTextForPlayer(playerid, "~y~DOH!", 2500, 3);
  926.                 return 1;
  927.             }
  928.             else
  929.             {
  930.                 UpdatePlayerAttachedObject(playerid, slot, newmodel, pao[playerid][slot][aoBoneID]);
  931.                 format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object model to %d at slot/index number %i!", newmodel, slot);
  932.                 format(aoe_str, sizeof(aoe_str), "~g~Attached object model updated~n~~w~%d (SID:%i)", newmodel, slot);
  933.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  934.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  935.             }
  936.         }
  937.     }
  938.     return 1;
  939. }
  940.  
  941. dcmd_saom(playerid, params[]) return dcmd_setattachedobjectmodel(playerid, params);
  942.  
  943. dcmd_setattachedobjectbone(playerid, params[])
  944. {
  945.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  946.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  947.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  948.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  949.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  950.         return 1;
  951.     }
  952.     else
  953.     {
  954.         new idx, tmp[24], tmp2[128], slot, newbone;
  955.         tmp = strtok(params, idx), slot = strval(tmp), SetPVarInt(playerid, "SetAttachedObjectBoneIndex", slot);
  956.         if(!strlen(tmp)) return AOE_ShowPlayerDialog(playerid, 7, AOED_SET_BONE_SLOT, "Set Attached Object Bone", "Select", "Cancel"), 1;
  957.         if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  958.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  959.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  960.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  961.             return 1;
  962.         }
  963.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  964.         {
  965.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  966.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  967.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  968.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  969.             return 1;
  970.         }
  971.         else
  972.         {
  973.             tmp2 = strrest(params, idx), newbone = GetAttachedObjectBoneID(tmp2), SetPVarInt(playerid, "SetAttachedObjectBone", newbone);
  974.             if(!strlen(tmp2)) return AOE_ShowPlayerDialog(playerid, 5, AOED_SET_BONE, "Set Attached Object", "Set", "Cancel"), 1;
  975.             if(!IsValidAttachedObjectBoneName(tmp2)) {
  976.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object bone [%s]!", tmp2);
  977.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  978.                 GameTextForPlayer(playerid, "~r~~h~Invalid attached object bone!", 5000, 3);
  979.                 return 1;
  980.             }
  981.             else if(newbone == pao[playerid][slot][aoBoneID]) {
  982.                 format(aoe_str2, sizeof(aoe_str2), "* Sorry, you can't change this attached object (SID:%i) bone from %s to the same bone (%i)!!", slot, tmp2, pao[playerid][slot][aoBoneID]);
  983.                 SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  984.                 GameTextForPlayer(playerid, "~y~DOH!", 2500, 3);
  985.                 return 1;
  986.             }
  987.             else
  988.             {
  989.                 UpdatePlayerAttachedObject(playerid, slot, pao[playerid][slot][aoModelID], newbone);
  990.                 format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object bone to %i (%s) at slot/index number %i!", newbone, GetAttachedObjectBoneName(newbone), slot);
  991.                 format(aoe_str, sizeof(aoe_str), "~g~Attached object bone updated~n~~w~%i (SID:%i)", newbone, slot);
  992.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  993.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  994.             }
  995.         }
  996.     }
  997.     return 1;
  998. }
  999.  
  1000. dcmd_saob(playerid, params[]) return dcmd_setattachedobjectbone(playerid, params);
  1001.  
  1002. dcmd_setattachedobjectoffsetx(playerid, params[])
  1003. {
  1004.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1005.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1006.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1007.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1008.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1009.         return 1;
  1010.     }
  1011.     else
  1012.     {
  1013.         new idx, tmp[24], tmp2[24], slot, Float:newoffsetx;
  1014.         tmp = strtok(params, idx), slot = strval(tmp);
  1015.         tmp2 = strtok(params, idx), newoffsetx = floatstr(tmp2);
  1016.         if(!strlen(tmp) || !strlen(tmp2)) {
  1017.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsetx <AttachedObjectSlot> <Float:OffsetX>");
  1018.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetX) with specified parameters");
  1019.             return 1;
  1020.         }
  1021.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1022.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1023.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1024.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1025.             return 1;
  1026.         }
  1027.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1028.         {
  1029.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1030.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1031.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1032.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1033.             return 1;
  1034.         }
  1035.         else if(!IsNumeric2(tmp2) || (newoffsetx < MIN_ATTACHED_OBJECT_OFFSET || newoffsetx > MAX_ATTACHED_OBJECT_OFFSET)) {
  1036.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object offset(X) value [%s]!", tmp2);
  1037.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1038.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetX) value are larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET"");
  1039.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 5000, 3);
  1040.             return 1;
  1041.         }
  1042.         else
  1043.         {
  1044.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], newoffsetx, pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1045.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1046.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object position (OffsetX) to %.2f at slot/index number %i!", newoffsetx, slot);
  1047.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1048.             GameTextForPlayer(playerid, "~g~Attached object position updated!", 5000, 3);
  1049.         }
  1050.     }
  1051.     return 1;
  1052. }
  1053.  
  1054. dcmd_saoox(playerid, params[]) return dcmd_setattachedobjectoffsetx(playerid, params);
  1055.  
  1056. dcmd_setattachedobjectoffsety(playerid, params[])
  1057. {
  1058.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1059.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1060.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1061.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1062.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1063.         return 1;
  1064.     }
  1065.     else
  1066.     {
  1067.         new idx, tmp[24], tmp2[24], slot, Float:newoffsety;
  1068.         tmp = strtok(params, idx), slot = strval(tmp);
  1069.         tmp2 = strtok(params, idx), newoffsety = floatstr(tmp2);
  1070.         if(!strlen(tmp) || !strlen(tmp2)) {
  1071.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsety <AttachedObjectSlot> <Float:OffsetY>");
  1072.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetY) with specified parameters");
  1073.             return 1;
  1074.         }
  1075.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1076.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1077.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1078.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1079.             return 1;
  1080.         }
  1081.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1082.         {
  1083.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1084.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1085.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1086.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1087.             return 1;
  1088.         }
  1089.         else if(!IsNumeric2(tmp2) || (newoffsety < MIN_ATTACHED_OBJECT_OFFSET || newoffsety > MAX_ATTACHED_OBJECT_OFFSET)) {
  1090.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object offset(Y) value [%s]!", tmp2);
  1091.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1092.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetY) value are larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET"");
  1093.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 5000, 3);
  1094.             return 1;
  1095.         }
  1096.         else
  1097.         {
  1098.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], newoffsety, pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1099.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1100.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object position (OffsetY) to %.2f at slot/index number %i!", newoffsety, slot);
  1101.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1102.             GameTextForPlayer(playerid, "~g~Attached object position updated!", 5000, 3);
  1103.         }
  1104.     }
  1105.     return 1;
  1106. }
  1107.  
  1108. dcmd_saooy(playerid, params[]) return dcmd_setattachedobjectoffsety(playerid, params);
  1109.  
  1110. dcmd_setattachedobjectoffsetz(playerid, params[])
  1111. {
  1112.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1113.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1114.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1115.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1116.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1117.         return 1;
  1118.     }
  1119.     else
  1120.     {
  1121.         new idx, tmp[24], tmp2[24], slot, Float:newoffsetz;
  1122.         tmp = strtok(params, idx), slot = strval(tmp);
  1123.         tmp2 = strtok(params, idx), newoffsetz = floatstr(tmp2);
  1124.         if(!strlen(tmp) || !strlen(tmp2)) {
  1125.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectoffsetz <AttachedObjectSlot> <Float:OffsetZ>");
  1126.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object position (OffsetZ) with specified parameters");
  1127.             return 1;
  1128.         }
  1129.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1130.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1131.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1132.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1133.             return 1;
  1134.         }
  1135.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1136.         {
  1137.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1138.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1139.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1140.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1141.             return 1;
  1142.         }
  1143.         else if(!IsNumeric2(tmp2) || (newoffsetz < MIN_ATTACHED_OBJECT_OFFSET || newoffsetz > MAX_ATTACHED_OBJECT_OFFSET)) {
  1144.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object offset(Z) value [%s]!", tmp2);
  1145.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1146.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (OffsetZ) value are larger than "#MIN_ATTACHED_OBJECT_OFFSET" and less than "#MAX_ATTACHED_OBJECT_OFFSET"");
  1147.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object offset value!", 5000, 3);
  1148.             return 1;
  1149.         }
  1150.         else
  1151.         {
  1152.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], newoffsetz, pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1153.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1154.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object position (OffsetZ) to %.2f at slot/index number %i!", newoffsetz, slot);
  1155.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1156.             GameTextForPlayer(playerid, "~g~Attached object position updated!", 5000, 3);
  1157.         }
  1158.     }
  1159.     return 1;
  1160. }
  1161.  
  1162. dcmd_saooz(playerid, params[]) return dcmd_setattachedobjectoffsetz(playerid, params);
  1163.  
  1164. dcmd_setattachedobjectrotx(playerid, params[])
  1165. {
  1166.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1167.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1168.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1169.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1170.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1171.         return 1;
  1172.     }
  1173.     else
  1174.     {
  1175.         new idx, tmp[24], tmp2[24], slot, Float:newrotx;
  1176.         tmp = strtok(params, idx), slot = strval(tmp);
  1177.         tmp2 = strtok(params, idx), newrotx = floatstr(tmp2);
  1178.         if(!strlen(tmp) || !strlen(tmp2)) {
  1179.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectrotx <AttachedObjectSlot> <Float:RotX>");
  1180.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotX) with specified parameters");
  1181.             return 1;
  1182.         }
  1183.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1184.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1185.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1186.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1187.             return 1;
  1188.         }
  1189.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1190.         {
  1191.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1192.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1193.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1194.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1195.             return 1;
  1196.         }
  1197.         else if(!IsNumeric2(tmp2) || (newrotx < MIN_ATTACHED_OBJECT_ROT || newrotx > MAX_ATTACHED_OBJECT_ROT)) {
  1198.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object rotation(X) value [%s]!", tmp2);
  1199.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1200.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotX) value are larger than "#MIN_ATTACHED_OBJECT_ROT" and less than "#MAX_ATTACHED_OBJECT_ROT"");
  1201.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 5000, 3);
  1202.             return 1;
  1203.         }
  1204.         else
  1205.         {
  1206.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], newrotx, pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1207.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1208.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object rotation (RotX) to %.2f at slot/index number %i!", newrotx, slot);
  1209.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1210.             GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 5000, 3);
  1211.         }
  1212.     }
  1213.     return 1;
  1214. }
  1215.  
  1216. dcmd_saorx(playerid, params[]) return dcmd_setattachedobjectrotx(playerid, params);
  1217.  
  1218. dcmd_setattachedobjectroty(playerid, params[])
  1219. {
  1220.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1221.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1222.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1223.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1224.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1225.         return 1;
  1226.     }
  1227.     else
  1228.     {
  1229.         new idx, tmp[24], tmp2[24], slot, Float:newroty;
  1230.         tmp = strtok(params, idx), slot = strval(tmp);
  1231.         tmp2 = strtok(params, idx), newroty = floatstr(tmp2);
  1232.         if(!strlen(tmp) || !strlen(tmp2)) {
  1233.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectroty <AttachedObjectSlot> <Float:RotY>");
  1234.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotY) with specified parameters");
  1235.             return 1;
  1236.         }
  1237.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1238.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1239.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1240.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1241.             return 1;
  1242.         }
  1243.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1244.         {
  1245.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1246.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1247.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1248.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1249.             return 1;
  1250.         }
  1251.         else if(!IsNumeric2(tmp2) || (newroty < MIN_ATTACHED_OBJECT_ROT || newroty > MAX_ATTACHED_OBJECT_ROT)) {
  1252.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object rotation(Y) value [%s]!", tmp2);
  1253.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1254.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotY) value are larger than "#MIN_ATTACHED_OBJECT_ROT" and less than "#MAX_ATTACHED_OBJECT_ROT"");
  1255.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 5000, 3);
  1256.             return 1;
  1257.         }
  1258.         else
  1259.         {
  1260.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], newroty, pao[playerid][slot][aoRZ],
  1261.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1262.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object rotation (RotY) to %.2f at slot/index number %i!", newroty, slot);
  1263.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1264.             GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 5000, 3);
  1265.         }
  1266.     }
  1267.     return 1;
  1268. }
  1269.  
  1270. dcmd_saory(playerid, params[]) return dcmd_setattachedobjectroty(playerid, params);
  1271.  
  1272. dcmd_setattachedobjectrotz(playerid, params[])
  1273. {
  1274.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1275.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1276.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1277.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1278.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1279.         return 1;
  1280.     }
  1281.     else
  1282.     {
  1283.         new idx, tmp[24], tmp2[24], slot, Float:newrotz;
  1284.         tmp = strtok(params, idx), slot = strval(tmp);
  1285.         tmp2 = strtok(params, idx), newrotz = floatstr(tmp2);
  1286.         if(!strlen(tmp) || !strlen(tmp2)) {
  1287.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectrotz <AttachedObjectSlot> <Float:RotZ>");
  1288.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object rotation (RotZ) with specified parameters");
  1289.             return 1;
  1290.         }
  1291.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1292.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1293.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1294.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1295.             return 1;
  1296.         }
  1297.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1298.         {
  1299.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1300.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1301.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1302.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1303.             return 1;
  1304.         }
  1305.         else if(!IsNumeric2(tmp2) || (newrotz < MIN_ATTACHED_OBJECT_ROT || newrotz > MAX_ATTACHED_OBJECT_ROT)) {
  1306.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object rotation(Z) value [%s]!", tmp2);
  1307.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1308.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (RotZ) value are larger than "#MIN_ATTACHED_OBJECT_ROT" and less than "#MAX_ATTACHED_OBJECT_ROT"");
  1309.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object rotation value!", 5000, 3);
  1310.             return 1;
  1311.         }
  1312.         else
  1313.         {
  1314.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], newrotz,
  1315.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1316.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object rotation (RotZ) to %.2f at slot/index number %i!", newrotz, slot);
  1317.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1318.             GameTextForPlayer(playerid, "~g~Attached object rotation updated!", 5000, 3);
  1319.         }
  1320.     }
  1321.     return 1;
  1322. }
  1323.  
  1324. dcmd_saorz(playerid, params[]) return dcmd_setattachedobjectrotz(playerid, params);
  1325.  
  1326. dcmd_setattachedobjectscalex(playerid, params[])
  1327. {
  1328.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1329.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1330.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1331.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1332.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1333.         return 1;
  1334.     }
  1335.     else
  1336.     {
  1337.         new idx, tmp[24], tmp2[24], slot, Float:newscalex;
  1338.         tmp = strtok(params, idx), slot = strval(tmp);
  1339.         tmp2 = strtok(params, idx), newscalex = floatstr(tmp2);
  1340.         if(!strlen(tmp) || !strlen(tmp2)) {
  1341.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscalex <AttachedObjectSlot> <Float:ScaleX>");
  1342.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleX) with specified parameters");
  1343.             return 1;
  1344.         }
  1345.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1346.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1347.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1348.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1349.             return 1;
  1350.         }
  1351.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1352.         {
  1353.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1354.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1355.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1356.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1357.             return 1;
  1358.         }
  1359.         else if(!IsNumeric2(tmp2) || (newscalex < MIN_ATTACHED_OBJECT_SIZE || newscalex > MAX_ATTACHED_OBJECT_SIZE)) {
  1360.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object scale(X) value [%s]!", tmp2);
  1361.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1362.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleX) value are larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE"");
  1363.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 5000, 3);
  1364.             return 1;
  1365.         }
  1366.         else
  1367.         {
  1368.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1369.             newscalex, pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1370.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object size (ScaleX) to %.2f at slot/index number %i!", newscalex, slot);
  1371.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1372.             GameTextForPlayer(playerid, "~g~Attached object size updated!", 5000, 3);
  1373.         }
  1374.     }
  1375.     return 1;
  1376. }
  1377.  
  1378. dcmd_saosx(playerid, params[]) return dcmd_setattachedobjectscalex(playerid, params);
  1379.  
  1380. dcmd_setattachedobjectscaley(playerid, params[])
  1381. {
  1382.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1383.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1384.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1385.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1386.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1387.         return 1;
  1388.     }
  1389.     else
  1390.     {
  1391.         new idx, tmp[24], tmp2[24], slot, Float:newscaley;
  1392.         tmp = strtok(params, idx), slot = strval(tmp);
  1393.         tmp2 = strtok(params, idx), newscaley = floatstr(tmp2);
  1394.         if(!strlen(tmp) || !strlen(tmp2)) {
  1395.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscaley <AttachedObjectSlot> <Float:ScaleY>");
  1396.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleY) with specified parameters");
  1397.             return 1;
  1398.         }
  1399.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1400.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1401.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1402.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1403.             return 1;
  1404.         }
  1405.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1406.         {
  1407.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1408.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1409.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1410.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1411.             return 1;
  1412.         }
  1413.         else if(!IsNumeric2(tmp2) || (newscaley < MIN_ATTACHED_OBJECT_SIZE || newscaley > MAX_ATTACHED_OBJECT_SIZE)) {
  1414.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object scale(Y) value [%s]!", tmp2);
  1415.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1416.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleY) value are larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE"");
  1417.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 5000, 3);
  1418.             return 1;
  1419.         }
  1420.         else
  1421.         {
  1422.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1423.             pao[playerid][slot][aoSX], newscaley, pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1424.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object size (ScaleY) to %.2f at slot/index number %i!", newscaley, slot);
  1425.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1426.             GameTextForPlayer(playerid, "~g~Attached object size updated!", 5000, 3);
  1427.         }
  1428.     }
  1429.     return 1;
  1430. }
  1431.  
  1432. dcmd_saosy(playerid, params[]) return dcmd_setattachedobjectscaley(playerid, params);
  1433.  
  1434. dcmd_setattachedobjectscalez(playerid, params[])
  1435. {
  1436.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1437.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1438.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1439.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1440.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1441.         return 1;
  1442.     }
  1443.     else
  1444.     {
  1445.         new idx, tmp[24], tmp2[24], slot, Float:newscalez;
  1446.         tmp = strtok(params, idx), slot = strval(tmp);
  1447.         tmp2 = strtok(params, idx), newscalez = floatstr(tmp2);
  1448.         if(!strlen(tmp) || !strlen(tmp2)) {
  1449.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectscalez <AttachedObjectSlot> <Float:ScaleZ>");
  1450.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object size (ScaleZ) with specified parameters");
  1451.             return 1;
  1452.         }
  1453.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1454.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1455.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1456.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1457.             return 1;
  1458.         }
  1459.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1460.         {
  1461.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1462.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1463.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1464.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1465.             return 1;
  1466.         }
  1467.         else if(!IsNumeric2(tmp2) || (newscalez < MIN_ATTACHED_OBJECT_SIZE || newscalez > MAX_ATTACHED_OBJECT_SIZE)) {
  1468.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object scale(Z) value [%s]!", tmp2);
  1469.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1470.             SendClientMessage(playerid, COLOR_YELLOW, "** Allowed float (ScaleZ) value are larger than "#MIN_ATTACHED_OBJECT_SIZE" and less than "#MAX_ATTACHED_OBJECT_SIZE"");
  1471.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object size value!", 5000, 3);
  1472.             return 1;
  1473.         }
  1474.         else
  1475.         {
  1476.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1477.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], newscalez, pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1478.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object size (ScaleZ) to %.2f at slot/index number %i!", newscalez, slot);
  1479.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1480.             GameTextForPlayer(playerid, "~g~Attached object size updated!", 5000, 3);
  1481.         }
  1482.     }
  1483.     return 1;
  1484. }
  1485.  
  1486. dcmd_saosz(playerid, params[]) return dcmd_setattachedobjectscalez(playerid, params);
  1487.  
  1488. dcmd_setattachedobjectmc1(playerid, params[])
  1489. {
  1490.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1491.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1492.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1493.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1494.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1495.         return 1;
  1496.     }
  1497.     else
  1498.     {
  1499.         new idx, tmp[24], tmp2[24], slot, newmc1;
  1500.         tmp = strtok(params, idx), slot = strval(tmp);
  1501.         if(!strlen(tmp)) {
  1502.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc1 <AttachedObjectSlot> <MaterialColor>");
  1503.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:1) with specified parameters");
  1504.             return 1;
  1505.         }
  1506.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1507.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1508.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1509.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1510.             return 1;
  1511.         }
  1512.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1513.         {
  1514.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1515.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1516.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1517.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1518.             return 1;
  1519.         }
  1520.         else
  1521.         {
  1522.             new alpha[3], red[3], green[3], blue[3], colors[16];
  1523.             tmp2 = strtok(params, idx);
  1524.             if(!strlen(tmp2)) {
  1525.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc1 <AttachedObjectSlot> <MaterialColor>");
  1526.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:1) with specified parameters");
  1527.                 return 1;
  1528.             }
  1529.             else
  1530.             {
  1531.                 strins(colors, tmp2, 0);
  1532.                 if(IsNumeric2(tmp2)) newmc1 = strval(colors); // Integer
  1533.                 else if(strlen(tmp2) == 8) // AARRGGBB
  1534.                 {
  1535.                     SetColor:
  1536.                     if(IsValidHex(colors))
  1537.                     {
  1538.                         format(alpha, sizeof(alpha), "%c%c", colors[0], colors[1]);
  1539.                         format(red, sizeof(red), "%c%c", colors[2], colors[3]);
  1540.                         format(green, sizeof(green), "%c%c", colors[4], colors[5]);
  1541.                         format(blue, sizeof(blue), "%c%c", colors[6], colors[7]);
  1542.                         newmc1 = RGBAtoARGB(RGB(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha)));
  1543.                     }
  1544.                     else goto Error;
  1545.                 }
  1546.                 else if(tmp2[0] == '#' && strlen(tmp2) == 9) { // #AARRGGBB
  1547.                     strdel(colors, 0, 1);
  1548.                     goto SetColor;
  1549.                 }
  1550.                 else if(tmp2[0] == '0' && tmp2[1] == 'x' && strlen(tmp2) == 10) { // 0xAARRGGBB
  1551.                     strdel(colors, 0, 2);
  1552.                     goto SetColor;
  1553.                 }
  1554.                 else
  1555.                 {
  1556.                     Error:
  1557.                     format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object color(MC1) value [%s]!", tmp2);
  1558.                     SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1559.                     SendClientMessage(playerid, COLOR_WHITE, "** Use hex color with ARGB (AARRGGBB) format (eg. 0xFFFF0000, #FF00FF00, FF0000FF) or integer value.");
  1560.                     GameTextForPlayer(playerid, "~r~~h~Invalid attached object color value!", 5000, 3);
  1561.                     return 1;
  1562.                 }
  1563.             }
  1564.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1565.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], newmc1, pao[playerid][slot][aoMC2]);
  1566.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object color (MC1) to %s at slot/index number %i!", tmp2, slot);
  1567.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1568.             GameTextForPlayer(playerid, "~g~Attached object color updated!", 5000, 3);
  1569.         }
  1570.     }
  1571.     return 1;
  1572. }
  1573.  
  1574. dcmd_saomc1(playerid, params[]) return dcmd_setattachedobjectmc1(playerid, params);
  1575.  
  1576. dcmd_setattachedobjectmc2(playerid, params[])
  1577. {
  1578.     if(GetPVarInt(playerid, "EditingAttachedObject") != 0 || GetPlayerState(playerid) == PLAYER_STATE_WASTED || GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  1579.         return SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you can't use this command right now!"), 1;
  1580.     else if(!GetPlayerAttachedObjectsCount(playerid)) {
  1581.         SendClientMessage(playerid, COLOR_YELLOW, "* Sorry, you don't have any attached object!");
  1582.         GameTextForPlayer(playerid, "~r~~h~You have no attached object!", 5000, 3);
  1583.         return 1;
  1584.     }
  1585.     else
  1586.     {
  1587.         new idx, tmp[24], tmp2[24], slot, newmc2;
  1588.         tmp = strtok(params, idx), slot = strval(tmp);
  1589.         if(!strlen(tmp)) {
  1590.             SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc2 <AttachedObjectSlot> <MaterialColor>");
  1591.             SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:2) with specified parameters");
  1592.             return 1;
  1593.         }
  1594.         else if(!IsValidAttachedObjectSlot(slot) || !IsNumeric(tmp)) {
  1595.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object slot/index number [%s]!", tmp);
  1596.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1597.             GameTextForPlayer(playerid, "~r~~h~Invalid attached object slot!", 5000, 3);
  1598.             return 1;
  1599.         }
  1600.         else if(!IsPlayerAttachedObjectSlotUsed(playerid, slot))
  1601.         {
  1602.             format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", slot);
  1603.             format(aoe_str, sizeof(aoe_str), "~r~~h~You have no attached object~n~~w~index/number: %i", slot);
  1604.             SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1605.             GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1606.             return 1;
  1607.         }
  1608.         else
  1609.         {
  1610.             new alpha[3], red[3], green[3], blue[3], colors[10];
  1611.             tmp2 = strtok(params, idx);
  1612.             if(!strlen(tmp)) {
  1613.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmc2 <AttachedObjectSlot> <MaterialColor>");
  1614.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object color (Material:2) with specified parameters");
  1615.                 return 1;
  1616.             }
  1617.             else
  1618.             {
  1619.                 strins(colors, tmp2, 0);
  1620.                 if(IsNumeric2(tmp2)) newmc2 = strval(colors); // Integer
  1621.                 else if(strlen(tmp2) == 8) // AARRGGBB
  1622.                 {
  1623.                     SetColor:
  1624.                     if(IsValidHex(colors))
  1625.                     {
  1626.                         format(alpha, sizeof(alpha), "%c%c", colors[0], colors[1]);
  1627.                         format(red, sizeof(red), "%c%c", colors[2], colors[3]);
  1628.                         format(green, sizeof(green), "%c%c", colors[4], colors[5]);
  1629.                         format(blue, sizeof(blue), "%c%c", colors[6], colors[7]);
  1630.                         newmc2 = RGBAtoARGB(RGB(HexToInt(red), HexToInt(green), HexToInt(blue), HexToInt(alpha)));
  1631.                     }
  1632.                     else goto Error;
  1633.                 }
  1634.                 else if(tmp2[0] == '#' && strlen(tmp2) == 9) { // #AARRGGBB
  1635.                     strdel(colors, 0, 1);
  1636.                     goto SetColor;
  1637.                 }
  1638.                 else if(tmp2[0] == '0' && tmp2[1] == 'x' && strlen(tmp2) == 10) { // 0xAARRGGBB
  1639.                     strdel(colors, 0, 2);
  1640.                     goto SetColor;
  1641.                 }
  1642.                 else
  1643.                 {
  1644.                     Error:
  1645.                     format(aoe_str2, sizeof(aoe_str2), "* Sorry, you've entered an invalid attached object color(MC2) value [%s]!", tmp2);
  1646.                     SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1647.                     SendClientMessage(playerid, COLOR_WHITE, "** Use hex color with ARGB (AARRGGBB) format (eg. 0xFFFF0000, #FF00FF00, FF0000FF) or integer value.");
  1648.                     GameTextForPlayer(playerid, "~r~~h~Invalid attached object color value!", 5000, 3);
  1649.                     return 1;
  1650.                 }
  1651.             }
  1652.             UpdatePlayerAttachedObjectEx(playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ],
  1653.             pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ], pao[playerid][slot][aoMC1], newmc2);
  1654.             format(aoe_str2, sizeof(aoe_str2), "* Updated your attached object color (MC2) to %s at slot/index number %i!", tmp2, slot);
  1655.             SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1656.             GameTextForPlayer(playerid, "~g~Attached object color updated!", 5000, 3);
  1657.         }
  1658.     }
  1659.     return 1;
  1660. }
  1661.  
  1662. dcmd_saomc2(playerid, params[]) return dcmd_setattachedobjectmc2(playerid, params);
  1663.  
  1664. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1665. {
  1666.     switch(dialogid)
  1667.     {
  1668.         case AOED:
  1669.         {
  1670.             if(response)
  1671.             {
  1672.                 switch(listitem)
  1673.                 {
  1674.                     case 0: OnPlayerCommandText(playerid, "/createattachedobject");
  1675.                     case 1: OnPlayerCommandText(playerid, "/duplicateattachedobject");
  1676.                     case 2: OnPlayerCommandText(playerid, "/editattachedobject");
  1677.                     case 3: OnPlayerCommandText(playerid, "/saveattachedobject");
  1678.                     case 4: OnPlayerCommandText(playerid, "/saveattachedobjects");
  1679.                     case 5: OnPlayerCommandText(playerid, "/loadattachedobject");
  1680.                     case 6: OnPlayerCommandText(playerid, "/loadattachedobjects");
  1681.                     case 7: OnPlayerCommandText(playerid, "/removeattachedobject");
  1682.                     case 8: OnPlayerCommandText(playerid, "/removeattachedobjects");
  1683.                     case 9: OnPlayerCommandText(playerid, "/undodeleteattachedobject");
  1684.                     case 10: OnPlayerCommandText(playerid, "/convertattachedobjectfile");
  1685.                     case 11: OnPlayerCommandText(playerid, "/attachedobjectlist");
  1686.                     case 12: OnPlayerCommandText(playerid, "/attachedobjectstats");
  1687.                     case 13: OnPlayerCommandText(playerid, "/totalattachedobjects");
  1688.                     case 14: AOE_ShowPlayerDialog(playerid, 1, AOED_HELP, "Attached Object Editor Help", "Close");
  1689.                     case 15: AOE_ShowPlayerDialog(playerid, 3, AOED_ABOUT, "About Attached Object Editor", "Close");
  1690.                 }
  1691.             }
  1692.             else SendClientMessage(playerid, COLOR_WHITE, "* You've closed attached object editor dialog");
  1693.         }
  1694.         case AOED_CREATE_MODEL:
  1695.         {
  1696.             if(response) {
  1697.                 format(aoe_str, sizeof(aoe_str), "%s", inputtext);
  1698.                 dcmd_createattachedobject(playerid, aoe_str);
  1699.             }
  1700.             else {
  1701.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>");
  1702.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters");
  1703.             }
  1704.         }
  1705.         case AOED_CREATE_BONE:
  1706.         {
  1707.             if(response) {
  1708.                 format(aoe_str, sizeof(aoe_str), "%d %i", GetPVarInt(playerid, "CreateAttachedObjectModel"), listitem + 1);
  1709.                 dcmd_createattachedobject(playerid, aoe_str);
  1710.             }
  1711.             else {
  1712.                 // AOE_ShowPlayerDialog(playerid, 4, AOED_CREATE_MODEL, "Create Attached Object", "Enter", "Cancel");
  1713.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>");
  1714.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters");
  1715.             }
  1716.         }
  1717.         case AOED_CREATE_SLOT:
  1718.         {
  1719.             if(response) {
  1720.                 format(aoe_str, sizeof(aoe_str), "%d %i %i", GetPVarInt(playerid, "CreateAttachedObjectModel"), GetPVarInt(playerid, "CreateAttachedObjectBone"), listitem);
  1721.                 dcmd_createattachedobject(playerid, aoe_str);
  1722.             }
  1723.             else {
  1724.                 // AOE_ShowPlayerDialog(playerid, 5, AOED_CREATE_BONE, "Create Attached Object", "Select", "Cancel");
  1725.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>");
  1726.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters");
  1727.             }
  1728.         }
  1729.         case AOED_CREATE_REPLACE:
  1730.         {
  1731.             if(response)
  1732.             {
  1733.                 new slot = GetPVarInt(playerid, "CreateAttachedObjectIndex"), model = GetPVarInt(playerid, "CreateAttachedObjectModel"), bone = GetPVarInt(playerid, "CreateAttachedObjectBone");
  1734.                 CreatePlayerAttachedObject(playerid, slot, model, bone);
  1735.                 format(aoe_str2, sizeof(aoe_str2), "* Created a new attached object model %d at slot/index number %i [Bone: %s (%i)]!", model, slot, GetAttachedObjectBoneName(bone), bone);
  1736.                 format(aoe_str, sizeof(aoe_str), "~b~Created attached object~n~~w~index/number: %i~n~Model: %d - Bone: %i", slot, model, bone);
  1737.                 SendClientMessage(playerid, COLOR_BLUE, aoe_str2);
  1738.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1739.                 AOE_ShowPlayerDialog(playerid, 10, AOED_CREATE_EDIT, "Edit attached object", "Edit", "Skip");
  1740.             }
  1741.             else {
  1742.                 // AOE_ShowPlayerDialog(playerid, 6, AOED_CREATE_SLOT, "Create Attached Object", "Select", "Cancel");
  1743.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /createattachedobject <ObjectModelID> <AttachedObjectBone> <AttachedObjectSlot>");
  1744.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to create your attached object with specified parameters");
  1745.             }
  1746.         }
  1747.         case AOED_CREATE_EDIT:
  1748.         {
  1749.             if(response) {
  1750.                 format(aoe_str, sizeof(aoe_str), "%i", GetPVarInt(playerid, "CreateAttachedObjectIndex"));
  1751.                 dcmd_editattachedobject(playerid, aoe_str);
  1752.             }
  1753.             else {
  1754.                 SendClientMessage(playerid, COLOR_WHITE, "* You've skipped to edit your attached object");
  1755.                 SendClientMessage(playerid, COLOR_WHITE, "** Note: use /editattachedobject command to edit your attached object");
  1756.             }
  1757.         }
  1758.         case AOED_EDIT_SLOT:
  1759.         {
  1760.             if(response)
  1761.             {
  1762.                 if(IsPlayerAttachedObjectSlotUsed(playerid, listitem)) {
  1763.                     format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1764.                     dcmd_editattachedobject(playerid, aoe_str);
  1765.                 }
  1766.                 else {
  1767.                     format(aoe_str2, sizeof(aoe_str2), "* Sorry, you don't have attached object at slot/index number %i!", listitem);
  1768.                     SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  1769.                     AOE_ShowPlayerDialog(playerid, 7, AOED_EDIT_SLOT, "Edit Attached Object", "Edit", "Cancel");
  1770.                 }
  1771.             }
  1772.             else {
  1773.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /editattachedobject <AttachedObjectSlot>");
  1774.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to edit your attached object from specified slot/index number");
  1775.             }
  1776.             SetPVarInt(playerid, "EditingAttachedObject", 0);
  1777.         }
  1778.         case AOED_REMOVE_SLOT:
  1779.         {
  1780.             if(response) {
  1781.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1782.                 dcmd_removeattachedobject(playerid, aoe_str);
  1783.             }
  1784.             else {
  1785.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /removeattachedobject <AttachedObjectSlot>");
  1786.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to remove your attached object from specified attached object slot/index number");
  1787.             }
  1788.         }
  1789.         case AOED_REMOVE:
  1790.         {
  1791.             if(response)
  1792.             {
  1793.                 new slot = GetPVarInt(playerid, "RemoveAttachedObjectIndex");
  1794.                 RemovePlayerAttachedObjectEx(playerid, slot), SetPVarInt(playerid, "RemoveAttachedObjectIndex", slot);
  1795.                 format(aoe_str2, sizeof(aoe_str2), "* You've removed your attached object from slot/index number %i!", slot);
  1796.                 format(aoe_str, sizeof(aoe_str), "~r~Removed your attached object~n~~w~index/number: %i", slot);
  1797.                 SendClientMessage(playerid, COLOR_RED, aoe_str2);
  1798.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1799.             }
  1800.             else SendClientMessage(playerid, COLOR_WHITE, "* You've canceled removing your attached object");
  1801.         }
  1802.         case AOED_REMOVEALL:
  1803.         {
  1804.             if(response)
  1805.             {
  1806.                 new slots = RemovePlayerAttachedObjectEx(playerid, 0, true);
  1807.                 format(aoe_str2, sizeof(aoe_str2), "* You've removed all of your %d attached object(s)!", slots);
  1808.                 format(aoe_str, sizeof(aoe_str), "~r~Removed all your attached object(s)~n~~w~Total: %d", slots);
  1809.                 SendClientMessage(playerid, COLOR_RED, aoe_str2);
  1810.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1811.             }
  1812.             else SendClientMessage(playerid, COLOR_WHITE, "* You've canceled removing all your attached object(s)");
  1813.         }
  1814.         case AOED_STATS_SLOT:
  1815.         {
  1816.             if(response) {
  1817.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1818.                 dcmd_attachedobjectstats(playerid, aoe_str);
  1819.             }
  1820.             else {
  1821.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /attachedobjectstats <AttachedObjectSlot>");
  1822.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to view your attached stats object from specified slot");
  1823.             }
  1824.         }
  1825.         case AOED_STATS:
  1826.         {
  1827.             if(response && IsPlayerAdmin(playerid))
  1828.             {
  1829.                 new slot = GetPVarInt(playerid, "AttachedObjectStatsIndex");
  1830.                 GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  1831.                 printf("  >> %s (ID:%i) is requesting to print their attached object stats", PlayerName, playerid);
  1832.                 printf("  Attached object slot/index number: %i\n  - Model ID/Number/Type: %d\n  - Bone: %s (ID:%d)\n  - Offsets:\n  -- X: %.2f ~ Y: %.2f ~ Z: %.2f\n  - Rotations:\n  -- RX: %.2f ~ RY: %.2f ~ RZ: %.2f\
  1833.                 \n  - Scales:\n  -- SX: %.2f ~ SY: %.2f ~ SZ: %.2f\n  - Materials:\n  -- Color 1: %i (%x) ~ Color 2: %i (%x)\n  Total of %s (ID:%i)'s attached object(s): %d", slot, pao[playerid][slot][aoModelID], GetAttachedObjectBoneName(pao[playerid][slot][aoBoneID]),
  1834.                 pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ],
  1835.                 pao[playerid][slot][aoMC1], IntToHex(pao[playerid][slot][aoMC1]), pao[playerid][slot][aoMC2], IntToHex(pao[playerid][slot][aoMC2]), PlayerName, playerid, GetPlayerAttachedObjectsCount(playerid));
  1836.                 printf("  Skin: %i ~ Code usage (playerid = %i):\n  SetPlayerAttachedObject(playerid, %i, %d, %i, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %i, %i);", GetPlayerSkin(playerid), playerid, slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID],
  1837.                 pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ], pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ],
  1838.                 pao[playerid][slot][aoMC1], pao[playerid][slot][aoMC2]);
  1839.                 SendClientMessage(playerid, COLOR_WHITE, "SERVER: Your attached object stats has been printed!");
  1840.             }
  1841.             else SendClientMessage(playerid, COLOR_WHITE, "* You've closed your attached object stats dialog");
  1842.         }
  1843.         case AOED_AO_LIST:
  1844.         {
  1845.             if(response) {
  1846.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1847.                 dcmd_editattachedobject(playerid, aoe_str);
  1848.             }
  1849.             else SendClientMessage(playerid, COLOR_WHITE, "* You've closed your attached object list dialog");
  1850.         }
  1851.         case AOED_DUPLICATE_SLOT1:
  1852.         {
  1853.             if(response) {
  1854.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1855.                 dcmd_duplicateattachedobject(playerid, aoe_str);
  1856.             }
  1857.             else {
  1858.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /duplicateattachedobject <FromAttachedObjectSlot> <ToAttachedObjectSlot>");
  1859.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to duplicate your attached object from specified slot to another specified slot");
  1860.             }
  1861.         }
  1862.         case AOED_DUPLICATE_SLOT2:
  1863.         {
  1864.             if(response) {
  1865.                 format(aoe_str, sizeof(aoe_str), "%i %i", GetPVarInt(playerid, "DuplicateAttachedObjectIndex1"), listitem);
  1866.                 dcmd_duplicateattachedobject(playerid, aoe_str);
  1867.             }
  1868.             else {
  1869.                 // AOE_ShowPlayerDialog(playerid, 7, AOED_DUPLICATE_SLOT1, "Duplicate Attached Object Index (1)", "Select", "Cancel");
  1870.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /duplicateattachedobject <FromAttachedObjectSlot> <ToAttachedObjectSlot>");
  1871.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to duplicate your attached object from specified slot to another specified slot");
  1872.             }
  1873.         }
  1874.         case AOED_DUPLICATE_REPLACE:
  1875.         {
  1876.             if(response)
  1877.             {
  1878.                 new slot1 = GetPVarInt(playerid, "DuplicateAttachedObjectIndex1"), slot2 = GetPVarInt(playerid, "DuplicateAttachedObjectIndex2");
  1879.                 DuplicatePlayerAttachedObject(playerid, slot1, slot2);
  1880.                 format(aoe_str2, sizeof(aoe_str2), "* Duplicated your attached object from slot/index number %i to %i!", slot1, slot2);
  1881.                 format(aoe_str, sizeof(aoe_str), "~g~Attached object duplicated~n~~w~index/number:~n~%i to %i", slot1, slot2);
  1882.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1883.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1884.             }
  1885.             else {
  1886.                 // AOE_ShowPlayerDialog(playerid, 6, AOED_DUPLICATE_SLOT2, "Duplicate Attached Object Index (2)", "Select", "Cancel");
  1887.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /duplicateattachedobject <FromAttachedObjectSlot> <ToAttachedObjectSlot>");
  1888.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to duplicate your attached object from specified slot to another specified slot");
  1889.             }
  1890.         }
  1891.         case AOED_SET_SLOT1:
  1892.         {
  1893.             if(response) {
  1894.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1895.                 dcmd_setattachedobjectindex(playerid, aoe_str);
  1896.             }
  1897.             else {
  1898.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectindex <FromAttachedObjectSlot> <ToAttachedObjectSlot>");
  1899.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to change your attached object slot to another specified slot");
  1900.             }
  1901.         }
  1902.         case AOED_SET_SLOT2:
  1903.         {
  1904.             if(response) {
  1905.                 format(aoe_str, sizeof(aoe_str), "%i %i", GetPVarInt(playerid, "SetAttachedObjectIndex1"), listitem);
  1906.                 dcmd_setattachedobjectindex(playerid, aoe_str);
  1907.             }
  1908.             else {
  1909.                 // AOE_ShowPlayerDialog(playerid, 7, AOED_SET_SLOT1, "Set Attached Object Index (1)", "Select", "Cancel");
  1910.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectindex <FromAttachedObjectSlot> <ToAttachedObjectSlot>");
  1911.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to change your attached object slot to another specified slot");
  1912.             }
  1913.         }
  1914.         case AOED_SET_SLOT_REPLACE:
  1915.         {
  1916.             if(response)
  1917.             {
  1918.                 new slot = GetPVarInt(playerid, "SetAttachedObjectIndex1"), newslot = GetPVarInt(playerid, "SetAttachedObjectIndex2");
  1919.                 MovePlayerAttachedObjectIndex(playerid, slot, newslot);
  1920.                 format(aoe_str2, sizeof(aoe_str2), "* Moved & replaced your attached object from slot/index number %i to %i!", slot, newslot);
  1921.                 format(aoe_str, sizeof(aoe_str), "~g~Attached object moved~n~~w~index/number:~n~%i to %i", slot, newslot);
  1922.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  1923.                 GameTextForPlayer(playerid, aoe_str, 5000, 3);
  1924.             }
  1925.             else {
  1926.                 // AOE_ShowPlayerDialog(playerid, 6, AOED_SET_SLOT2, "Set Attached Object Index (2)", "Select", "Cancel");
  1927.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectindex <FromAttachedObjectSlot> <ToAttachedObjectSlot>");
  1928.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to change your attached object slot to another specified slot");
  1929.             }
  1930.         }
  1931.         case AOED_SET_MODEL_SLOT:
  1932.         {
  1933.             if(response) {
  1934.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1935.                 dcmd_setattachedobjectmodel(playerid, aoe_str);
  1936.             }
  1937.             else {
  1938.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmodel <AttachedObjectSlot> <AttachedObjectModel>");
  1939.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object model from the specified parameters");
  1940.             }
  1941.         }
  1942.         case AOED_SET_MODEL:
  1943.         {
  1944.             if(response) {
  1945.                 format(aoe_str, sizeof(aoe_str), "%i %d", GetPVarInt(playerid, "SetAttachedObjectModelIndex"), strval(inputtext));
  1946.                 dcmd_setattachedobjectmodel(playerid, aoe_str);
  1947.             }
  1948.             else {
  1949.                 // AOE_ShowPlayerDialog(playerid, 7, AOED_SET_MODEL_SLOT, "Set Attached Object Model", "Select", "Cancel");
  1950.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectmodel <AttachedObjectSlot> <AttachedObjectModel>");
  1951.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object model from the specified parameters");
  1952.             }
  1953.         }
  1954.         case AOED_SET_BONE_SLOT:
  1955.         {
  1956.             if(response) {
  1957.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1958.                 dcmd_setattachedobjectbone(playerid, aoe_str);
  1959.             }
  1960.             else {
  1961.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectbone <AttachedObjectSlot> <AttachedObjectBone>");
  1962.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object bone from the specified parameters");
  1963.             }
  1964.         }
  1965.         case AOED_SET_BONE:
  1966.         {
  1967.             if(response) {
  1968.                 format(aoe_str, sizeof(aoe_str), "%i %i", GetPVarInt(playerid, "SetAttachedObjectBoneIndex"), listitem+1);
  1969.                 dcmd_setattachedobjectbone(playerid, aoe_str);
  1970.             }
  1971.             else {
  1972.                 // AOE_ShowPlayerDialog(playerid, 7, AOED_SET_BONE_SLOT, "Set Attached Object Bone", "Select", "Cancel");
  1973.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /setattachedobjectbone <AttachedObjectSlot> <AttachedObjectBone>");
  1974.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to set your attached object bone from the specified parameters");
  1975.             }
  1976.         }
  1977.         case AOED_SAVE_SLOT:
  1978.         {
  1979.             if(response) {
  1980.                 format(aoe_str, sizeof(aoe_str), "%i", listitem);
  1981.                 dcmd_saveattachedobject(playerid, aoe_str);
  1982.             }
  1983.             else {
  1984.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /saveattachedobject <AttachedObjectSlot> <FileName>");
  1985.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to save your attached object from the specified slot");
  1986.             }
  1987.         }
  1988.         case AOED_SAVE:
  1989.         {
  1990.             if(response) {
  1991.                 format(aoe_str, sizeof(aoe_str), "%i %s", GetPVarInt(playerid, "SaveAttachedObjectIndex"), inputtext);
  1992.                 dcmd_saveattachedobject(playerid, aoe_str);
  1993.             }
  1994.             else {
  1995.                 // AOE_ShowPlayerDialog(playerid, 15, AOED_SAVE_SLOT, "Save Attached Object", "Select", "Cancel");
  1996.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /saveattachedobject <AttachedObjectSlot> <FileName>");
  1997.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to save your attached object from the specified slot");
  1998.             }
  1999.         }
  2000.         case AOED_SAVE2:
  2001.         {
  2002.             if(response) dcmd_saveattachedobjects(playerid, inputtext);
  2003.             else {
  2004.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /saveattachedobjects <FileName>");
  2005.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to save all of your attached object(s) to a set file");
  2006.             }
  2007.         }
  2008.         case AOED_LOAD:
  2009.         {
  2010.             if(response) dcmd_loadattachedobject(playerid, inputtext);
  2011.             else {
  2012.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobject <FileName> <FromAttachedObjectSlot>");
  2013.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object from the specified slot in the file");
  2014.             }
  2015.         }
  2016.         case AOED_LOAD_SLOT:
  2017.         {
  2018.             if(response) {
  2019.                 GetPVarString(playerid, "LoadAttachedObjectName", aoe_str, sizeof(aoe_str));
  2020.                 format(aoe_str, sizeof(aoe_str), "%s %i", aoe_str, strval(inputtext));
  2021.                 dcmd_loadattachedobject(playerid, aoe_str);
  2022.             }
  2023.             else {
  2024.                 // AOE_ShowPlayerDialog(playerid, 16, AOED_LOAD, "Load Attached Object", "Enter", "Cancel");
  2025.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobject <FileName> <FromAttachedObjectSlot>");
  2026.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object from the specified slot in the file");
  2027.             }
  2028.         }
  2029.         case AOED_LOAD_REPLACE:
  2030.         {
  2031.             if(response) {
  2032.                 SendClientMessage(playerid, COLOR_WHITE, "* Loading attached object file, please wait...");
  2033.                 new slot = GetPVarInt(playerid, "LoadAttachedObjectIndex"), ao_file[32];
  2034.                 GetPVarString(playerid, "LoadAttachedObjectName", aoe_str, sizeof(aoe_str));
  2035.                 format(ao_file, sizeof(ao_file), AO_FILENAME, aoe_str);
  2036.                 AOE_LoadPlayerAttachedObject(playerid, slot, ao_file);
  2037.                 format(aoe_str2, sizeof(aoe_str2), "** You've loaded & replaced your attached object from file \"%s\" by %s from skin %i (Index: %i - Model: %d - Bone: %i)!", aoe_str,
  2038.                 dini_Get(ao_file, "auth"), dini_Int(ao_file, "skin"), slot, pao[playerid][slot][aoModelID], pao[playerid][slot][aoBoneID]);
  2039.                 SendClientMessage(playerid, COLOR_GREEN, aoe_str2);
  2040.             }
  2041.             else {
  2042.                 // AOE_ShowPlayerDialog(playerid, 17, AOED_LOAD_REPLACE, "Load & Replace Attached Object", "Yes", "Cancel");
  2043.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobject <FileName> <FromAttachedObjectSlot>");
  2044.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object from the specified slot in the file");
  2045.             }
  2046.         }
  2047.         case AOED_LOAD2:
  2048.         {
  2049.             if(response) dcmd_loadattachedobjects(playerid, inputtext);
  2050.             else {
  2051.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /loadattachedobjects <FileName>");
  2052.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to load a saved attached object(s) set file");
  2053.             }
  2054.         }
  2055.         case AOED_CONVERT:
  2056.         {
  2057.             if(response) dcmd_convertattachedobjectfile(playerid, inputtext);
  2058.             else {
  2059.                 SendClientMessage(playerid, COLOR_MAGENTA, "* Usage: /convertattachedobjectfile <FileName>");
  2060.                 SendClientMessage(playerid, COLOR_WHITE, "** Allows you to convert a saved attached object(s) file to raw code file");
  2061.             }
  2062.         }
  2063.     }
  2064.     return 0;
  2065. }
  2066.  
  2067. public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
  2068. {
  2069.     if(response == EDIT_RESPONSE_FINAL)
  2070.     {
  2071.         if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index);
  2072.         UpdatePlayerAttachedObjectEx(playerid, index, modelid, boneid, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ);
  2073.         SetPVarInt(playerid, "EditingAttachedObject", 0);
  2074.         format(aoe_str2, sizeof(aoe_str2), "* You've edited your attached object from slot/index number %i", index);
  2075.         format(aoe_str, sizeof(aoe_str), "~b~~h~Edited your attached object~n~~w~index/number: %i", index);
  2076.         SendClientMessage(playerid, COLOR_CYAN, aoe_str2);
  2077.         GameTextForPlayer(playerid, aoe_str, 5000, 3);
  2078.     }
  2079.     if(response == EDIT_RESPONSE_CANCEL)
  2080.     {
  2081.         if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index);
  2082.         SetPlayerAttachedObject(playerid, index, pao[playerid][index][aoModelID], pao[playerid][index][aoBoneID], pao[playerid][index][aoX], pao[playerid][index][aoY], pao[playerid][index][aoZ],
  2083.         pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ], pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]);
  2084.         pao[playerid][index][aoValid] = 1;
  2085.         SetPVarInt(playerid, "EditingAttachedObject", 0);
  2086.         format(aoe_str2, sizeof(aoe_str2), "* You've canceled editing your attached object from slot/index number %i", index);
  2087.         format(aoe_str, sizeof(aoe_str), "~r~~h~Canceled editing your attached object~n~~w~index/number: %i", index);
  2088.         SendClientMessage(playerid, COLOR_YELLOW, aoe_str2);
  2089.         GameTextForPlayer(playerid, aoe_str, 5000, 3);
  2090.     }
  2091.     return 1;
  2092. }
  2093.  
  2094. // =============================================================================
  2095.  
  2096. AOE_UnsetValues(playerid, index)
  2097. {
  2098.     pao[playerid][index][aoValid] = 0;
  2099.     pao[playerid][index][aoModelID] = 0, pao[playerid][index][aoBoneID] = 0;
  2100.     pao[playerid][index][aoX] = 0.0, pao[playerid][index][aoY] = 0.0, pao[playerid][index][aoZ] = 0.0;
  2101.     pao[playerid][index][aoRX] = 0.0, pao[playerid][index][aoRY] = 0.0, pao[playerid][index][aoRZ] = 0.0;
  2102.     pao[playerid][index][aoSX] = 0.0, pao[playerid][index][aoSY] = 0.0, pao[playerid][index][aoSZ] = 0.0;
  2103.     pao[playerid][index][aoMC1] = 0, pao[playerid][index][aoMC2] = 0;
  2104. }
  2105.  
  2106. AOE_UnsetVars(playerid)
  2107. {
  2108.     if(GetPVarInt(playerid, "EditingAttachedObject") == 1) CancelEdit(playerid);
  2109.     DeletePVar(playerid, "CreateAttachedObjectModel");
  2110.     DeletePVar(playerid, "CreateAttachedObjectBone");
  2111.     DeletePVar(playerid, "CreateAttachedObjectIndex");
  2112.     DeletePVar(playerid, "EditAttachedObjectIndex");
  2113.     DeletePVar(playerid, "EditingAttachedObject");
  2114.     DeletePVar(playerid, "RemoveAttachedObjectIndex");
  2115.     DeletePVar(playerid, "AttachedObjectStatsIndex");
  2116.     DeletePVar(playerid, "DuplicateAttachedObjectIndex1");
  2117.     DeletePVar(playerid, "DuplicateAttachedObjectIndex2");
  2118.     DeletePVar(playerid, "SetAttachedObjectIndex1");
  2119.     DeletePVar(playerid, "SetAttachedObjectIndex2");
  2120.     DeletePVar(playerid, "SetAttachedObjectModelIndex");
  2121.     DeletePVar(playerid, "SetAttachedObjectModel");
  2122.     DeletePVar(playerid, "SetAttachedObjectBoneIndex");
  2123.     DeletePVar(playerid, "SetAttachedObjectBone");
  2124.     DeletePVar(playerid, "SaveAttachedObjectIndex");
  2125.     DeletePVar(playerid, "LoadAttachedObjectName");
  2126.     DeletePVar(playerid, "LoadAttachedObjectIndex");
  2127.     DeletePVar(playerid, "LastAttachedObjectRemoved");
  2128. }
  2129.  
  2130. AOE_ShowPlayerDialog(playerid, type, dialogid, caption[], button1[], button2[] = "")
  2131. {
  2132.     new aoe_str1[128], aoe_str3[512], slot, slot2;
  2133.     switch(type)
  2134.     {
  2135.         case 0: // AOE menu
  2136.         {
  2137.             new slots = GetPlayerAttachedObjectsCount(playerid), aoe_str4[1024];
  2138.             slot = GetPVarInt(playerid, "LastAttachedObjectRemoved");
  2139.             if(!GetPVarType(playerid, "LastAttachedObjectRemoved")) aoe_str1 = "{FF0000}Restore your last deleted attached object";
  2140.             else if(IsPlayerAttachedObjectSlotUsed(playerid, slot)) format(aoe_str1, sizeof(aoe_str1), "{D1D1D1}Restore your last deleted attached object [Idx:%i]", slot);
  2141.             else format(aoe_str1, sizeof(aoe_str1), "Restore your last deleted attached object [Idx:%i]", slot);
  2142.             if(!slots) {
  2143.                 format(aoe_str4, sizeof(aoe_str4), "Create your attached object\n{FF0000}Duplicate your attached object\n{FF0000}Edit your attached object\n{FF0000}Save your attached object\n{FF0000}Save all of your attached object(s) [Total:%i]\n\
  2144.                 Load attached object file\nLoad attached object(s) set", slots);
  2145.                 format(aoe_str4, sizeof(aoe_str4), "%s\n{FF0000}Remove your attached object\n{FF0000}Remove all of your attached object(s) [Total:%i]\n%s\n{FFFFFF}Export attached object(s) file\n{FF0000}View your attached object list\n\
  2146.                 {FF0000}View your attached object stats\n{FFFFFF}Total attached object(s) [%i]", aoe_str4, slots, aoe_str1, slots);
  2147.             }
  2148.             else if(slots == MAX_PLAYER_ATTACHED_OBJECTS) {
  2149.                 format(aoe_str4, sizeof(aoe_str4), "{FF0000}Create your attached object\n{D1D1D1}Duplicate your attached object\nEdit your attached object\nSave your attached object\nSave all of your attached object(s) [Total:%i]\n\
  2150.                 {FF0000}Load attached object file\n{FF0000}Load attached object(s) set", slots);
  2151.                 format(aoe_str4, sizeof(aoe_str4), "%s\nRemove your attached object\nRemove all of your attached object(s) [Total:%i]\n%s\nExport attached object(s) file\nView your attached object list\n\
  2152.                 View your attached object stats\nTotal attached object(s) [%i]", aoe_str4, slots, aoe_str1, slots);
  2153.             }
  2154.             else {
  2155.                 format(aoe_str4, sizeof(aoe_str4), "Create your attached object\nDuplicate your attached object\nEdit your attached object\nSave your attached object\nSave all of your attached object(s) [Total:%i]\n\
  2156.                 Load attached object file\nLoad attached object(s) set", slots);
  2157.                 format(aoe_str4, sizeof(aoe_str4), "%s\nRemove your attached object\nRemove all of your attached object(s) [Total:%i]\n%s\nExport attached object(s) file\n\
  2158.                 View your attached object list\nView your attached object stats\nTotal attached object(s) [%i]", aoe_str4, slots, aoe_str1, slots);
  2159.             }
  2160.             strcat(aoe_str4, "\nHelp\nAbout");
  2161.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str4, button1, button2);
  2162.         }
  2163.         case 1: // AOE help
  2164.         {
  2165.             new aoe_str4[2048];
  2166.             strcat(aoe_str4, "Command list & usage\nGeneral:\n");
  2167.             strcat(aoe_str4, " /attachedobjecteditor (/aoe): Shows attached object menu dialog\n /createattachedobject (/cao): Create your attached object\n");
  2168.             strcat(aoe_str4, " /editattachedobject (/eao): Edit your attached object\n /duplicateattachedobject (/dao): Duplicate your attached object\n");
  2169.             strcat(aoe_str4, " /removeattachedobject (/rao): Remove your attached object\n /removeattachedobjects (/raos): Remove all of your attached object(s)\n");
  2170.             strcat(aoe_str4, " /undeleteattachedobject (/udao): Restore your last deleted attached object\n /saveattachedobject (/sao): Save your attached object to a file\n");
  2171.             strcat(aoe_str4, " /saveattachedobjects (/saos): Save all of your attached object(s) to a set file\n /loadattachedobject (/lao): Load existing attached object file\n");
  2172.             strcat(aoe_str4, " /loadattachedobjects (/laos): Load existing attached object(s) set file\n /convertattachedobject (/caof): Convert saved file to raw code/script\n");
  2173.             strcat(aoe_str4, " /attachedobjectstats (/aos): Show your attached object stats\n /attachedobjectlist (/aol): Show your attached object list\n");
  2174.             strcat(aoe_str4, " /totalattachedobjects (/taos): Shows the number of attached object(s)\nChange/set value:\n");
  2175.             strcat(aoe_str4, " /setattachedobjectslot (/saoi): Set your attached object slot/index\n /setattachedobjectmodel (/saom): Set your attached object model\n");
  2176.             strcat(aoe_str4, " /setattachedobjectbone (/saob): Set your attached object bone\n /setattachedobjectoffsetx (/saoox): Set your attached object offset X\n");
  2177.             strcat(aoe_str4, " /setattachedobjectoffsety (/saooy): Set your attached object offset Y\n /setattachedobjectoffsetz (/saooz): Set your attached object offset Z\n");
  2178.             strcat(aoe_str4, " /setattachedobjectrotx (/saorx): Set your attached object rotation X\n /setattachedobjectrotx (/saory): Set your attached object rotation Y\n");
  2179.             strcat(aoe_str4, " /setattachedobjectrotx (/saorz): Set your attached object rotation Z\n /setattachedobjectscalex (/saosx): Set your attached object scale X\n");
  2180.             strcat(aoe_str4, " /setattachedobjectscalex (/saosy): Set your attached object scale Y\n /setattachedobjectscalex (/saosz): Set your attached object scale Z\n");
  2181.             strcat(aoe_str4, " /setattachedobjectmc1 (/saomc1): Set your attached object material color #1\n /setattachedobjectmc2 (/saomc2): Set your attached object material color #2\n");
  2182.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str4, button1, button2);
  2183.         }
  2184.         case 2: // AOE convert
  2185.         {
  2186.             format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter an attached object file name...", caption);
  2187.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter an existing (saved) & valid attached object file name below to convert,\n\nPlease note that valid characters are:\n\
  2188.             A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .", button1, button2);
  2189.             SendClientMessage(playerid, COLOR_WHITE, aoe_str1);
  2190.         }
  2191.         case 3: // AOE about
  2192.         {
  2193.             GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  2194.             format(aoe_str3, sizeof(aoe_str3), "[FilterScript] Attached Object Editor for SA:MP 0.3e and upper\nSimple editor/tool for attached object(s)\n\nVersion: %s\nCreated by: Robo_N1X\nhttp://forum.sa-mp.com/showthread.php?t=416138\
  2195.             \nCredits & Thanks to:\n> SA:MP Team (www.sa-mp.com)\n> h02 for the attachments editor idea\n> DracoBlue (DracoBlue.net)\n> SA:MP Wiki (wiki.sa-mp.com)\n> Whoever that made useful function for this script\nAnd you, %s (ID:%i) for using this filterscript!",
  2196.             AOE_VERSION, PlayerName, playerid);
  2197.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str3, button1, button2);
  2198.         }
  2199.         case 4: // AOE object model input
  2200.         {
  2201.             format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter object model id/number...", caption);
  2202.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter a valid GTA:SA/SA:MP object model id/number below:", button1, button2);
  2203.             SendClientMessage(playerid, COLOR_WHITE, aoe_str1);
  2204.         }
  2205.         case 5: // AOE bone list
  2206.         {
  2207.             for(new i = MIN_ATTACHED_OBJECT_BONE; i <= MAX_ATTACHED_OBJECT_BONE; i++)
  2208.             {
  2209.                 format(aoe_str3, sizeof(aoe_str3), "%s%d. %s\n", aoe_str3, i, GetAttachedObjectBoneName(i));
  2210.             }
  2211.             format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object bone...", caption);
  2212.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str3, button1, button2);
  2213.             SendClientMessage(playerid, COLOR_WHITE, aoe_str1);
  2214.         }
  2215.         case 6: // AOE slot/index list (free slot)
  2216.         {
  2217.             for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
  2218.             {
  2219.                 if(IsValidPlayerAttachedObject(playerid, i) == -1) format(aoe_str3, sizeof(aoe_str3), "%s{FFFFFF}%d. None - (Not Used)\n", aoe_str3, i);
  2220.                 else if(!IsValidPlayerAttachedObject(playerid, i)) format(aoe_str3, sizeof(aoe_str3), "%s{D1D1D1}%d. Unknown - Invalid attached object info\n", aoe_str3, i);
  2221.                 else format(aoe_str3, sizeof(aoe_str3), "%s{FF0000}%d. %d - %s (BID:%i) - (Used)\n", aoe_str3, i, pao[playerid][i][aoModelID], GetAttachedObjectBoneName(pao[playerid][i][aoBoneID]), pao[playerid][i][aoBoneID]);
  2222.             }
  2223.             if(!strcmp(button1, "Select", true)) format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number...", caption);
  2224.             else format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number to %s...", caption, button1);
  2225.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str3, button1, button2);
  2226.             SendClientMessage(playerid, COLOR_WHITE, aoe_str1);
  2227.         }
  2228.         case 7: // AOE slot/index list (used slot)
  2229.         {
  2230.             for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
  2231.             {
  2232.                 if(IsValidPlayerAttachedObject(playerid, i) == -1) format(aoe_str3, sizeof(aoe_str3), "%s{FF0000}%d. None - (Not Used)\n", aoe_str3, i);
  2233.                 else if(!IsValidPlayerAttachedObject(playerid, i)) format(aoe_str3, sizeof(aoe_str3), "%s{D1D1D1}%d. Unknown - Invalid attached object info\n", aoe_str3, i);
  2234.                 else format(aoe_str3, sizeof(aoe_str3), "%s{FFFFFF}%d. %d - %s (BID:%i) - (Used)\n", aoe_str3, i, pao[playerid][i][aoModelID], GetAttachedObjectBoneName(pao[playerid][i][aoBoneID]), pao[playerid][i][aoBoneID]);
  2235.             }
  2236.             if(!strcmp(button1, "Select", true)) format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number...", caption);
  2237.             else format(aoe_str1, sizeof(aoe_str1), "* %s: Please select attached object slot/index number to %s...", caption, button1);
  2238.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, caption, aoe_str3, button1, button2);
  2239.             SendClientMessage(playerid, COLOR_WHITE, aoe_str1);
  2240.         }
  2241.         case 8: // AOE stats
  2242.         {
  2243.             slot = GetPVarInt(playerid, "AttachedObjectStatsIndex");
  2244.             format(aoe_str3, sizeof(aoe_str3), "Attached object slot/index number %i stats...\n\nIs valid data?: %s\nModel ID/Number/Type: %d\nBone: %s (%i)\n\nOffsets\nX Offset: %f\nY Offset: %f\nZ Offset: %f\n\nRotations\nX Rotation: %f\nY Rotation: %f\
  2245.             \nZ Rotation: %f\n\nScales\nX Scale: %f\nY Scale: %f\nZ Scale: %f\n\nMaterial\nColor 1: %i (%x)\nColor 2: %i (%x)\n\nYour skin: %i\nTotal of your attached object(s): %d", ((pao[playerid][slot][aoValid] == 1) ? ("Yes") : ("No")), slot,
  2246.             pao[playerid][slot][aoModelID], GetAttachedObjectBoneName(pao[playerid][slot][aoBoneID]), pao[playerid][slot][aoBoneID], pao[playerid][slot][aoX], pao[playerid][slot][aoY], pao[playerid][slot][aoZ],
  2247.             pao[playerid][slot][aoRX], pao[playerid][slot][aoRY], pao[playerid][slot][aoRZ], pao[playerid][slot][aoSX], pao[playerid][slot][aoSY], pao[playerid][slot][aoSZ],
  2248.             pao[playerid][slot][aoMC1], IntToHex(pao[playerid][slot][aoMC1]), pao[playerid][slot][aoMC2], IntToHex(pao[playerid][slot][aoMC2]), GetPlayerSkin(playerid), GetPlayerAttachedObjectsCount(playerid));
  2249.             format(aoe_str2, sizeof(aoe_str2), "* You're viewing your attached object stats from slot/index number %i", slot);
  2250.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str3, (IsPlayerAdmin(playerid) ? button1 : button2), (IsPlayerAdmin(playerid) ? button2 : "")); // Only shows "Close" button for non-admin
  2251.             SendClientMessage(playerid, COLOR_CYAN, aoe_str2);
  2252.         }
  2253.         case 9: // AOE create replace
  2254.         {
  2255.             format(aoe_str2, sizeof(aoe_str2), "Sorry, attached object slot/index number %i\nis already used, do you want to replace it?\n(This action cannot be undone)", GetPVarInt(playerid, "CreateAttachedObjectIndex"));
  2256.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2);
  2257.         }
  2258.         case 10: // AOE create final
  2259.         {
  2260.             format(aoe_str2, sizeof(aoe_str2), "You've created your attached object\nat slot/index number: %i\nModel: %d\nBone: %s (BID:%i)\n\nDo you want to edit your attached object?", GetPVarInt(playerid, "CreateAttachedObjectIndex"),
  2261.             GetPVarInt(playerid, "CreateAttachedObjectModel"), GetAttachedObjectBoneName(GetPVarInt(playerid, "CreateAttachedObjectBone")), GetPVarInt(playerid, "CreateAttachedObjectBone"));
  2262.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2);
  2263.         }
  2264.         case 11: // AOE remove
  2265.         {
  2266.             format(aoe_str2, sizeof(aoe_str2), "You're about to remove attached object from slot/index number %i\nAre you sure you want to remove it?\n", GetPVarInt(playerid, "RemoveAttachedObjectIndex"));
  2267.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2);
  2268.         }
  2269.         case 12: // AOE remove all
  2270.         {
  2271.             format(aoe_str2, sizeof(aoe_str2), "You're about to remove all of your attached object(s)\nTotal: %d\nAre you sure you want to remove them?\n(This action can't be undone)", GetPlayerAttachedObjectsCount(playerid));
  2272.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2);
  2273.         }
  2274.         case 13: // AOE duplicate replace
  2275.         {
  2276.             slot = GetPVarInt(playerid, "DuplicateAttachedObjectIndex1"), slot2 = GetPVarInt(playerid, "DuplicateAttachedObjectIndex2");
  2277.             format(aoe_str2, sizeof(aoe_str2), "You already have attached object at slot/index number %i!\nDo you want to replace it with attached object from slot %i?", slot, slot2);
  2278.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2);
  2279.         }
  2280.         case 14: // AOE set index replace
  2281.         {
  2282.             slot = GetPVarInt(playerid, "SetAttachedObjectIndex1"), slot2 = GetPVarInt(playerid, "SetAttachedObjectIndex2");
  2283.             format(aoe_str2, sizeof(aoe_str2), "You already have attached object at slot/index number %i!\nDo you want to replace it with attached object from slot %i?", slot2, slot);
  2284.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2);
  2285.         }
  2286.         case 15: // AOE save
  2287.         {
  2288.             format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter attached object file name to save...", caption);
  2289.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter a valid file name to save this attached object below,\n\nPlease note that valid characters are:\n\
  2290.             A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .", button1, button2);
  2291.             SendClientMessage(playerid, COLOR_WHITE, aoe_str1);
  2292.         }
  2293.         case 16: // AOE load
  2294.         {
  2295.             format(aoe_str1, sizeof(aoe_str1), "* %s: Please enter attached object file name to load...", caption);
  2296.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, caption, "Please enter an valid and existing attached object file name below,\n\nPlease note that valid characters are:\n\
  2297.             A to Z or a to z, 0 to 9 and @, $, (, ), [, ], _, =, .", button1, button2);
  2298.             SendClientMessage(playerid, COLOR_WHITE, aoe_str1);
  2299.         }
  2300.         case 17: // AOE load replace
  2301.         {
  2302.             format(aoe_str2, sizeof(aoe_str2), "You already have attached object at slot/index number %i!\nDo you want to continue loading and replace it?", GetPVarInt(playerid, "LoadAttachedObjectIndex"));
  2303.             ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, aoe_str2, button1, button2);
  2304.         }
  2305.     }
  2306.     return dialogid;
  2307. }
  2308.  
  2309. AOE_SavePlayerAttachedObject(playerid, index, filename[])
  2310. {
  2311.     new aof_varname[32];
  2312.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2313.     if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(pao[playerid][index][aoModelID]) || !IsValidAttachedObjectBone(pao[playerid][index][aoBoneID])) return 0;
  2314.     if(!dini_Exists(filename)) dini_Create(filename);
  2315.     GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  2316.     dini_Set(filename, "auth", PlayerName);
  2317.     dini_IntSet(filename, "skin", GetPlayerSkin(playerid));
  2318.     format(aof_varname, sizeof(aof_varname), "[%i]valid", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoValid]);
  2319.     format(aof_varname, sizeof(aof_varname), "[%i]model", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoModelID]);
  2320.     format(aof_varname, sizeof(aof_varname), "[%i]bone", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoBoneID]);
  2321.     format(aof_varname, sizeof(aof_varname), "[%i]x", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoX]);
  2322.     format(aof_varname, sizeof(aof_varname), "[%i]y", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoY]);
  2323.     format(aof_varname, sizeof(aof_varname), "[%i]z", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoZ]);
  2324.     format(aof_varname, sizeof(aof_varname), "[%i]rx", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoRX]);
  2325.     format(aof_varname, sizeof(aof_varname), "[%i]ry", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoRY]);
  2326.     format(aof_varname, sizeof(aof_varname), "[%i]rz", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoRZ]);
  2327.     format(aof_varname, sizeof(aof_varname), "[%i]sx", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoSX]);
  2328.     format(aof_varname, sizeof(aof_varname), "[%i]sy", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoSY]);
  2329.     format(aof_varname, sizeof(aof_varname), "[%i]sz", index), dini_FloatSet(filename, aof_varname, pao[playerid][index][aoSZ]);
  2330.     format(aof_varname, sizeof(aof_varname), "[%i]mc1", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoMC1]);
  2331.     format(aof_varname, sizeof(aof_varname), "[%i]mc2", index), dini_IntSet(filename, aof_varname, pao[playerid][index][aoMC2]);
  2332.     return 1;
  2333. }
  2334.  
  2335. AOE_LoadPlayerAttachedObject(playerid, index, filename[])
  2336. {
  2337.     new aof_varname[32];
  2338.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2339.     if(!AOE_IsValidAttachedObjectInFile(index, filename)) return 0;
  2340.     GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  2341.     format(aof_varname, sizeof(aof_varname), "[%i]valid", index), pao[playerid][index][aoValid] = dini_Int(filename, aof_varname);
  2342.     format(aof_varname, sizeof(aof_varname), "[%i]model", index), pao[playerid][index][aoModelID] = dini_Int(filename, aof_varname);
  2343.     format(aof_varname, sizeof(aof_varname), "[%i]bone", index), pao[playerid][index][aoBoneID] = dini_Int(filename, aof_varname);
  2344.     format(aof_varname, sizeof(aof_varname), "[%i]x", index), pao[playerid][index][aoX] = dini_Float(filename, aof_varname);
  2345.     format(aof_varname, sizeof(aof_varname), "[%i]y", index), pao[playerid][index][aoY] = dini_Float(filename, aof_varname);
  2346.     format(aof_varname, sizeof(aof_varname), "[%i]z", index), pao[playerid][index][aoZ] = dini_Float(filename, aof_varname);
  2347.     format(aof_varname, sizeof(aof_varname), "[%i]rx", index), pao[playerid][index][aoRX] = dini_Float(filename, aof_varname);
  2348.     format(aof_varname, sizeof(aof_varname), "[%i]ry", index), pao[playerid][index][aoRY] = dini_Float(filename, aof_varname);
  2349.     format(aof_varname, sizeof(aof_varname), "[%i]rz", index), pao[playerid][index][aoRZ] = dini_Float(filename, aof_varname);
  2350.     format(aof_varname, sizeof(aof_varname), "[%i]sx", index), pao[playerid][index][aoSX] = dini_Float(filename, aof_varname);
  2351.     format(aof_varname, sizeof(aof_varname), "[%i]sy", index), pao[playerid][index][aoSY] = dini_Float(filename, aof_varname);
  2352.     format(aof_varname, sizeof(aof_varname), "[%i]sz", index), pao[playerid][index][aoSZ] = dini_Float(filename, aof_varname);
  2353.     format(aof_varname, sizeof(aof_varname), "[%i]mc1", index), pao[playerid][index][aoMC1] = dini_Int(filename, aof_varname);
  2354.     format(aof_varname, sizeof(aof_varname), "[%i]mc2", index), pao[playerid][index][aoMC2] = dini_Int(filename, aof_varname);
  2355.     if(IsValidAttachedObjectSlot(index) && IsValidObjectModel(pao[playerid][index][aoModelID]) && IsValidAttachedObjectBone(pao[playerid][index][aoBoneID])) {
  2356.         UpdatePlayerAttachedObjectEx(playerid, index, pao[playerid][index][aoModelID], pao[playerid][index][aoBoneID], pao[playerid][index][aoX], pao[playerid][index][aoY], pao[playerid][index][aoZ],
  2357.         pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ], pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ],
  2358.         pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]);
  2359.     }
  2360.     else {
  2361.         AOE_UnsetValues(playerid, index);
  2362.         return 0;
  2363.     }
  2364.     return 1;
  2365. }
  2366.  
  2367. AOE_ConvertAttachedObjectFile(playerid, filename[], filename2[], &filelen = 0)
  2368. {
  2369.     new aof_varname[32], pao_name[32], ao_tmp[AttachedObjectOptions], slots,
  2370.         Hour, Minute, Second, Year, Month, Day;
  2371.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2372.     GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
  2373.     gettime(Hour, Minute, Second), getdate(Year, Month, Day);
  2374.     strmid(pao_name, filename, 0, strlen(filename)-(strlen(AO_FILENAME)-2));
  2375.     format(aoe_str, sizeof(aoe_str), "\r\n-- \"%s\" converted by %s on %02d/%02d/%d - %02d:%02d:%02d --\r\n", filename, PlayerName, Day, Month, Year, Hour, Minute, Second);
  2376.     for(new slot = 0; slot < MAX_PLAYER_ATTACHED_OBJECTS; slot++)
  2377.     {
  2378.         format(aof_varname, sizeof(aof_varname), "[%i]model", slot), ao_tmp[aoModelID] = dini_Int(filename, aof_varname);
  2379.         format(aof_varname, sizeof(aof_varname), "[%i]bone", slot), ao_tmp[aoBoneID] = dini_Int(filename, aof_varname);
  2380.         format(aof_varname, sizeof(aof_varname), "[%i]x", slot), ao_tmp[aoX] = dini_Float(filename, aof_varname);
  2381.         format(aof_varname, sizeof(aof_varname), "[%i]y", slot), ao_tmp[aoY] = dini_Float(filename, aof_varname);
  2382.         format(aof_varname, sizeof(aof_varname), "[%i]z", slot), ao_tmp[aoZ] = dini_Float(filename, aof_varname);
  2383.         format(aof_varname, sizeof(aof_varname), "[%i]rx", slot), ao_tmp[aoRX] = dini_Float(filename, aof_varname);
  2384.         format(aof_varname, sizeof(aof_varname), "[%i]ry", slot), ao_tmp[aoRY] = dini_Float(filename, aof_varname);
  2385.         format(aof_varname, sizeof(aof_varname), "[%i]rz", slot), ao_tmp[aoRZ] = dini_Float(filename, aof_varname);
  2386.         format(aof_varname, sizeof(aof_varname), "[%i]sx", slot), ao_tmp[aoSX] = dini_Float(filename, aof_varname);
  2387.         format(aof_varname, sizeof(aof_varname), "[%i]sy", slot), ao_tmp[aoSY] = dini_Float(filename, aof_varname);
  2388.         format(aof_varname, sizeof(aof_varname), "[%i]sz", slot), ao_tmp[aoSZ] = dini_Float(filename, aof_varname);
  2389.         format(aof_varname, sizeof(aof_varname), "[%i]mc1", slot), ao_tmp[aoMC1] = dini_Int(filename, aof_varname);
  2390.         format(aof_varname, sizeof(aof_varname), "[%i]mc2", slot), ao_tmp[aoMC2] = dini_Int(filename, aof_varname);
  2391.         if(!IsValidAttachedObjectSlot(slot) || !IsValidObjectModel(ao_tmp[aoModelID]) || !IsValidAttachedObjectBone(ao_tmp[aoBoneID])) continue;
  2392.         else {
  2393.             format(aoe_str2, sizeof(aoe_str2), "SetPlayerAttachedObject(playerid, %i, %d, %i, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %i, %i); // \"%s\" by %s (Skin:%i)\r\n",
  2394.             slot, ao_tmp[aoModelID], ao_tmp[aoBoneID], ao_tmp[aoX], ao_tmp[aoY], ao_tmp[aoZ], ao_tmp[aoRX], ao_tmp[aoRY], ao_tmp[aoRZ], ao_tmp[aoSX], ao_tmp[aoSY], ao_tmp[aoSZ],
  2395.             ao_tmp[aoMC1], ao_tmp[aoMC2], pao_name, dini_Get(filename, "auth"), dini_Int(filename, "skin"));
  2396.             if(!fexist(filename2))
  2397.             {
  2398.                 new File:ao_file = fopen(filename2, io_write);
  2399.                 fwrite(ao_file, "Attached object raw code/exported file converted from [FS]Attached Object Editor (Version:"#AOE_VERSION") for SA:MP 0.3e and upper\r\n");
  2400.                 fwrite(ao_file, "Each attached object(s)/set file has the creation and information log above the code\r\n");
  2401.                 fwrite(ao_file, "By default, the log shows the name of player who converted the file and time with format DD/MM/YYYY - HH:MM:SS\r\n");
  2402.                 fwrite(ao_file, "Copy and paste the raw code(s) below, you can change the index parameter with valid slot number (0-9)!\r\n");
  2403.                 fwrite(ao_file, aoe_str);
  2404.                 fwrite(ao_file, aoe_str2);
  2405.                 filelen = flength(ao_file);
  2406.                 fclose(ao_file);
  2407.             }
  2408.             else
  2409.             {
  2410.                 new File:ao_file = fopen(filename2, io_append);
  2411.                 if(slots == 0) fwrite(ao_file, aoe_str);
  2412.                 fwrite(ao_file, aoe_str2);
  2413.                 filelen = flength(ao_file);
  2414.                 fclose(ao_file);
  2415.             }
  2416.             slots++;
  2417.         }
  2418.     }
  2419.     return slots;
  2420. }
  2421.  
  2422. AOE_IsValidAttachedObjectInFile(index, filename[])
  2423. {
  2424.     new aof_varname[32], ao_tmp[AttachedObjectOptions];
  2425.     if(!fexist(filename)) return false;
  2426.     if(IsValidAttachedObjectSlot(index))
  2427.     {
  2428.         format(aof_varname, sizeof(aof_varname), "[%i]valid", index), ao_tmp[aoValid] = dini_Int(filename, aof_varname);
  2429.         format(aof_varname, sizeof(aof_varname), "[%i]model", index), ao_tmp[aoModelID] = dini_Int(filename, aof_varname);
  2430.         format(aof_varname, sizeof(aof_varname), "[%i]bone", index), ao_tmp[aoBoneID] = dini_Int(filename, aof_varname);
  2431.         if(ao_tmp[aoValid] == 1 && IsValidObjectModel(ao_tmp[aoModelID]) && IsValidAttachedObjectBone(ao_tmp[aoBoneID])) return true;
  2432.     }
  2433.     return false;
  2434. }
  2435.  
  2436. //------------------------------------------------------------------------------
  2437.  
  2438. stock CreatePlayerAttachedObject(playerid, index, modelid, bone)
  2439. {
  2440.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2441.     if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(modelid) || !IsValidAttachedObjectBone(bone)) return 0;
  2442.     if(IsPlayerAttachedObjectSlotUsed(playerid, index)) RemovePlayerAttachedObject(playerid, index);
  2443.     SetPlayerAttachedObject(playerid, index, modelid, bone);
  2444.     SetPVarInt(playerid, "CreateAttachedObjectIndex", index);
  2445.     SetPVarInt(playerid, "CreateAttachedObjectModel", modelid);
  2446.     SetPVarInt(playerid, "CreateAttachedObjectBone", bone);
  2447.     pao[playerid][index][aoValid] = 1;
  2448.     pao[playerid][index][aoModelID] = modelid;
  2449.     pao[playerid][index][aoBoneID] = bone;
  2450.     pao[playerid][index][aoX] = 0.0, pao[playerid][index][aoY] = 0.0, pao[playerid][index][aoZ] = 0.0;
  2451.     pao[playerid][index][aoRX] = 0.0, pao[playerid][index][aoRY] = 0.0, pao[playerid][index][aoRZ] = 0.0;
  2452.     pao[playerid][index][aoSX] = 1.0, pao[playerid][index][aoSY] = 1.0, pao[playerid][index][aoSZ] = 1.0;
  2453.     pao[playerid][index][aoMC1] = 0, pao[playerid][index][aoMC2] = 0;
  2454.     return 1;
  2455. }
  2456.  
  2457. stock UpdatePlayerAttachedObject(playerid, index, modelid, bone)
  2458.     return UpdatePlayerAttachedObjectEx(playerid, index, modelid, bone, pao[playerid][index][aoX], pao[playerid][index][aoY], pao[playerid][index][aoZ], pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ],
  2459.     pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]);
  2460.  
  2461. stock UpdatePlayerAttachedObjectEx(playerid, index, modelid, bone, Float:fOffsetX = 0.0, Float:fOffsetY = 0.0, Float:fOffsetZ = 0.0, Float:fRotX = 0.0, Float:fRotY = 0.0, Float:fRotZ = 0.0, Float:fScaleX = 1.0, Float:fScaleY = 1.0, Float:fScaleZ = 1.0, materialcolor1 = 0, materialcolor2 = 0)
  2462. {
  2463.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2464.     if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(modelid) || !IsValidAttachedObjectBone(bone)) return 0;
  2465.     SetPlayerAttachedObject(playerid, index, modelid, bone, fOffsetX, fOffsetY, fOffsetZ, fRotX, fRotY, fRotZ, fScaleX, fScaleY, fScaleZ, materialcolor1, materialcolor2);
  2466.     pao[playerid][index][aoValid] = 1;
  2467.     pao[playerid][index][aoModelID] = modelid;
  2468.     pao[playerid][index][aoBoneID] = bone;
  2469.     pao[playerid][index][aoX] = fOffsetX, pao[playerid][index][aoY] = fOffsetY, pao[playerid][index][aoZ] = fOffsetZ;
  2470.     pao[playerid][index][aoRX] = fRotX, pao[playerid][index][aoRY] = fRotY, pao[playerid][index][aoRZ] = fRotZ;
  2471.     pao[playerid][index][aoSX] = fScaleX, pao[playerid][index][aoSY] = fScaleY, pao[playerid][index][aoSZ] = fScaleZ;
  2472.     pao[playerid][index][aoMC1] = materialcolor1, pao[playerid][index][aoMC2] = materialcolor2;
  2473.     return index;
  2474. }
  2475.  
  2476. stock DuplicatePlayerAttachedObject(playerid, index1, index2)
  2477. {
  2478.     if(IsValidPlayerAttachedObject(playerid, index1) && IsValidAttachedObjectSlot(index1) && IsValidAttachedObjectSlot(index2)) {
  2479.         if(IsPlayerAttachedObjectSlotUsed(playerid, index2)) RemovePlayerAttachedObject(playerid, index2);
  2480.         return UpdatePlayerAttachedObjectEx(playerid, index2, pao[playerid][index1][aoModelID], pao[playerid][index1][aoBoneID], pao[playerid][index1][aoX], pao[playerid][index1][aoY], pao[playerid][index1][aoZ],
  2481.         pao[playerid][index1][aoRX], pao[playerid][index1][aoRY], pao[playerid][index1][aoRZ], pao[playerid][index1][aoSX], pao[playerid][index1][aoSY], pao[playerid][index1][aoSZ], pao[playerid][index1][aoMC1], pao[playerid][index1][aoMC2]);
  2482.     }
  2483.     return 0;
  2484. }
  2485.  
  2486. stock MovePlayerAttachedObjectIndex(playerid, index1, index2)
  2487. {
  2488.     if(IsValidPlayerAttachedObject(playerid, index1) && IsValidAttachedObjectSlot(index1) && IsValidAttachedObjectSlot(index2)) {
  2489.         if(IsPlayerAttachedObjectSlotUsed(playerid, index1)) RemovePlayerAttachedObject(playerid, index1), pao[playerid][index1][aoValid] = 0;
  2490.         if(IsPlayerAttachedObjectSlotUsed(playerid, index2)) RemovePlayerAttachedObject(playerid, index2), pao[playerid][index2][aoValid] = 0;
  2491.         return UpdatePlayerAttachedObjectEx(playerid, index2, pao[playerid][index1][aoModelID], pao[playerid][index1][aoBoneID], pao[playerid][index1][aoX], pao[playerid][index1][aoY], pao[playerid][index1][aoZ],
  2492.         pao[playerid][index1][aoRX], pao[playerid][index1][aoRY], pao[playerid][index1][aoRZ], pao[playerid][index1][aoSX], pao[playerid][index1][aoSY], pao[playerid][index1][aoSZ]);
  2493.     }
  2494.     return 0;
  2495. }
  2496.  
  2497. stock RefreshPlayerAttachedObjects(playerid, forplayerid)
  2498. {
  2499.     new slots = 0;
  2500.     if(!IsPlayerConnected(playerid) || !IsPlayerConnected(forplayerid)) return INVALID_PLAYER_ID;
  2501.     for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
  2502.     {
  2503.         if(IsPlayerAttachedObjectSlotUsed(playerid, i) || IsValidPlayerAttachedObject(playerid, i))
  2504.         {
  2505.             if(IsPlayerAttachedObjectSlotUsed(forplayerid, i)) RemovePlayerAttachedObject(forplayerid, i);
  2506.             SetPlayerAttachedObject(forplayerid, i, pao[playerid][i][aoModelID], pao[playerid][i][aoBoneID], pao[playerid][i][aoX], pao[playerid][i][aoY], pao[playerid][i][aoZ],
  2507.             pao[playerid][i][aoRX], pao[playerid][i][aoRY], pao[playerid][i][aoRZ], pao[playerid][i][aoSX], pao[playerid][i][aoSY], pao[playerid][i][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]);
  2508.             pao[forplayerid][i][aoValid] = 1;
  2509.             pao[forplayerid][i][aoModelID] = pao[playerid][i][aoModelID];
  2510.             pao[forplayerid][i][aoBoneID] = pao[playerid][i][aoBoneID];
  2511.             pao[forplayerid][i][aoX] = pao[playerid][i][aoX], pao[forplayerid][i][aoY] = pao[playerid][i][aoY], pao[forplayerid][i][aoZ] = pao[playerid][i][aoZ];
  2512.             pao[forplayerid][i][aoRX] = pao[playerid][i][aoRX], pao[forplayerid][i][aoRY] = pao[playerid][i][aoRY], pao[forplayerid][i][aoRZ] = pao[playerid][i][aoRZ];
  2513.             pao[forplayerid][i][aoSX] = pao[playerid][i][aoSX], pao[forplayerid][i][aoSY] = pao[playerid][i][aoSY], pao[forplayerid][i][aoSZ] = pao[playerid][i][aoSZ];
  2514.             pao[forplayerid][i][aoMC1] = pao[playerid][i][aoMC1], pao[forplayerid][i][aoMC2] = pao[playerid][i][aoMC2];
  2515.             slots++;
  2516.         }
  2517.     }
  2518.     return slots;
  2519. }
  2520.  
  2521. stock RestorePlayerAttachedObject(playerid, index)
  2522. {
  2523.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2524.     if(IsValidPlayerAttachedObject(playerid, index))
  2525.     {
  2526.         SetPlayerAttachedObject(playerid, index, pao[playerid][index][aoModelID], pao[playerid][index][aoBoneID], pao[playerid][index][aoX], pao[playerid][index][aoY], pao[playerid][index][aoZ],
  2527.         pao[playerid][index][aoRX], pao[playerid][index][aoRY], pao[playerid][index][aoRZ], pao[playerid][index][aoSX], pao[playerid][index][aoSY], pao[playerid][index][aoSZ], pao[playerid][index][aoMC1], pao[playerid][index][aoMC2]);
  2528.         pao[playerid][index][aoValid] = 1;
  2529.         return 1;
  2530.     }
  2531.     return 0;
  2532. }
  2533.  
  2534. stock RemovePlayerAttachedObjectEx(playerid, index = 0, bool:RemoveAll = false)
  2535. {
  2536.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2537.     if(!GetPlayerAttachedObjectsCount(playerid) || !IsValidAttachedObjectSlot(index)) return 0;
  2538.     new _TOTAL_ATTACHED_OBJECT_REMOVED_;
  2539.     if(RemoveAll == true)
  2540.     {
  2541.         _TOTAL_ATTACHED_OBJECT_REMOVED_ = 0;
  2542.         for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
  2543.         {
  2544.             if(IsPlayerAttachedObjectSlotUsed(playerid, i)) {
  2545.                 RemovePlayerAttachedObject(playerid, i);
  2546.                 pao[playerid][i][aoValid] = 0;
  2547.                 SetPVarInt(playerid, "LastAttachedObjectRemoved", i);
  2548.                 _TOTAL_ATTACHED_OBJECT_REMOVED_++;
  2549.             }
  2550.         }
  2551.     }
  2552.     else
  2553.     {
  2554.         _TOTAL_ATTACHED_OBJECT_REMOVED_ = 0;
  2555.         if(IsPlayerAttachedObjectSlotUsed(playerid, index)) {
  2556.             RemovePlayerAttachedObject(playerid, index);
  2557.             pao[playerid][index][aoValid] = 0;
  2558.             SetPVarInt(playerid, "LastAttachedObjectRemoved", index);
  2559.             _TOTAL_ATTACHED_OBJECT_REMOVED_++;
  2560.         }
  2561.     }
  2562.     return _TOTAL_ATTACHED_OBJECT_REMOVED_;
  2563. }
  2564.  
  2565. stock GetAttachedObjectBoneName(BoneID)
  2566. {
  2567.     new GET_AO_BONE_NAME[24];
  2568.     if(!IsValidAttachedObjectBone(BoneID)) valstr(GET_AO_BONE_NAME, 0);
  2569.     else strins(GET_AO_BONE_NAME, AttachedObjectBones[BoneID - MIN_ATTACHED_OBJECT_BONE], 0);
  2570.     return GET_AO_BONE_NAME;
  2571. }
  2572.  
  2573. stock GetAttachedObjectBoneID(const BoneName[])
  2574. {
  2575.     if(!IsValidAttachedObjectBoneName(BoneName)) return 0;
  2576.     if(IsNumeric(BoneName) && IsValidAttachedObjectBoneName(BoneName)) return strval(BoneName);
  2577.     for(new i = 0; i < sizeof(AttachedObjectBones); i++)
  2578.         if(strfind(AttachedObjectBones[i], BoneName, true) != -1) return i + MIN_ATTACHED_OBJECT_BONE;
  2579.     return 0;
  2580. }
  2581.  
  2582. stock GetAttachedObjectsCount()
  2583. {
  2584.     new _AttachedObjectsCount;
  2585.     for(new x = 0; x < GetMaxPlayers(); x++)
  2586.         if(IsPlayerConnected(x))
  2587.             for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
  2588.                 if(IsPlayerAttachedObjectSlotUsed(x, i)) _AttachedObjectsCount++;
  2589.     return _AttachedObjectsCount;
  2590. }
  2591.  
  2592. stock GetPlayerAttachedObjectsCount(playerid)
  2593. {
  2594.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID;
  2595.     new _PlayerAttachedObjectsCount;
  2596.     for(new i = 0; i < MAX_PLAYER_ATTACHED_OBJECTS; i++)
  2597.         if(IsPlayerAttachedObjectSlotUsed(playerid, i)) _PlayerAttachedObjectsCount++;
  2598.     return _PlayerAttachedObjectsCount;
  2599. }
  2600.  
  2601. stock IsValidPlayerAttachedObject(playerid, index)
  2602. {
  2603.     if(!IsPlayerConnected(playerid)) return INVALID_PLAYER_ID; // Player is offline
  2604.     if(!GetPlayerAttachedObjectsCount(playerid) || !IsPlayerAttachedObjectSlotUsed(playerid, index)) return -1; // Not used
  2605.     if(!IsValidAttachedObjectSlot(index) || !IsValidObjectModel(pao[playerid][index][aoModelID]) || !IsValidAttachedObjectBone(pao[playerid][index][aoBoneID]) || !pao[playerid][index][aoValid]) return 0; // Invalid data
  2606.     return 1;
  2607. }
  2608.  
  2609. stock IsValidAttachedObjectSlot(SlotID) {
  2610.     if(0 <= SlotID < MAX_PLAYER_ATTACHED_OBJECTS) return true;
  2611.     return false;
  2612. }
  2613.  
  2614. stock IsValidAttachedObjectBone(BoneID) {
  2615.     if(MIN_ATTACHED_OBJECT_BONE <= BoneID <= MAX_ATTACHED_OBJECT_BONE) return true;
  2616.     return false;
  2617. }
  2618.  
  2619. stock IsValidAttachedObjectBoneName(const BoneName[])
  2620. {
  2621.     new length = strlen(BoneName);
  2622.     if(!length || length > 24) return false;
  2623.     for(new b = 0; b < sizeof(AttachedObjectBones); b++)
  2624.         if(!strcmp(BoneName, AttachedObjectBones[b], true)) return true;
  2625.     if(IsNumeric(BoneName) && IsValidAttachedObjectBone(strval(BoneName))) return true;
  2626.     return false;
  2627. }
  2628.  
  2629. stock IsValidFileName(const filename[])
  2630. {
  2631.     new length = strlen(filename);
  2632.     if(length < 1 || length > 24) return false;
  2633.     for(new j = 0; j < length; j++) {
  2634.         if((filename[j] < 'A' || filename[j] > 'Z') && (filename[j] < 'a' || filename[j] > 'z') && (filename[j] < '0' || filename[j] > '9')
  2635.             && !(filename[j] == '@' || filename[j] == '$' || filename[j] == '(' || filename[j] == ')'
  2636.             || filename[j] == '[' || filename[j] == ']' || filename[j] == '_' || filename[j] == '=' || filename[j] == '.')) return false;
  2637.     }
  2638.     return true;
  2639. }
  2640.  
  2641. //------------------------------------------------------------------------------
  2642.  
  2643. stock IsValidObjectModel(ModelID)
  2644. {
  2645.     if(
  2646.     // Weapons Objects
  2647.     (ModelID >= 321 && ModelID <= 326)
  2648.     || (ModelID >= 330 && ModelID <= 331)
  2649.     || (ModelID >= 333 && ModelID <= 339)
  2650.     || (ModelID >= 341 && ModelID <= 344)
  2651.     || (ModelID >= 346 && ModelID <= 363)
  2652.     || (ModelID >= 365 && ModelID <= 372)
  2653.     // Fun Objects
  2654.     || (ModelID >= 1433 && ModelID <= 13594)
  2655.     // Roads Objects
  2656.     || (ModelID >= 5482 && ModelID <= 5512)
  2657.     // Barriers Objects
  2658.     || (ModelID >= 966 && ModelID <= 998)
  2659.     // Misc Objects 1210-1325
  2660.     || (ModelID >= 1210 && ModelID <= 1325)
  2661.     // Misc Objects 1420-1620
  2662.     || (ModelID >= 1420 && ModelID <= 1620)
  2663.     // Misc Objects 1971-4522
  2664.     || (ModelID >= 1971 && ModelID <= 4522)
  2665.     // SA:MP Object 18632-19515 (0.3e)
  2666.     || (ModelID >= 18632 && ModelID <= 19515)
  2667.     // Custom Object 19516-19999 (Including SA:MP 0.3x objects, can be changed)
  2668.     || (ModelID >= 19516 && ModelID <= 19999))
  2669.         return true;
  2670.     return false;
  2671. }
  2672.  
  2673. stock strtok(const string[], &index)
  2674. {
  2675.     new length = strlen(string);
  2676.     while ((index < length) && (string[index] <= ' '))
  2677.     {
  2678.         index++;
  2679.     }
  2680.  
  2681.     new offset = index;
  2682.     new result[20];
  2683.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  2684.     {
  2685.         result[index - offset] = string[index];
  2686.         index++;
  2687.     }
  2688.     result[index - offset] = EOS;
  2689.     return result;
  2690. }
  2691.  
  2692. stock strrest(const string[], &index)
  2693. {
  2694.     new length = strlen(string);
  2695.     while ((index < length) && (string[index] <= ' '))
  2696.     {
  2697.         index++;
  2698.     }
  2699.     new offset = index;
  2700.     new result[128];
  2701.     while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
  2702.     {
  2703.         result[index - offset] = string[index];
  2704.         index++;
  2705.     }
  2706.     result[index - offset] = EOS;
  2707.     return result;
  2708. }
  2709.  
  2710. stock IsNumeric(const string[])
  2711. {
  2712.     new length=strlen(string);
  2713.     if(length==0) return false;
  2714.     for(new i = 0; i < length; i++) {
  2715.         if(string[i] > '9' || string[i] <'0') return false;
  2716.     }
  2717.     return true;
  2718. }
  2719.  
  2720. stock IsNumeric2(const string[])
  2721. {
  2722.     // Is Numeric Check 2
  2723.     // ------------------
  2724.     // By DracoBlue... handles negative numbers
  2725.     new length=strlen(string);
  2726.     if (length==0) return false;
  2727.     for (new i = 0; i < length; i++)
  2728.     {
  2729.         if((string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+' && string[i]!='.') // Not a number,'+' or '-' or '.'
  2730.             || (string[i]=='-' && i!=0)             // A '-' but not first char.
  2731.             || (string[i]=='+' && i!=0)             // A '+' but not first char.
  2732.         ) return false;
  2733.     }
  2734.     if (length==1 && (string[0]=='-' || string[0]=='+' || string[0]=='.')) return false;
  2735.     return true;
  2736. }
  2737.  
  2738. stock IsValidHex(string[])
  2739. {
  2740.     new length = strlen(string);
  2741.     if(length < 6 || length > 8) return false;
  2742.     for(new i = 0; i < length; i++)
  2743.         if((string[i] < 'A' || string[i] > 'F') && (string[i] < 'a' || string[i] > 'f') && (string[i] < '0' || string[i] > '9')) return false;
  2744.     return true;
  2745. }
  2746.  
  2747. stock RGB( red, green, blue, alpha )
  2748. {
  2749.     /* Combines a color and returns it, so it can be used in functions.
  2750.     @red:           Amount of red color.
  2751.     @green:         Amount of green color.
  2752.     @blue:          Amount of blue color.
  2753.     @alpha:         Amount of alpha transparency.
  2754.  
  2755.     -Returns:
  2756.     An integer with the combined color.
  2757.     */
  2758.     return (red * 16777216) + (green * 65536) + (blue * 256) + alpha;
  2759. }
  2760.  
  2761. stock RGBAtoARGB(color)
  2762.     return (color >>> 8)|(color << 24);
  2763.  
  2764. stock HexToInt(string[])
  2765. {
  2766.     if (string[0] == 0) return 0;
  2767.     new i;
  2768.     new cur = 1;
  2769.     new res = 0;
  2770.     for (i = strlen(string); i > 0; i--) {
  2771.         if (string[i-1] < 58) res = res + cur * (string[i-1] - 48);
  2772.         else {
  2773.             res = res + cur * (string[i-1] - 65 + 10);
  2774.             cur = cur * 16;
  2775.         }
  2776.     }
  2777.     return res;
  2778. }
  2779.  
  2780. stock IntToHex(number)
  2781. {
  2782.     new m=1;
  2783.     new depth=0;
  2784.     while (number>=m) {
  2785.         m = m*16;
  2786.         depth++;
  2787.     }
  2788.     depth--;
  2789.     new str[256];
  2790.     for (new i = depth; i >= 0; i--)
  2791.     {
  2792.         str[i] = ( number & 0x0F) + 0x30; // + (tmp > 9 ? 0x07 : 0x00)
  2793.         str[i] += (str[i] > '9') ? 0x07 : 0x00;
  2794.         number >>= 4;
  2795.     }
  2796.     if(strlen(str) == 0)strins(str,"00",0);
  2797.     else
  2798.     if(strlen(str) == 1)strins(str,"0",0);
  2799.     str[8] = '\0';
  2800.     return str;
  2801. }
Add Comment
Please, Sign In to add comment