Advertisement
LostProphet

NanoSuit

Aug 6th, 2011
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 17.05 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using GTA;
  4.  
  5. namespace MOD
  6. {
  7.     public class NanoSuit : Script
  8.     {
  9.         private SettingsFile settings = null;
  10.  
  11.         private Vector3 position;
  12.         private Vector3 vehPosition;
  13.         private Vector3 charVelocity;
  14.         private bool Armor, stealth, power, speed, lEnergy, nightVision;
  15.         private double energy, a, b;
  16.         private int armorKey, stealthKey, speedKey, strengthKey, at, qTimer, kTimer, doubleTap, armor1, armor2, armor, aHealth1, aHealth2, newHealth;
  17.  
  18.         private bool soundEffect;
  19.  
  20.         public NanoSuit()
  21.         {
  22.             this.settings = SettingsFile.Open("Nanosuit.ini");
  23.             this.doubleTap = this.settings.GetValueInteger("DoubletapSpeed", "Options", 112);
  24.             this.soundEffect = this.settings.GetValueBool("EnableVoice", "Options", true);
  25.  
  26.             this.Tick += new EventHandler(this.NanoSuit_Tick);
  27.         }
  28.  
  29.         private void NanoSuit_Tick(object sender, EventArgs e)
  30.         {
  31.             this.position = Player.Character.Position;
  32.  
  33.             if (GTA.Native.Function.Call<bool>("IS_HUD_PREFERENCE_SWITCHED_ON"))
  34.             {
  35.                 GTA.Native.Function.Call("SET_TEXT_DROP_SHADOW", false, 0, 0, 0, 0);
  36.                 GTA.Native.Function.Call("SET_TEXT_FONT", 5);
  37.                 GTA.Native.Function.Call("SET_TEXT_COLOUR", 0, 180, 240, 200);
  38.                 GTA.Native.Function.Call("DISPLAY_TEXT_WITH_NUMBER", 0.95f, 0.89f, "NUMBER", this.energy);
  39.                 GTA.Native.Function.Call("DRAW_RECT", 0.05f + (float)(0.000625 * this.energy), 0.96f, (float)(0.00125 * this.energy), 0.015f, 0, 180, 240, 200);
  40.             }
  41.  
  42.             if (this.energy < 100)
  43.             {
  44.                 this.a = 0.25;
  45.                 this.energy += this.b;
  46.             }
  47.  
  48.             if (this.energy > 100)
  49.             {
  50.                 this.a = 0;
  51.                 this.b = 0;
  52.             }
  53.  
  54.             if (this.energy > 10)
  55.             {
  56.                 this.lEnergy = false;
  57.             }
  58.             else
  59.             {
  60.                 this.lEnergy = true;
  61.                 this.stealth = false;
  62.                 this.speed = false;
  63.                 this.power = false;
  64.             }
  65.  
  66.             int kNv = this.settings.GetValueInteger("NightVision", "Keys", 112);
  67.  
  68.             if (isKeyPressed((Keys)kNv))
  69.             {
  70.                 this.nightVision = !this.nightVision;
  71.             }
  72.  
  73.             if (this.nightVision)
  74.             {
  75.                 GTA.Native.Function.Call("DRAW_RECT", 0.5f, 0.5f, 1.0f, 1.0f, 128, 255, 128, 60);
  76.             }
  77.  
  78.             int keyArmor = this.settings.GetValueInteger("ArmorKey", "Keys", 112);
  79.  
  80.             if (isKeyPressed((Keys)keyArmor))
  81.             {
  82.                 this.armorKey++;
  83.             }
  84.  
  85.             if (this.armorKey == 1)
  86.             {
  87.                 this.kTimer++;
  88.  
  89.                 if (this.kTimer >= this.doubleTap)
  90.                 {
  91.                     this.armorKey = 0;
  92.                     this.kTimer = 0;
  93.                 }
  94.             }
  95.  
  96.             if (this.armorKey == 2)
  97.             {
  98.                 this.Armor = !this.Armor;
  99.  
  100.                 if (this.Armor)
  101.                 {
  102.                     if (this.soundEffect)
  103.                     {
  104.                         new System.Media.SoundPlayer("armor.wav").Play();
  105.                     }
  106.  
  107.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "MAIMUM ARMOR", 1500, true);
  108.                     this.stealth = false;
  109.                     this.power = false;
  110.                     this.speed = false;
  111.                     this.at = 0;
  112.                     this.qTimer = 0;
  113.                 }
  114.  
  115.                 this.armorKey = 0;
  116.             }
  117.  
  118.             if (!this.stealth && !this.power && !this.speed && !this.Armor)
  119.             {
  120.                 this.Armor = true;
  121.                 GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", 1500, true);
  122.  
  123.                 if (this.soundEffect == true)
  124.                 {
  125.                     new System.Media.SoundPlayer("armor.wav").Play();
  126.                 }
  127.             }
  128.  
  129.             if (this.Armor == true)
  130.             {
  131.                 Player.Character.MakeProofTo(false, true, false, true, true);
  132.                 this.qTimer++;
  133.  
  134.                 if (this.qTimer >= 100)
  135.                 {
  136.                     Player.Character.Armor += 15;
  137.                     Player.Character.Health += 10;
  138.  
  139.                     this.qTimer = 0;
  140.                 }
  141.  
  142.                 if (this.energy > 10)
  143.                 {
  144.                     this.at++;
  145.  
  146.                     if (this.at > 3)
  147.                     {
  148.                         this.armor1 = Player.Character.Armor;
  149.                         this.aHealth1 = Player.Character.Health;
  150.                         this.at = 1;
  151.                     }
  152.  
  153.                     this.aHealth2 = Player.Character.Health;
  154.                     this.armor2 = Player.Character.Armor;
  155.  
  156.                     if (this.armor1 > this.armor2)
  157.                     {
  158.                         this.armor = this.armor1 - this.armor2;
  159.                         Player.Character.Armor += (int)(0.6f * this.armor);
  160.                         this.energy -= 10;
  161.                         GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 255, 255, 255, 6, 2.5f);
  162.                     }
  163.  
  164.                     if (this.aHealth1 > this.aHealth2)
  165.                     {
  166.                         this.newHealth = (int)(this.aHealth2 + 0.6 * (this.aHealth1 - this.aHealth2));
  167.  
  168.                         if (Player.Character.isDead)
  169.                             this.newHealth = 0;
  170.  
  171.                         Player.Character.Health = this.newHealth;
  172.                         this.energy -= 10;
  173.                         GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 255, 255, 255, 6, 2.5f);
  174.                     }
  175.                 }
  176.  
  177.                 if (this.energy < 0)
  178.                     this.energy = -this.energy + 1;
  179.  
  180.                 this.energy += this.a;
  181.             }
  182.             else
  183.             {
  184.                 Player.Character.MakeProofTo(false, false, false, false, false);
  185.             }
  186.  
  187.             int keyStealth = this.settings.GetValueInteger("StealthKey", "Keys", 112);
  188.  
  189.             if (isKeyPressed((Keys)keyStealth))
  190.                 this.stealthKey++;
  191.  
  192.             if (this.stealthKey == 1)
  193.             {
  194.                 this.kTimer++;
  195.  
  196.                 if (this.kTimer >= this.doubleTap)
  197.                 {
  198.                     this.stealthKey = 0;
  199.                     this.kTimer = 0;
  200.                 }
  201.             }
  202.  
  203.             if (this.stealthKey == 2)
  204.             {
  205.                 this.stealth = !this.stealth;
  206.  
  207.                 if (this.stealth)
  208.                 {
  209.                     if (this.soundEffect == true)
  210.                         new System.Media.SoundPlayer("cloak.wav").Play();
  211.  
  212.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "CLOAK ENGAGED", 1000, true);
  213.                     this.Armor = false;
  214.                     this.speed = false;
  215.                     this.power = false;
  216.                     GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 0, 0, 200, 10, 10);
  217.                 }
  218.                 else
  219.                 {
  220.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "CLOAK DISABLED", 1000, true);
  221.                     this.Armor = true; //enable armor if stealth is off
  222.  
  223.                     if (this.soundEffect == true)
  224.                         new System.Media.SoundPlayer("armor.wav").Play();
  225.                 }
  226.  
  227.                 this.stealthKey = 0;
  228.             }
  229.  
  230.             if (this.stealth && this.lEnergy)
  231.             {
  232.                 Player.IgnoredByEveryone = true;
  233.                 GTA.Native.Function.Call("SET_PED_ALPHA", Player.Character, 80);
  234.                 this.energy -= 0.07;
  235.                 this.b = 0;
  236.                 GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 0, 0, 200, 4, 1.3f);
  237.  
  238.                 if (GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "move_melee", "run") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "move_rifle", "sprint") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "move_rpg", "sprint"))
  239.                     this.energy -= 0.5;
  240.  
  241.                 if (Player.Character.isInVehicle())
  242.                     Player.IgnoredByEveryone = false;
  243.  
  244.                 if (this.energy < 10)
  245.                 {
  246.                     this.stealth = false;
  247.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAl_STRING_NOW", "STRING", "LOW ENERGY. CLOAK DISABLED", 1000, true);
  248.                     this.Armor = true;
  249.                 }
  250.  
  251.                 if (Player.Character.isShooting)
  252.                 {
  253.                     GTA.Native.Function.Call("PRINT_SRING_WITH_LITERAL_STRING_NOW", "STRING", "LOW ENERGY, CLOAK DISABLED", 1000, true);
  254.                     this.energy = 0;
  255.                 }
  256.  
  257.                 if (GTA.Native.Function.Call<bool>("IS_CHAR_DUCKING", Player.Character))
  258.                     this.energy += 0.04;
  259.             }
  260.             else
  261.             {
  262.                 Player.IgnoredByEveryone = false;
  263.                 GTA.Native.Function.Call("SET_PED_ALPHA", Player.Character, 255);
  264.                 this.b = 0.05;
  265.             }
  266.  
  267.             int keySpeed = this.settings.GetValueInteger("SpeedKey", "Keys", 113);
  268.  
  269.             if (isKeyPressed((Keys)keySpeed))
  270.                 this.speedKey++;
  271.  
  272.             if (this.speedKey == 1)
  273.             {
  274.                 this.kTimer++;
  275.  
  276.                 if (this.kTimer >= this.doubleTap)
  277.                 {
  278.                     this.speedKey = 0;
  279.                     this.kTimer = 0;
  280.                 }
  281.             }
  282.  
  283.             if (this.speedKey == 2)
  284.             {
  285.                 this.speed = !this.speed;
  286.  
  287.                 if (this.speed)
  288.                 {
  289.                     if (this.soundEffect)
  290.                         new System.Media.SoundPlayer("speed.wav").Play();
  291.  
  292.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "SPEED MODE ENGAGED", 1000, true);
  293.                     this.Armor = false;
  294.                     this.stealth = false;
  295.                     this.power = false;
  296.                 }
  297.                 else
  298.                 {
  299.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "String", "SPEED MODE DISABLED", 1000, true);
  300.                     this.Armor = true;
  301.  
  302.                     if (this.soundEffect)
  303.                     {
  304.                         new System.Media.SoundPlayer("armor.wav").Play();
  305.                     }
  306.                 }
  307.  
  308.                 this.speedKey = 0;
  309.             }
  310.  
  311.             if (this.speed && this.lEnergy)
  312.             {
  313.                 GTA.Native.Function.Call("SET_CHAR_MOVE_ANIM_SPEED_MULTIPLIER", Player.Character, 2);
  314.                 GTA.Native.Function.Call("SET_CHAR_CLIMB_ANIM_RATE", Player.Character, 2);
  315.                 GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 200, 200, 0, 3, 2.3f);
  316.  
  317.                 if (GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", "move_player", "run") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", "move_player", "sprint") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", "move_rifle", "sprint"))
  318.                 {
  319.                     this.energy -= 0.60;
  320.                     GTA.Native.Function.Call("SET_CHAR_MOVE_ANIM_SPEED_MULTIPLIER", Player.Character, 4);
  321.                     GTA.Native.Function.Call("SET_SWIM_SPEED", Player.Character, 8);
  322.                     GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 200, 200, 0, 6, 2.3f);
  323.                 }
  324.  
  325.                 if (this.energy < 10)
  326.                 {
  327.                     this.speed = false;
  328.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "LOW ENERGY. SPEED DISABLED", 1000, true);
  329.                     this.Armor = true;
  330.                 }
  331.             }
  332.             else
  333.             {
  334.                 GTA.Native.Function.Call("SET_CHAR_MOVE_ANIM_SPEED_MULTIPLIER", Player.Character, 1);
  335.                 GTA.Native.Function.Call("SET_CHAT_CLIMB_RATE", Player.Character, 1);
  336.                 GTA.Native.Function.Call("SET_SWIM_SPEED", Player.Character, 1);
  337.             }
  338.  
  339.             int keyStrength = this.settings.GetValueInteger("StrengthKey", "Keys", 114);
  340.  
  341.             if (isKeyPressed((Keys)keyStrength))
  342.                 this.strengthKey++;
  343.  
  344.             if (this.strengthKey == 1)
  345.             {
  346.                 this.kTimer++;
  347.  
  348.                 if (this.kTimer >= this.doubleTap)
  349.                 {
  350.                     this.strengthKey = 0;
  351.                     this.kTimer = 0;
  352.                 }
  353.             }
  354.  
  355.             if (this.strengthKey == 2)
  356.             {
  357.                 this.power = !this.power;
  358.  
  359.                 if (this.power)
  360.                 {
  361.                     if (this.soundEffect == true)
  362.                         new System.Media.SoundPlayer("strength.wav").Play();
  363.  
  364.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "STRENGTH MODE ENGAGED", 1000, true);
  365.                     this.Armor = false;
  366.                     this.speed = false;
  367.                     this.stealth = false;
  368.                     GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 10, 10);
  369.                 }
  370.                 else
  371.                 {
  372.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "STRENGTH MODE DISABLED", 1000, true);
  373.                     this.Armor = true;
  374.  
  375.                     if (this.soundEffect)
  376.                         new System.Media.SoundPlayer("armor.wav").Play();
  377.                 }
  378.  
  379.                 this.strengthKey = 0;
  380.             }
  381.  
  382.             if (this.power && !this.lEnergy)
  383.             {
  384.                 Vehicle otherVeh;
  385.                 float offsetX, offsetY, offsetZ;
  386.                 GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 5, 2.3f);
  387.  
  388.                 otherVeh = World.GetClosestVehicle(new Vector3(this.position.X, this.position.Y, this.position.Z), 10);
  389.  
  390.                 if (Game.Exists(otherVeh) && Player.Character.isTouching(otherVeh))
  391.                 {
  392.                     if (Player.Character.isTouching(otherVeh) && Player.Character.isInMeleeCombat)
  393.                     {
  394.                         GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 10, 10);
  395.                         this.energy -= 30;
  396.                         this.vehPosition = otherVeh.Position;
  397.                         offsetX = this.vehPosition.X - this.position.X;
  398.                         offsetY = this.vehPosition.Y - this.position.Y;
  399.                         offsetZ = this.vehPosition.Z - this.position.Z;
  400.                         GTA.Native.Function.Call("APPLY_FORCE_TO_CAR", otherVeh, 3, 5 * offsetX, 5 * offsetY, 5 * offsetZ, 0.0f, 0.0f, 2.0f, 0, 0, 1, 1);
  401.                         otherVeh.EngineHealth = -1;
  402.                         Ped card = otherVeh.GetPedOnSeat(VehicleSeat.Driver);
  403.  
  404.                         if (Game.Exists(card))
  405.                             card.Health = 0;
  406.                     }
  407.                 }
  408.  
  409.                 if (GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "jump_std", "jump_takeoff_1") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "jump_std", "jump_takeoff_r") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "jump_rifle", "jump_takeoff_r") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "jump_rifle", "jump_takeoff_l") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "jump_std", "jump_on_spot") || GTA.Native.Function.Call<bool>("IS_CHAR_PLAYING_ANIM", Player.Character, "jump_rifle", "jump_on_spot"))
  410.                 {
  411.                     GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 10, 10);
  412.                     this.charVelocity = Player.Character.Velocity;
  413.                     Player.Character.Velocity = new Vector3(this.charVelocity.X * 1.04f, this.charVelocity.Y * 1.04f, 6);
  414.                     this.energy--;
  415.                 }
  416.  
  417.                 if (this.energy < 10)
  418.                 {
  419.                     this.power = false;
  420.                     GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "LOW ENERGY. STRENGTH DISABLED", 1000, true);
  421.                     this.Armor = true;
  422.                 }
  423.             }
  424.         }
  425.     }
  426. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement