Advertisement
Guest User

GTA V dufflebag script

a guest
Oct 13th, 2019
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 47.99 KB | None | 0 0
  1. namespace TheCharacterClothesMod
  2. {
  3.   public class Clothes
  4.   {
  5.     public int headId;
  6.     public int beardId;
  7.     public int hairId;
  8.     public int torsoId;
  9.     public int legsId;
  10.     public int handsId;
  11.     public int footId;
  12.     public int masksId;
  13.     public int extraParts1Id;
  14.     public int extraParts2Id;
  15.     public int auxilaryPartsId;
  16.     public int headTextureId;
  17.     public int beardTextureId;
  18.     public int hairTextureId;
  19.     public int torsoTextureId;
  20.     public int legsTextureId;
  21.     public int handsTextureId;
  22.     public int footTextureId;
  23.     public int masksTextureId;
  24.     public int extraParts1TextureId;
  25.     public int extraParts2TextureId;
  26.     public int auxilaryPartsTextureId;
  27.     public int hatId;
  28.     public int glassesId;
  29.     public int earsId;
  30.     public int hatTextureId;
  31.     public int glassesTextureId;
  32.     public int earsTextureId;
  33.  
  34.     public Clothes()
  35.     {
  36.       this.headId = 0;
  37.       this.beardId = 0;
  38.       this.hairId = 0;
  39.       this.torsoId = 0;
  40.       this.legsId = 0;
  41.       this.handsId = 0;
  42.       this.footId = 0;
  43.       this.masksId = 0;
  44.       this.extraParts1Id = 0;
  45.       this.extraParts2Id = 0;
  46.       this.auxilaryPartsId = 0;
  47.       this.headTextureId = 0;
  48.       this.beardTextureId = 0;
  49.       this.hairTextureId = 0;
  50.       this.torsoTextureId = 0;
  51.       this.legsTextureId = 0;
  52.       this.handsTextureId = 0;
  53.       this.footTextureId = 0;
  54.       this.masksTextureId = 0;
  55.       this.extraParts1TextureId = 0;
  56.       this.extraParts2TextureId = 0;
  57.       this.auxilaryPartsTextureId = 0;
  58.       this.hatId = 0;
  59.       this.glassesId = 0;
  60.       this.earsId = 0;
  61.       this.hatTextureId = 0;
  62.       this.glassesTextureId = 0;
  63.       this.earsTextureId = 0;
  64.     }
  65.   }
  66. }
  67.  
  68.  
  69. //End of Part 1
  70.  
  71.  
  72. using GTA;
  73. using GTA.Native;
  74. using MadMilkman.Ini;
  75. using NativeUI;
  76. using System;
  77. using System.Collections.Generic;
  78. using System.Drawing;
  79. using System.IO;
  80. using System.Windows.Forms;
  81.  
  82. namespace TheCharacterClothesMod
  83. {
  84.   public class MainClass : Script
  85.   {
  86.     private bool modActivated;
  87.     private bool keepPersistent;
  88.     private bool onStartup;
  89.     private bool useDuffleBag;
  90.     private bool gaveBackBag;
  91.     private bool setupCacheClothes;
  92.     private bool startedUp;
  93.     private Keys openMenuKey;
  94.     private Clothes cachedClothing;
  95.     private Clothes SavedClothesForMichael;
  96.     private Clothes SavedClothesForTrevor;
  97.     private Clothes SavedClothesForFranklin;
  98.     private UIMenu mainMenu;
  99.     private MenuPool _menuPool;
  100.     private UIMenuItem SaveCurrentClothes;
  101.     private UIMenuItem LoadCurrentClothes;
  102.     private UIMenuItem SaveGeneralSettings;
  103.     private UIMenuCheckboxItem ActivateMod;
  104.     private UIMenuCheckboxItem Persistent;
  105.     private UIMenuCheckboxItem Startup;
  106.     private UIMenuCheckboxItem DuffleBag;
  107.     private UIMenuListItem DuffleBagTypes;
  108.     private Model playerModel;
  109.     private const string INI_PATH = ".\\scripts\\TheCharacterClothesMod.ini";
  110.     private Control control1;
  111.     private Control control2;
  112.  
  113.     public MainClass()
  114.     {
  115.       base.\u002Ector();
  116.       if (!File.Exists(".\\scripts\\TheCharacterClothesMod.ini"))
  117.         File.Create(".\\scripts\\TheCharacterClothesMod.ini").Close();
  118.       LogWriter.WriteToLog("You are running version 0.9", false, (Script) this, (Exception) null);
  119.       this.GetSettings();
  120.       this.CreateMenus();
  121.       this.add_Tick(new EventHandler(this.MainClass_Tick));
  122.       this.add_KeyDown(new KeyEventHandler(this.MainClass_KeyDown));
  123.     }
  124.  
  125.     private void GetSettings()
  126.     {
  127.       try
  128.       {
  129.         if (!File.Exists(".\\scripts\\TheCharacterClothesMod.ini"))
  130.           return;
  131.         IniFile iniFile = new IniFile();
  132.         iniFile.Load(".\\scripts\\TheCharacterClothesMod.ini");
  133.         if (iniFile.Sections.Contains("KEYS"))
  134.         {
  135.           if (iniFile.Sections["KEYS"].Keys.Contains("OPEN_MENU_KEY"))
  136.           {
  137.             this.openMenuKey = (Keys) Enum.Parse(typeof (Keys), iniFile.Sections["KEYS"].Keys["OPEN_MENU_KEY"].Value);
  138.           }
  139.           else
  140.           {
  141.             iniFile.Sections["KEYS"].Keys.Add("OPEN_MENU_KEY", "O");
  142.             this.openMenuKey = Keys.O;
  143.             iniFile.Save(".\\scripts\\TheCharacterClothesMod.ini");
  144.           }
  145.         }
  146.         else
  147.         {
  148.           iniFile.Sections.Add("KEYS").Keys.Add("OPEN_MENU_KEY", "O");
  149.           this.openMenuKey = Keys.O;
  150.         }
  151.         if (iniFile.Sections.Contains("GENERAL"))
  152.         {
  153.           IniSection section = iniFile.Sections["GENERAL"];
  154.           if (section.Keys.Contains("MOD_ACTIVATE"))
  155.           {
  156.             this.ActivateMod.Checked = bool.Parse(iniFile.Sections["GENERAL"].Keys["MOD_ACTIVATE"].Value);
  157.             this.modActivated = this.ActivateMod.Checked;
  158.           }
  159.           if (section.Keys.Contains("KEEP_PERSISTENT"))
  160.           {
  161.             this.Persistent.Checked = bool.Parse(iniFile.Sections["GENERAL"].Keys["KEEP_PERSISTENT"].Value);
  162.             this.keepPersistent = this.Persistent.Checked;
  163.           }
  164.           if (section.Keys.Contains("ON_STARTUP"))
  165.           {
  166.             this.Startup.Checked = bool.Parse(iniFile.Sections["GENERAL"].Keys["ON_STARTUP"].Value);
  167.             this.onStartup = this.Startup.Checked;
  168.           }
  169.           if (section.Keys.Contains("USE_DUFFLE_BAG"))
  170.           {
  171.             this.DuffleBag.Checked = bool.Parse(iniFile.Sections["GENERAL"].Keys["USE_DUFFLE_BAG"].Value);
  172.             this.useDuffleBag = this.DuffleBag.Checked;
  173.           }
  174.           if (section.Keys.Contains("DUFFLE_BAG_TYPE"))
  175.             this.DuffleBagTypes.Index = int.Parse(section.Keys["DUFFLE_BAG_TYPE"].Value);
  176.         }
  177.         else
  178.         {
  179.           IniSection iniSection = iniFile.Sections.Add("GENERAL");
  180.           iniSection.Keys.Add("MOD_ACTIVATE", this.modActivated.ToString());
  181.           iniSection.Keys.Add("KEEP_PERSISTENT", this.keepPersistent.ToString());
  182.           iniSection.Keys.Add("ON_STARTUP", this.onStartup.ToString());
  183.           iniSection.Keys.Add("USE_DUFFLE_BAG", this.useDuffleBag.ToString());
  184.           iniSection.Keys.Add("DUFFLE_BAG_TYPE", 0.ToString());
  185.         }
  186.         if (iniFile.Sections.Contains("CONTROLLER_SETTINGS"))
  187.         {
  188.           IniSection section = iniFile.Sections["CONTROLLER_SETTINGS"];
  189.           if (section.Keys.Contains("CONTROL_1"))
  190.           {
  191.             if (section.Keys.Contains("CONTROL_2"))
  192.             {
  193.               try
  194.               {
  195.                 this.control1 = (Control) Enum.Parse(typeof (Control), section.Keys["CONTROL_1"].Value);
  196.                 this.control2 = (Control) Enum.Parse(typeof (Control), section.Keys["CONTROL_2"].Value);
  197.                 goto label_25;
  198.               }
  199.               catch (Exception ex)
  200.               {
  201.                 UI.Notify(ex.Message);
  202.                 goto label_25;
  203.               }
  204.             }
  205.           }
  206.           UI.Notify("Could not read file.");
  207.         }
  208.         else
  209.         {
  210.           IniSection iniSection = iniFile.Sections.Add("CONTROLLER_SETTINGS");
  211.           iniSection.Keys.Add("CONTROL_1", "ScriptPadLeft");
  212.           iniSection.Keys.Add("CONTROL_2", "ScriptLB");
  213.         }
  214. label_25:
  215.         iniFile.Save(".\\scripts\\TheCharacterClothesMod.ini");
  216.       }
  217.       catch (Exception ex)
  218.       {
  219.         UI.Notify("Could not read settings from TheCharacterClothesMod.ini file.");
  220.         UI.Notify(ex.Message);
  221.         LogWriter.WriteToLog(ex.Message, true, (Script) this, ex);
  222.       }
  223.     }
  224.  
  225.     private void CreateMenus()
  226.     {
  227.       this.mainMenu = new UIMenu("", "~g~The Character Clothes Mod");
  228.       this._menuPool = new MenuPool();
  229.       this._menuPool.Add(this.mainMenu);
  230.       this.SaveCurrentClothes = new UIMenuItem("Save Current Clothes For: ", "Saves your current character's clothes clothes.");
  231.       this.LoadCurrentClothes = new UIMenuItem("Load Saved Clothes For: ", "Loads your saved clothes.");
  232.       this.SaveGeneralSettings = new UIMenuItem("Save General Settings", "Saves settings for checkboxes above.");
  233.       this.ActivateMod = new UIMenuCheckboxItem("Only For Char Switch", this.modActivated, "When you switch characters, the character you switch to will have the clothes you saved for him.");
  234.       this.Persistent = new UIMenuCheckboxItem("Keep Persistent", this.keepPersistent, "Keeps your clothes persistent, and they cannot be changed no matter what.");
  235.       this.Startup = new UIMenuCheckboxItem("On Startup", this.onStartup, "If checked, your clothes will be automatically on you when the script starts.");
  236.       this.DuffleBag = new UIMenuCheckboxItem("Use Duffel Bag", this.useDuffleBag, "If checked, you will use a duffle bag that will hold your weapons.");
  237.       this.DuffleBagTypes = new UIMenuListItem("Duffel Bag Type", new List<object>()
  238.       {
  239.         (object) "Black",
  240.         (object) "Tan"
  241.       }, 0, "Select a duffle bag type.");
  242.       this.mainMenu.AddItem((UIMenuItem) this.ActivateMod);
  243.       this.mainMenu.AddItem((UIMenuItem) this.Persistent);
  244.       this.mainMenu.AddItem((UIMenuItem) this.Startup);
  245.       this.mainMenu.AddItem((UIMenuItem) this.DuffleBag);
  246.       this.mainMenu.AddItem((UIMenuItem) this.DuffleBagTypes);
  247.       this.mainMenu.AddItem(this.SaveGeneralSettings);
  248.       this.mainMenu.AddItem(this.SaveCurrentClothes);
  249.       this.mainMenu.AddItem(this.LoadCurrentClothes);
  250.       this.mainMenu.OnItemSelect += new ItemSelectEvent(this.MainMenu_OnItemSelect);
  251.       this.mainMenu.OnCheckboxChange += new CheckboxChangeEvent(this.MainMenu_OnCheckboxChange);
  252.       this.DuffleBagTypes.OnListChanged += new ItemListEvent(this.DuffleBagTypes_OnListChanged);
  253.     }
  254.  
  255.     private void MainMenu_OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
  256.     {
  257.       if (selectedItem == this.SaveCurrentClothes)
  258.         this.SaveToIni();
  259.       if (selectedItem == this.LoadCurrentClothes)
  260.         this.LoadFromIni();
  261.       if (selectedItem != this.SaveGeneralSettings)
  262.         return;
  263.       this.SaveGeneral();
  264.     }
  265.  
  266.     private void SaveToIni()
  267.     {
  268.       try
  269.       {
  270.         if (!File.Exists(".\\scripts\\TheCharacterClothesMod.ini"))
  271.           return;
  272.         this.SaveToIniForChar(Utilities.GetCurrentCharacterName());
  273.       }
  274.       catch (Exception ex)
  275.       {
  276.         UI.Notify("Could not save to TheCharacterClothesMod.ini");
  277.         UI.Notify(ex.Message);
  278.         LogWriter.WriteToLog(ex.Message, true, (Script) this, ex);
  279.       }
  280.     }
  281.  
  282.     private void SaveToIniForChar(string charName)
  283.     {
  284.       string upper = charName.ToUpper();
  285.       Clothes currentClothes = Utilities.GetCurrentClothes();
  286.       IniFile iniFile = new IniFile();
  287.       iniFile.Load(".\\scripts\\TheCharacterClothesMod.ini");
  288.       if (!iniFile.Sections.Contains(charName))
  289.       {
  290.         IniSection iniSection = iniFile.Sections.Add(upper);
  291.         iniSection.Keys.Add("HEAD_ID", currentClothes.headId.ToString());
  292.         iniSection.Keys.Add("BEARD_ID", currentClothes.beardId.ToString());
  293.         iniSection.Keys.Add("HAIR_ID", currentClothes.hairId.ToString());
  294.         iniSection.Keys.Add("TORSO_ID", currentClothes.torsoId.ToString());
  295.         iniSection.Keys.Add("LEGS_ID", currentClothes.legsId.ToString());
  296.         iniSection.Keys.Add("HANDS_ID", currentClothes.handsId.ToString());
  297.         iniSection.Keys.Add("FOOT_ID", currentClothes.footId.ToString());
  298.         iniSection.Keys.Add("EXTRA_PART1_ID", currentClothes.extraParts1Id.ToString());
  299.         if (!this.useDuffleBag && currentClothes.extraParts2Id != 1 && (currentClothes.extraParts2Id != 2 && currentClothes.extraParts2Id != 11) && currentClothes.extraParts2Id != 12)
  300.         {
  301.           iniSection.Keys.Add("EXTRA_PART2_ID", currentClothes.extraParts2Id.ToString());
  302.         }
  303.         else
  304.         {
  305.           UI.Notify("Cannot save duffle bag created by this script.");
  306.           iniSection.Keys.Add("EXTRA_PART2_ID", "0");
  307.         }
  308.         iniSection.Keys.Add("MASKS_ID", currentClothes.masksId.ToString());
  309.         iniSection.Keys.Add("AUXILLIRAY_PARTS_ID", currentClothes.auxilaryPartsId.ToString());
  310.         iniSection.Keys.Add("HEAD_TEXTURE_ID", currentClothes.headTextureId.ToString());
  311.         iniSection.Keys.Add("BEARD_TEXTURE_ID", currentClothes.beardTextureId.ToString());
  312.         iniSection.Keys.Add("HAIR_TEXTURE_ID", currentClothes.hairTextureId.ToString());
  313.         iniSection.Keys.Add("TORSO_TEXTURE_ID", currentClothes.torsoTextureId.ToString());
  314.         iniSection.Keys.Add("LEGS_TEXTURE_ID", currentClothes.legsTextureId.ToString());
  315.         iniSection.Keys.Add("HANDS_TEXTURE_ID", currentClothes.handsTextureId.ToString());
  316.         iniSection.Keys.Add("FOOT_TEXTURE_ID", currentClothes.footTextureId.ToString());
  317.         iniSection.Keys.Add("EXTRA_PART1_TEXTURE_ID", currentClothes.extraParts1TextureId.ToString());
  318.         iniSection.Keys.Add("EXTRA_PART2_TEXTURE_ID", currentClothes.extraParts2TextureId.ToString());
  319.         iniSection.Keys.Add("MASKS_TEXTURE_ID", currentClothes.masksTextureId.ToString());
  320.         iniSection.Keys.Add("AUXILLIRAY_PARTS_TEXTURE_ID", currentClothes.auxilaryPartsTextureId.ToString());
  321.         iniSection.Keys.Add("HAT_ID", currentClothes.hatId.ToString());
  322.         iniSection.Keys.Add("GLASSES_ID", currentClothes.glassesId.ToString());
  323.         iniSection.Keys.Add("EARS_ID", currentClothes.earsId.ToString());
  324.         iniSection.Keys.Add("HAT_TEXTURE_ID", currentClothes.hatTextureId.ToString());
  325.         iniSection.Keys.Add("GLASSES_TEXTURE_ID", currentClothes.glassesTextureId.ToString());
  326.         iniSection.Keys.Add("EARS_TEXTURE_ID", currentClothes.earsTextureId.ToString());
  327.       }
  328.       else
  329.       {
  330.         IniSection section = iniFile.Sections[upper];
  331.         section.Keys["HEAD_ID"].Value = currentClothes.headId.ToString();
  332.         section.Keys["BEARD_ID"].Value = currentClothes.beardId.ToString();
  333.         section.Keys["HAIR_ID"].Value = currentClothes.hairId.ToString();
  334.         section.Keys["TORSO_ID"].Value = currentClothes.torsoId.ToString();
  335.         section.Keys["LEGS_ID"].Value = currentClothes.legsId.ToString();
  336.         section.Keys["HANDS_ID"].Value = currentClothes.handsId.ToString();
  337.         section.Keys["FOOT_ID"].Value = currentClothes.footId.ToString();
  338.         section.Keys["EXTRA_PART1_ID"].Value = currentClothes.extraParts1Id.ToString();
  339.         if (!this.useDuffleBag)
  340.           section.Keys["EXTRA_PART2_ID"].Value = currentClothes.extraParts2Id.ToString();
  341.         else
  342.           UI.Notify("Not saving duffle bag created by this script.");
  343.         section.Keys["MASKS_ID"].Value = currentClothes.masksId.ToString();
  344.         section.Keys["AUXILLIRAY_PARTS_ID"].Value = currentClothes.auxilaryPartsId.ToString();
  345.         section.Keys["HEAD_TEXTURE_ID"].Value = currentClothes.headTextureId.ToString();
  346.         section.Keys["BEARD_TEXTURE_ID"].Value = currentClothes.beardTextureId.ToString();
  347.         section.Keys["HAIR_TEXTURE_ID"].Value = currentClothes.hairTextureId.ToString();
  348.         section.Keys["TORSO_TEXTURE_ID"].Value = currentClothes.torsoTextureId.ToString();
  349.         section.Keys["LEGS_TEXTURE_ID"].Value = currentClothes.legsTextureId.ToString();
  350.         section.Keys["HANDS_TEXTURE_ID"].Value = currentClothes.handsTextureId.ToString();
  351.         section.Keys["FOOT_TEXTURE_ID"].Value = currentClothes.footTextureId.ToString();
  352.         section.Keys["EXTRA_PART1_TEXTURE_ID"].Value = currentClothes.extraParts1TextureId.ToString();
  353.         section.Keys["EXTRA_PART2_TEXTURE_ID"].Value = currentClothes.extraParts2TextureId.ToString();
  354.         section.Keys["MASKS_TEXTURE_ID"].Value = currentClothes.masksTextureId.ToString();
  355.         section.Keys["AUXILLIRAY_PARTS_TEXTURE_ID"].Value = currentClothes.auxilaryPartsTextureId.ToString();
  356.         section.Keys["HAT_ID"].Value = currentClothes.hatId.ToString();
  357.         section.Keys["GLASSES_ID"].Value = currentClothes.glassesId.ToString();
  358.         section.Keys["EARS_ID"].Value = currentClothes.earsId.ToString();
  359.         section.Keys["HAT_TEXTURE_ID"].Value = currentClothes.hatTextureId.ToString();
  360.         section.Keys["GLASSES_TEXTURE_ID"].Value = currentClothes.glassesTextureId.ToString();
  361.         section.Keys["EARS_TEXTURE_ID"].Value = currentClothes.earsTextureId.ToString();
  362.       }
  363.       if (!(charName == "Michael"))
  364.       {
  365.         if (!(charName == "Trevor"))
  366.         {
  367.           if (charName == "Franklin")
  368.             UI.Notify("Saved ~g~clothes~w~.");
  369.         }
  370.         else
  371.           UI.Notify("Saved ~o~clothes~w~.");
  372.       }
  373.       else
  374.         UI.Notify("Saved ~b~clothes~w~.");
  375.       iniFile.Save(".\\scripts\\TheCharacterClothesMod.ini");
  376.     }
  377.  
  378.     private void LoadFromIni()
  379.     {
  380.       try
  381.       {
  382.         if (!File.Exists(".\\scripts\\TheCharacterClothesMod.ini"))
  383.           return;
  384.         this.LoadFromIniForChar(Utilities.GetCurrentCharacterName());
  385.       }
  386.       catch (Exception ex)
  387.       {
  388.         UI.Notify("Could not load from TheCharacterClothesMod.ini");
  389.         UI.Notify(ex.Message);
  390.         LogWriter.WriteToLog(ex.Message, true, (Script) this, ex);
  391.       }
  392.     }
  393.  
  394.     private void LoadFromIniForChar(string charName)
  395.     {
  396.       IniFile iniFile = new IniFile();
  397.       iniFile.Load(".\\scripts\\TheCharacterClothesMod.ini");
  398.       IniSection section = iniFile.Sections[charName.ToUpper()];
  399.       if (section != null)
  400.       {
  401.         Clothes clothesToSet = new Clothes();
  402.         if (section.Keys["HEAD_ID"] != null)
  403.         {
  404.           clothesToSet.headId = int.Parse(section.Keys["HEAD_ID"].Value);
  405.           clothesToSet.beardId = int.Parse(section.Keys["BEARD_ID"].Value);
  406.           clothesToSet.hairId = int.Parse(section.Keys["HAIR_ID"].Value);
  407.           clothesToSet.torsoId = int.Parse(section.Keys["TORSO_ID"].Value);
  408.           clothesToSet.legsId = int.Parse(section.Keys["LEGS_ID"].Value);
  409.           clothesToSet.handsId = int.Parse(section.Keys["HANDS_ID"].Value);
  410.           clothesToSet.footId = int.Parse(section.Keys["FOOT_ID"].Value);
  411.           clothesToSet.extraParts1Id = int.Parse(section.Keys["EXTRA_PART1_ID"].Value);
  412.           clothesToSet.extraParts2Id = int.Parse(section.Keys["EXTRA_PART2_ID"].Value);
  413.           clothesToSet.masksId = int.Parse(section.Keys["MASKS_ID"].Value);
  414.           clothesToSet.auxilaryPartsId = int.Parse(section.Keys["AUXILLIRAY_PARTS_ID"].Value);
  415.           clothesToSet.headTextureId = int.Parse(section.Keys["HEAD_TEXTURE_ID"].Value);
  416.           clothesToSet.beardTextureId = int.Parse(section.Keys["BEARD_TEXTURE_ID"].Value);
  417.           clothesToSet.hairTextureId = int.Parse(section.Keys["HAIR_TEXTURE_ID"].Value);
  418.           clothesToSet.torsoTextureId = int.Parse(section.Keys["TORSO_TEXTURE_ID"].Value);
  419.           clothesToSet.legsTextureId = int.Parse(section.Keys["LEGS_TEXTURE_ID"].Value);
  420.           clothesToSet.handsTextureId = int.Parse(section.Keys["HANDS_TEXTURE_ID"].Value);
  421.           clothesToSet.footTextureId = int.Parse(section.Keys["FOOT_TEXTURE_ID"].Value);
  422.           clothesToSet.extraParts1TextureId = int.Parse(section.Keys["EXTRA_PART1_TEXTURE_ID"].Value);
  423.           clothesToSet.extraParts2TextureId = int.Parse(section.Keys["EXTRA_PART2_TEXTURE_ID"].Value);
  424.           clothesToSet.masksTextureId = int.Parse(section.Keys["MASKS_TEXTURE_ID"].Value);
  425.           clothesToSet.auxilaryPartsTextureId = int.Parse(section.Keys["AUXILLIRAY_PARTS_TEXTURE_ID"].Value);
  426.           clothesToSet.hatId = int.Parse(section.Keys["HAT_ID"].Value);
  427.           clothesToSet.glassesId = int.Parse(section.Keys["GLASSES_ID"].Value);
  428.           clothesToSet.earsId = int.Parse(section.Keys["EARS_ID"].Value);
  429.           clothesToSet.hatTextureId = int.Parse(section.Keys["HAT_TEXTURE_ID"].Value);
  430.           clothesToSet.glassesTextureId = int.Parse(section.Keys["GLASSES_TEXTURE_ID"].Value);
  431.           clothesToSet.earsTextureId = int.Parse(section.Keys["EARS_TEXTURE_ID"].Value);
  432.           Utilities.SetClothes(Game.get_Player().get_Character(), clothesToSet);
  433.           if (!(charName == "Michael"))
  434.           {
  435.             if (!(charName == "Trevor"))
  436.             {
  437.               if (!(charName == "Franklin"))
  438.                 return;
  439.               UI.Notify("~g~Clothes~w~ loaded.");
  440.               this.SavedClothesForFranklin = clothesToSet;
  441.             }
  442.             else
  443.             {
  444.               UI.Notify("~o~Clothes~w~ loaded.");
  445.               this.SavedClothesForTrevor = clothesToSet;
  446.             }
  447.           }
  448.           else
  449.           {
  450.             UI.Notify("~b~Clothes~w~ loaded.");
  451.             this.SavedClothesForMichael = clothesToSet;
  452.           }
  453.         }
  454.         else
  455.           UI.Notify("Error in TheCharacterClothesMod.ini file. Please ask a developer for help.");
  456.       }
  457.       else
  458.         UI.Notify("Could not load clothes. No clothes found for " + charName + ".");
  459.     }
  460.  
  461.     private void SaveGeneral()
  462.     {
  463.       try
  464.       {
  465.         IniFile iniFile = new IniFile();
  466.         iniFile.Load(".\\scripts\\TheCharacterClothesMod.ini");
  467.         if (iniFile == null)
  468.           return;
  469.         if (iniFile.Sections.Contains("GENERAL"))
  470.         {
  471.           IniSection section = iniFile.Sections["GENERAL"];
  472.           section.Keys["KEEP_PERSISTENT"].Value = this.keepPersistent.ToString();
  473.           section.Keys["MOD_ACTIVATE"].Value = this.modActivated.ToString();
  474.           section.Keys["ON_STARTUP"].Value = this.onStartup.ToString();
  475.           section.Keys["USE_DUFFLE_BAG"].Value = this.useDuffleBag.ToString();
  476.           section.Keys["DUFFLE_BAG_TYPE"].Value = this.DuffleBagTypes.Index.ToString();
  477.           UI.Notify("Settings saved.");
  478.         }
  479.         else
  480.         {
  481.           IniSection iniSection = iniFile.Sections.Add("GENERAL");
  482.           iniSection.Keys.Add("KEEP_PERSISTENT", this.keepPersistent.ToString());
  483.           iniSection.Keys.Add("MOD_ACTIVATE", this.modActivated.ToString());
  484.           iniSection.Keys.Add("ON_STARTUP", this.onStartup.ToString());
  485.           iniSection.Keys.Add("USE_DUFFLE_BAG", this.useDuffleBag.ToString());
  486.           iniSection.Keys.Add("DUFFLE_BAG_TYPE", this.DuffleBagTypes.Index.ToString());
  487.           UI.Notify("Settings added to ini, and saved.");
  488.         }
  489.         iniFile.Save(".\\scripts\\TheCharacterClothesMod.ini");
  490.       }
  491.       catch (Exception ex)
  492.       {
  493.         UI.Notify("Could not save settings.");
  494.         UI.Notify(ex.Message);
  495.         LogWriter.WriteToLog(ex.Message, true, (Script) this, ex);
  496.       }
  497.     }
  498.  
  499.     private void MainMenu_OnCheckboxChange(
  500.       UIMenu sender,
  501.       UIMenuCheckboxItem checkboxItem,
  502.       bool Checked)
  503.     {
  504.       if (checkboxItem == this.ActivateMod)
  505.         this.modActivated = Checked;
  506.       if (checkboxItem == this.Persistent)
  507.         this.keepPersistent = Checked;
  508.       if (checkboxItem == this.DuffleBag)
  509.       {
  510.         this.useDuffleBag = Checked;
  511.         this.NotifyAvailableBags(this.DuffleBagTypes.Index);
  512.       }
  513.       if (checkboxItem != this.Startup)
  514.         return;
  515.       this.onStartup = Checked;
  516.       this.startedUp = true;
  517.     }
  518.  
  519.     private void NotifyAvailableBags(int newIndex)
  520.     {
  521.       if (newIndex != 1)
  522.         return;
  523.       string currentCharacterName = Utilities.GetCurrentCharacterName();
  524.       if (!(currentCharacterName == "Trevor"))
  525.       {
  526.         if (!(currentCharacterName == "Franklin"))
  527.           return;
  528.         UI.Notify("Selected bag type not available for ~g~Franklin~w~.");
  529.       }
  530.       else
  531.         UI.Notify("Selected bag type not available for ~o~Trevor~w~.");
  532.     }
  533.  
  534.     private void ControllerSupport()
  535.     {
  536.       if (this.mainMenu.Visible || !Game.IsControlPressed(2, this.control1))
  537.         return;
  538.       Game.DisableControlThisFrame(2, this.control2);
  539.       if (!Game.IsDisabledControlJustPressed(2, this.control2))
  540.         return;
  541.       this.mainMenu.Visible = true;
  542.     }
  543.  
  544.     private void DuffleBagTypes_OnListChanged(UIMenuListItem sender, int newIndex)
  545.     {
  546.       this.NotifyAvailableBags(newIndex);
  547.     }
  548.  
  549.     private void MainClass_Tick(object sender, EventArgs e)
  550.     {
  551.       if (this.onStartup && !this.startedUp)
  552.       {
  553.         if (Game.get_IsLoading() && !this.startedUp)
  554.         {
  555.           Script.Wait(500);
  556.         }
  557.         else
  558.         {
  559.           this.LoadFromIni();
  560.           this.startedUp = true;
  561.         }
  562.       }
  563.       if (this._menuPool != null)
  564.         this._menuPool.ProcessMenus();
  565.       this.ControllerSupport();
  566.       if (this.keepPersistent)
  567.       {
  568.         if (this.useDuffleBag)
  569.         {
  570.           this.Persistent.Checked = false;
  571.           this.Persistent.Enabled = false;
  572.           this.keepPersistent = false;
  573.         }
  574.         this.DuffleBag.Enabled = false;
  575.         this.DuffleBag.Checked = false;
  576.         this.useDuffleBag = false;
  577.         this.DuffleBagTypes.Enabled = false;
  578.       }
  579.       else if (!this.useDuffleBag)
  580.       {
  581.         this.Persistent.Checked = false;
  582.         this.Persistent.Enabled = true;
  583.         this.keepPersistent = false;
  584.       }
  585.       if (this.useDuffleBag)
  586.       {
  587.         if (this.keepPersistent)
  588.         {
  589.           this.DuffleBag.Checked = false;
  590.           this.DuffleBag.Enabled = false;
  591.           this.DuffleBagTypes.Enabled = false;
  592.           this.useDuffleBag = false;
  593.         }
  594.         this.keepPersistent = false;
  595.         this.Persistent.Checked = false;
  596.         this.Persistent.Enabled = false;
  597.       }
  598.       else if (!this.keepPersistent)
  599.       {
  600.         this.DuffleBag.Checked = false;
  601.         this.DuffleBag.Enabled = true;
  602.         this.DuffleBagTypes.Enabled = true;
  603.         this.useDuffleBag = false;
  604.       }
  605.       this.SetBannerSprite();
  606.       if (Function.Call<bool>((Hash) -2750907727005174945L, new InputArgument[0]) != null)
  607.         return;
  608.       this.SetupDuffleBag();
  609.       if (!this.keepPersistent && !this.modActivated && (!this.onStartup && !this.useDuffleBag))
  610.         this.SaveGeneralSettings.Enabled = false;
  611.       else if (this.keepPersistent || this.modActivated || (this.onStartup || this.useDuffleBag))
  612.         this.SaveGeneralSettings.Enabled = true;
  613.       this.DuffleBagTypes.Enabled = this.useDuffleBag;
  614.       if (this.keepPersistent)
  615.         this.KeepClothesPersistent();
  616.       if (Utilities.GetCurrentCharacterName() != "")
  617.       {
  618.         this.LoadCurrentClothes.Enabled = true;
  619.         this.SaveCurrentClothes.Enabled = true;
  620.         this.SaveCurrentClothes.Text = "Save Current Clothes For: " + Utilities.GetCurrentCharacterName();
  621.         this.LoadCurrentClothes.Text = "Load Saved Clothes For: " + Utilities.GetCurrentCharacterName();
  622.       }
  623.       else
  624.       {
  625.         this.LoadCurrentClothes.Enabled = false;
  626.         this.SaveCurrentClothes.Enabled = false;
  627.         this.SaveCurrentClothes.Text = "Save Current Clothes For: ";
  628.         this.LoadCurrentClothes.Text = "Load Saved Clothes For: ";
  629.       }
  630.       Model model = ((Entity) Game.get_Player().get_Character()).get_Model();
  631.       if (!this.modActivated || !Model.op_Inequality(this.playerModel, model))
  632.         return;
  633.       this.LoadFromIni();
  634.       this.playerModel = model;
  635.       this.cachedClothing = Utilities.GetCurrentClothes();
  636.     }
  637.  
  638.     private void SetBannerSprite()
  639.     {
  640.       if (this.mainMenu == null)
  641.         return;
  642.       string currentCharacterName = Utilities.GetCurrentCharacterName();
  643.       if (!(currentCharacterName != ""))
  644.         return;
  645.       if (currentCharacterName == "Michael")
  646.       {
  647.         ((UIText) this.mainMenu.Subtitle).set_Caption("~b~THE CHARACTER CLOTHES MOD");
  648.         this.mainMenu.SetBannerType(new Sprite("shopui_title_graphics_michael", "shopui_title_graphics_michael", new Point(0, 0), new Size(0, 0)));
  649.       }
  650.       if (currentCharacterName == "Trevor")
  651.       {
  652.         ((UIText) this.mainMenu.Subtitle).set_Caption("~o~THE CHARACTER CLOTHES MOD");
  653.         this.mainMenu.SetBannerType(new Sprite("shopui_title_graphics_trevor", "shopui_title_graphics_trevor", new Point(0, 0), new Size(0, 0)));
  654.       }
  655.       if (!(currentCharacterName == "Franklin"))
  656.         return;
  657.       ((UIText) this.mainMenu.Subtitle).set_Caption("~g~THE CHARACTER CLOTHES MOD");
  658.       this.mainMenu.SetBannerType(new Sprite("shopui_title_graphics_franklin", "shopui_title_graphics_franklin", new Point(0, 0), new Size(0, 0)));
  659.     }
  660.  
  661.     private void SetupDuffleBag()
  662.     {
  663.       Ped character = Game.get_Player().get_Character();
  664.       if (!this.setupCacheClothes)
  665.       {
  666.         this.cachedClothing = Utilities.GetCurrentClothes();
  667.         this.setupCacheClothes = true;
  668.       }
  669.       if (!Utilities.DoClothesMatch(this.cachedClothing) && this.cachedClothing != null)
  670.       {
  671.         Clothes currentClothes = Utilities.GetCurrentClothes();
  672.         if (currentClothes.extraParts2Id == 1 || currentClothes.extraParts2Id == 2 || (currentClothes.extraParts2Id == 11 || currentClothes.extraParts2Id == 12))
  673.           currentClothes.extraParts2Id = this.cachedClothing.extraParts2Id;
  674.         this.cachedClothing = currentClothes;
  675.       }
  676.       if (this.useDuffleBag)
  677.       {
  678.         Clothes currentClothes = Utilities.GetCurrentClothes();
  679.         int index = this.DuffleBagTypes.Index;
  680.         if (Utilities.GetSmallWeaponCount(character) >= 6 || Utilities.GetBigWeaponCount(character) >= 1)
  681.         {
  682.           switch (index)
  683.           {
  684.             case 0:
  685.               currentClothes.extraParts2Id = 1;
  686.               break;
  687.             case 1:
  688.               currentClothes.extraParts2Id = 12;
  689.               break;
  690.           }
  691.         }
  692.         else
  693.         {
  694.           switch (index)
  695.           {
  696.             case 0:
  697.               currentClothes.extraParts2Id = this.cachedClothing.extraParts2Id;
  698.               break;
  699.             case 1:
  700.               currentClothes.extraParts2Id = this.cachedClothing.extraParts2Id;
  701.               break;
  702.           }
  703.         }
  704.         Utilities.SetClothes(character, currentClothes);
  705.         this.gaveBackBag = false;
  706.       }
  707.       else
  708.       {
  709.         if (this.gaveBackBag)
  710.           return;
  711.         Utilities.SetClothes(character, this.cachedClothing);
  712.         string str = "Resetting ";
  713.         string currentCharacterName = Utilities.GetCurrentCharacterName();
  714.         if (!(currentCharacterName == "Michael"))
  715.         {
  716.           if (!(currentCharacterName == "Trevor"))
  717.           {
  718.             if (currentCharacterName == "Franklin")
  719.               str += "~g~bag~w~.";
  720.           }
  721.           else
  722.             str += "~o~bag~w~.";
  723.         }
  724.         else
  725.           str += "~b~bag~w~.";
  726.         UI.Notify(str);
  727.         this.gaveBackBag = true;
  728.       }
  729.     }
  730.  
  731.     private void KeepClothesPersistent()
  732.     {
  733.       string currentCharacterName = Utilities.GetCurrentCharacterName();
  734.       IniFile iniFile = new IniFile();
  735.       iniFile.Load(".\\scripts\\TheCharacterClothesMod.ini");
  736.       if (iniFile == null)
  737.         return;
  738.       if (currentCharacterName == "Michael")
  739.       {
  740.         if (!iniFile.Sections.Contains("MICHAEL") || Utilities.DoClothesMatch(this.SavedClothesForMichael))
  741.           return;
  742.         Utilities.SetClothes(Game.get_Player().get_Character(), this.SavedClothesForMichael);
  743.       }
  744.       else if (currentCharacterName == "Trevor")
  745.       {
  746.         if (!iniFile.Sections.Contains("TREVOR") || Utilities.DoClothesMatch(this.SavedClothesForTrevor))
  747.           return;
  748.         Utilities.SetClothes(Game.get_Player().get_Character(), this.SavedClothesForTrevor);
  749.       }
  750.       else
  751.       {
  752.         if (!(currentCharacterName == "Franklin") || !iniFile.Sections.Contains("FRANKLIN") || Utilities.DoClothesMatch(this.SavedClothesForFranklin))
  753.           return;
  754.         Utilities.SetClothes(Game.get_Player().get_Character(), this.SavedClothesForFranklin);
  755.       }
  756.     }
  757.  
  758.     private void MainClass_KeyDown(object sender, KeyEventArgs e)
  759.     {
  760.       if (this.mainMenu == null || e.KeyCode != this.openMenuKey)
  761.         return;
  762.       this.mainMenu.Visible = !this.mainMenu.Visible;
  763.     }
  764.   }
  765. }
  766.  
  767.  
  768. //End of Part 2
  769.  
  770.  
  771. using GTA;
  772. using GTA.Native;
  773. using MadMilkman.Ini;
  774. using System;
  775.  
  776. namespace TheCharacterClothesMod
  777. {
  778.   internal class Utilities
  779.   {
  780.     private static Script @this;
  781.  
  782.     public static Clothes GetCurrentClothes()
  783.     {
  784.       Clothes clothes = new Clothes();
  785.       int handle = ((Entity) Game.get_Player().get_Character()).get_Handle();
  786.       clothes.headId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  787.       {
  788.         InputArgument.op_Implicit(handle),
  789.         InputArgument.op_Implicit(0)
  790.       });
  791.       clothes.beardId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  792.       {
  793.         InputArgument.op_Implicit(handle),
  794.         InputArgument.op_Implicit(1)
  795.       });
  796.       clothes.hairId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  797.       {
  798.         InputArgument.op_Implicit(handle),
  799.         InputArgument.op_Implicit(2)
  800.       });
  801.       clothes.torsoId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  802.       {
  803.         InputArgument.op_Implicit(handle),
  804.         InputArgument.op_Implicit(3)
  805.       });
  806.       clothes.legsId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  807.       {
  808.         InputArgument.op_Implicit(handle),
  809.         InputArgument.op_Implicit(4)
  810.       });
  811.       clothes.handsId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  812.       {
  813.         InputArgument.op_Implicit(handle),
  814.         InputArgument.op_Implicit(5)
  815.       });
  816.       clothes.footId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  817.       {
  818.         InputArgument.op_Implicit(handle),
  819.         InputArgument.op_Implicit(6)
  820.       });
  821.       clothes.extraParts1Id = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  822.       {
  823.         InputArgument.op_Implicit(handle),
  824.         InputArgument.op_Implicit(8)
  825.       });
  826.       clothes.extraParts2Id = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  827.       {
  828.         InputArgument.op_Implicit(handle),
  829.         InputArgument.op_Implicit(9)
  830.       });
  831.       clothes.masksId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  832.       {
  833.         InputArgument.op_Implicit(handle),
  834.         InputArgument.op_Implicit(10)
  835.       });
  836.       clothes.auxilaryPartsId = (int) Function.Call<int>((Hash) 7490462606036423932L, new InputArgument[2]
  837.       {
  838.         InputArgument.op_Implicit(handle),
  839.         InputArgument.op_Implicit(11)
  840.       });
  841.       clothes.headTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  842.       {
  843.         InputArgument.op_Implicit(handle),
  844.         InputArgument.op_Implicit(0)
  845.       });
  846.       clothes.beardTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  847.       {
  848.         InputArgument.op_Implicit(handle),
  849.         InputArgument.op_Implicit(1)
  850.       });
  851.       clothes.hairTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  852.       {
  853.         InputArgument.op_Implicit(handle),
  854.         InputArgument.op_Implicit(2)
  855.       });
  856.       clothes.torsoTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  857.       {
  858.         InputArgument.op_Implicit(handle),
  859.         InputArgument.op_Implicit(3)
  860.       });
  861.       clothes.legsTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  862.       {
  863.         InputArgument.op_Implicit(handle),
  864.         InputArgument.op_Implicit(4)
  865.       });
  866.       clothes.handsTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  867.       {
  868.         InputArgument.op_Implicit(handle),
  869.         InputArgument.op_Implicit(5)
  870.       });
  871.       clothes.footTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  872.       {
  873.         InputArgument.op_Implicit(handle),
  874.         InputArgument.op_Implicit(6)
  875.       });
  876.       clothes.extraParts1TextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  877.       {
  878.         InputArgument.op_Implicit(handle),
  879.         InputArgument.op_Implicit(8)
  880.       });
  881.       clothes.extraParts2TextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  882.       {
  883.         InputArgument.op_Implicit(handle),
  884.         InputArgument.op_Implicit(9)
  885.       });
  886.       clothes.masksTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  887.       {
  888.         InputArgument.op_Implicit(handle),
  889.         InputArgument.op_Implicit(10)
  890.       });
  891.       clothes.auxilaryPartsTextureId = (int) Function.Call<int>((Hash) 334205219021784294L, new InputArgument[2]
  892.       {
  893.         InputArgument.op_Implicit(handle),
  894.         InputArgument.op_Implicit(11)
  895.       });
  896.       clothes.hatId = (int) Function.Call<int>((Hash) -8535233825580798760L, new InputArgument[2]
  897.       {
  898.         InputArgument.op_Implicit(handle),
  899.         InputArgument.op_Implicit(0)
  900.       });
  901.       clothes.glassesId = (int) Function.Call<int>((Hash) -8535233825580798760L, new InputArgument[2]
  902.       {
  903.         InputArgument.op_Implicit(handle),
  904.         InputArgument.op_Implicit(1)
  905.       });
  906.       clothes.earsId = (int) Function.Call<int>((Hash) -8535233825580798760L, new InputArgument[2]
  907.       {
  908.         InputArgument.op_Implicit(handle),
  909.         InputArgument.op_Implicit(2)
  910.       });
  911.       clothes.hatTextureId = (int) Function.Call<int>((Hash) -2219814444253832526L, new InputArgument[2]
  912.       {
  913.         InputArgument.op_Implicit(handle),
  914.         InputArgument.op_Implicit(0)
  915.       });
  916.       clothes.glassesTextureId = (int) Function.Call<int>((Hash) -2219814444253832526L, new InputArgument[2]
  917.       {
  918.         InputArgument.op_Implicit(handle),
  919.         InputArgument.op_Implicit(1)
  920.       });
  921.       clothes.earsTextureId = (int) Function.Call<int>((Hash) -2219814444253832526L, new InputArgument[2]
  922.       {
  923.         InputArgument.op_Implicit(handle),
  924.         InputArgument.op_Implicit(2)
  925.       });
  926.       return clothes;
  927.     }
  928.  
  929.     public static void SetClothes(Ped ped, Clothes clothesToSet)
  930.     {
  931.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  932.       {
  933.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  934.         InputArgument.op_Implicit(0),
  935.         InputArgument.op_Implicit(clothesToSet.headId),
  936.         InputArgument.op_Implicit(clothesToSet.headTextureId),
  937.         InputArgument.op_Implicit(0)
  938.       });
  939.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  940.       {
  941.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  942.         InputArgument.op_Implicit(1),
  943.         InputArgument.op_Implicit(clothesToSet.beardId),
  944.         InputArgument.op_Implicit(clothesToSet.beardTextureId),
  945.         InputArgument.op_Implicit(0)
  946.       });
  947.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  948.       {
  949.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  950.         InputArgument.op_Implicit(2),
  951.         InputArgument.op_Implicit(clothesToSet.hairId),
  952.         InputArgument.op_Implicit(clothesToSet.hairTextureId),
  953.         InputArgument.op_Implicit(0)
  954.       });
  955.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  956.       {
  957.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  958.         InputArgument.op_Implicit(3),
  959.         InputArgument.op_Implicit(clothesToSet.torsoId),
  960.         InputArgument.op_Implicit(clothesToSet.torsoTextureId),
  961.         InputArgument.op_Implicit(0)
  962.       });
  963.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  964.       {
  965.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  966.         InputArgument.op_Implicit(4),
  967.         InputArgument.op_Implicit(clothesToSet.legsId),
  968.         InputArgument.op_Implicit(clothesToSet.legsTextureId),
  969.         InputArgument.op_Implicit(0)
  970.       });
  971.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  972.       {
  973.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  974.         InputArgument.op_Implicit(5),
  975.         InputArgument.op_Implicit(clothesToSet.handsId),
  976.         InputArgument.op_Implicit(clothesToSet.handsTextureId),
  977.         InputArgument.op_Implicit(0)
  978.       });
  979.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  980.       {
  981.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  982.         InputArgument.op_Implicit(6),
  983.         InputArgument.op_Implicit(clothesToSet.footId),
  984.         InputArgument.op_Implicit(clothesToSet.footTextureId),
  985.         InputArgument.op_Implicit(0)
  986.       });
  987.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  988.       {
  989.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  990.         InputArgument.op_Implicit(8),
  991.         InputArgument.op_Implicit(clothesToSet.extraParts1Id),
  992.         InputArgument.op_Implicit(clothesToSet.extraParts1TextureId),
  993.         InputArgument.op_Implicit(0)
  994.       });
  995.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  996.       {
  997.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  998.         InputArgument.op_Implicit(9),
  999.         InputArgument.op_Implicit(clothesToSet.extraParts2Id),
  1000.         InputArgument.op_Implicit(clothesToSet.extraParts2TextureId),
  1001.         InputArgument.op_Implicit(0)
  1002.       });
  1003.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  1004.       {
  1005.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1006.         InputArgument.op_Implicit(10),
  1007.         InputArgument.op_Implicit(clothesToSet.masksId),
  1008.         InputArgument.op_Implicit(clothesToSet.masksTextureId),
  1009.         InputArgument.op_Implicit(0)
  1010.       });
  1011.       Function.Call((Hash) 2750315038012726912L, new InputArgument[5]
  1012.       {
  1013.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1014.         InputArgument.op_Implicit(11),
  1015.         InputArgument.op_Implicit(clothesToSet.auxilaryPartsId),
  1016.         InputArgument.op_Implicit(clothesToSet.auxilaryPartsTextureId),
  1017.         InputArgument.op_Implicit(0)
  1018.       });
  1019.       Function.Call((Hash) -7838678542154536097L, new InputArgument[5]
  1020.       {
  1021.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1022.         InputArgument.op_Implicit(0),
  1023.         InputArgument.op_Implicit(clothesToSet.hatId),
  1024.         InputArgument.op_Implicit(clothesToSet.hatTextureId),
  1025.         InputArgument.op_Implicit(true)
  1026.       });
  1027.       Function.Call((Hash) -7838678542154536097L, new InputArgument[5]
  1028.       {
  1029.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1030.         InputArgument.op_Implicit(1),
  1031.         InputArgument.op_Implicit(clothesToSet.glassesId),
  1032.         InputArgument.op_Implicit(clothesToSet.glassesTextureId),
  1033.         InputArgument.op_Implicit(true)
  1034.       });
  1035.       Function.Call((Hash) -7838678542154536097L, new InputArgument[5]
  1036.       {
  1037.         InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1038.         InputArgument.op_Implicit(2),
  1039.         InputArgument.op_Implicit(clothesToSet.earsId),
  1040.         InputArgument.op_Implicit(clothesToSet.earsTextureId),
  1041.         InputArgument.op_Implicit(true)
  1042.       });
  1043.     }
  1044.  
  1045.     public static bool DoClothesMatch(Clothes clothes)
  1046.     {
  1047.       bool flag = false;
  1048.       if (Utilities.GetCurrentClothes() != clothes)
  1049.         flag = false;
  1050.       if (Utilities.GetCurrentClothes() == clothes)
  1051.         flag = true;
  1052.       return flag;
  1053.     }
  1054.  
  1055.     public static bool DoesINIHaveSection(string filePath, string section)
  1056.     {
  1057.       bool flag = false;
  1058.       IniFile iniFile = new IniFile();
  1059.       iniFile.Load(filePath);
  1060.       if (iniFile != null)
  1061.         flag = iniFile.Sections.Contains(section);
  1062.       return flag;
  1063.     }
  1064.  
  1065.     public static string GetCurrentCharacterName()
  1066.     {
  1067.       string str = "";
  1068.       if (Model.op_Equality(((Entity) Game.get_Player().get_Character()).get_Model(), Model.op_Implicit((PedHash) 225514697)))
  1069.         str = "Michael";
  1070.       if (Model.op_Equality(((Entity) Game.get_Player().get_Character()).get_Model(), Model.op_Implicit((PedHash) -1686040670)))
  1071.         str = "Trevor";
  1072.       if (Model.op_Equality(((Entity) Game.get_Player().get_Character()).get_Model(), Model.op_Implicit((PedHash) -1692214353)))
  1073.         str = "Franklin";
  1074.       return str;
  1075.     }
  1076.  
  1077.     public static string GetValueFromIni(string path, string key)
  1078.     {
  1079.       string empty = string.Empty;
  1080.       IniFile iniFile = new IniFile();
  1081.       iniFile.Load(path);
  1082.       if (iniFile != null)
  1083.       {
  1084.         if (iniFile.Sections.Count > 0)
  1085.         {
  1086.           foreach (IniSection section in (IniItemCollection<IniSection>) iniFile.Sections)
  1087.           {
  1088.             if (section.Keys.Contains(key))
  1089.               empty = section.Keys[key].Value;
  1090.             else
  1091.               LogWriter.WriteToLog("Key was not found in -> " + path, true, Utilities.@this, (Exception) null);
  1092.           }
  1093.         }
  1094.       }
  1095.       else
  1096.         LogWriter.WriteToLog("Could not load value from -> " + path, true, Utilities.@this, (Exception) null);
  1097.       return empty;
  1098.     }
  1099.  
  1100.     public static int GetWeaponCount(Ped ped)
  1101.     {
  1102.       int num = 0;
  1103.       foreach (WeaponHash weaponHash in Enum.GetValues(typeof (WeaponHash)))
  1104.       {
  1105.         if (Function.Call<bool>((Hash) -8220001501650343748L, new InputArgument[3]
  1106.         {
  1107.           InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1108.           InputArgument.op_Implicit(weaponHash.GetHashCode()),
  1109.           InputArgument.op_Implicit(false)
  1110.         }) != null && weaponHash != -1569615261)
  1111.           ++num;
  1112.       }
  1113.       return num;
  1114.     }
  1115.  
  1116.     public static int GetBigWeaponCount(Ped ped)
  1117.     {
  1118.       int num = 0;
  1119.       foreach (Utilities.BigWeapons bigWeapons in Enum.GetValues(typeof (Utilities.BigWeapons)))
  1120.       {
  1121.         if (Function.Call<bool>((Hash) -8220001501650343748L, new InputArgument[3]
  1122.         {
  1123.           InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1124.           InputArgument.op_Implicit(bigWeapons.GetHashCode()),
  1125.           InputArgument.op_Implicit(false)
  1126.         }) != null)
  1127.           ++num;
  1128.       }
  1129.       return num;
  1130.     }
  1131.  
  1132.     public static int GetSmallWeaponCount(Ped ped)
  1133.     {
  1134.       int num = 0;
  1135.       foreach (Utilities.SmallWeapons smallWeapons in Enum.GetValues(typeof (Utilities.SmallWeapons)))
  1136.       {
  1137.         if (Function.Call<bool>((Hash) -8220001501650343748L, new InputArgument[3]
  1138.         {
  1139.           InputArgument.op_Implicit(((Entity) ped).get_Handle()),
  1140.           InputArgument.op_Implicit(smallWeapons.GetHashCode()),
  1141.           InputArgument.op_Implicit(false)
  1142.         }) != null)
  1143.           ++num;
  1144.       }
  1145.       return num;
  1146.     }
  1147.  
  1148.     private enum BigWeapons : uint
  1149.     {
  1150.       SniperRifle = 100416529, // 0x05FC3C11
  1151.       FireExtinguisher = 101631238, // 0x060EC506
  1152.       CombatPDW = 171789620, // 0x0A3D4D34
  1153.       HeavySniper = 205991906, // 0x0C472FE2
  1154.       PumpShotgun = 487013001, // 0x1D073A89
  1155.       HeavyShotgun = 984333226, // 0x3AABBBAA
  1156.       Minigun = 1119849093, // 0x42BF8A85
  1157.       GrenadeLauncherSmoke = 1305664598, // 0x4DD2DC56
  1158.       Gusenberg = 1627465347, // 0x61012683
  1159.       CompactRifle = 1649403952, // 0x624FE830
  1160.       HomingLauncher = 1672152130, // 0x63AB0442
  1161.       Railgun = 1834241177, // 0x6D544C99
  1162.       SawnOffShotgun = 2017895192, // 0x7846A318
  1163.       BullpupRifle = 2132975508, // 0x7F229F94
  1164.       Firework = 2138347493, // 0x7F7497E5
  1165.       CombatMG = 2144741730, // 0x7FD62962
  1166.       CarbineRifle = 2210333304, // 0x83BF0278
  1167.       MG = 2634544996, // 0x9D07F764
  1168.       BullpupShotgun = 2640438543, // 0x9D61E50F
  1169.       GrenadeLauncher = 2726580491, // 0xA284510B
  1170.       Musket = 2828843422, // 0xA89CB99E
  1171.       AdvancedRifle = 2937143193, // 0xAF113F99
  1172.       RPG = 2982836145, // 0xB1CA77B1
  1173.       AssaultRifle = 3220176749, // 0xBFEFFF6D
  1174.       SpecialCarbine = 3231910285, // 0xC0A3098D
  1175.       MarksmanRifle = 3342088282, // 0xC734385A
  1176.       AssaultShotgun = 3800352039, // 0xE284C527
  1177.       DoubleBarrelShotgun = 4019527611, // 0xEF951FBB
  1178.       AssaultSMG = 4024951519, // 0xEFE7E2DF
  1179.     }
  1180.  
  1181.     private enum SmallWeapons : uint
  1182.     {
  1183.       VintagePistol = 137902532, // 0x083839C4
  1184.       MicroSMG = 324215364, // 0x13532244
  1185.       Pistol = 453432689, // 0x1B06D571
  1186.       APPistol = 584646201, // 0x22D8FE39
  1187.       SMG = 736523883, // 0x2BE6766B
  1188.       StunGun = 911657153, // 0x3656C8C1
  1189.       FlareGun = 1198879012, // 0x47757124
  1190.       CombatPistol = 1593441988, // 0x5EF9FEC4
  1191.       Pistol50 = 2578377531, // 0x99AEEB3B
  1192.       SNSPistol = 3218215474, // 0xBFD21232
  1193.       Revolver = 3249783761, // 0xC1B3C3D1
  1194.       HeavyPistol = 3523564046, // 0xD205520E
  1195.       MachinePistol = 3675956304, // 0xDB1AA450
  1196.       MarksmanPistol = 3696079510, // 0xDC4DB296
  1197.     }
  1198.   }
  1199. }
  1200.  
  1201.  
  1202. //End of part 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement