Robo_N1X

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

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