Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Windows.Forms;
- using GTA;
- namespace MOD
- {
- public class NanoSuit : Script
- {
- private SettingsFile settings = null;
- private Vector3 position;
- private Vector3 vehPosition;
- private Vector3 charVelocity;
- private bool Armor, stealth, power, speed, lEnergy, nightVision;
- private double energy, a, b;
- private int armorKey, stealthKey, speedKey, strengthKey, at, qTimer, kTimer, doubleTap, armor1, armor2, armor, aHealth1, aHealth2, newHealth;
- private bool soundEffect;
- public NanoSuit()
- {
- this.settings = SettingsFile.Open("Nanosuit.ini");
- this.doubleTap = this.settings.GetValueInteger("DoubletapSpeed", "Options", 112);
- this.soundEffect = this.settings.GetValueBool("EnableVoice", "Options", true);
- this.Tick += new EventHandler(this.NanoSuit_Tick);
- }
- private void NanoSuit_Tick(object sender, EventArgs e)
- {
- this.position = Player.Character.Position;
- if (GTA.Native.Function.Call<bool>("IS_HUD_PREFERENCE_SWITCHED_ON"))
- {
- GTA.Native.Function.Call("SET_TEXT_DROP_SHADOW", false, 0, 0, 0, 0);
- GTA.Native.Function.Call("SET_TEXT_FONT", 5);
- GTA.Native.Function.Call("SET_TEXT_COLOUR", 0, 180, 240, 200);
- GTA.Native.Function.Call("DISPLAY_TEXT_WITH_NUMBER", 0.95f, 0.89f, "NUMBER", this.energy);
- 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);
- }
- if (this.energy < 100)
- {
- this.a = 0.25;
- this.energy += this.b;
- }
- if (this.energy > 100)
- {
- this.a = 0;
- this.b = 0;
- }
- if (this.energy > 10)
- {
- this.lEnergy = false;
- }
- else
- {
- this.lEnergy = true;
- this.stealth = false;
- this.speed = false;
- this.power = false;
- }
- int kNv = this.settings.GetValueInteger("NightVision", "Keys", 112);
- if (isKeyPressed((Keys)kNv))
- {
- this.nightVision = !this.nightVision;
- }
- if (this.nightVision)
- {
- GTA.Native.Function.Call("DRAW_RECT", 0.5f, 0.5f, 1.0f, 1.0f, 128, 255, 128, 60);
- }
- int keyArmor = this.settings.GetValueInteger("ArmorKey", "Keys", 112);
- if (isKeyPressed((Keys)keyArmor))
- {
- this.armorKey++;
- }
- if (this.armorKey == 1)
- {
- this.kTimer++;
- if (this.kTimer >= this.doubleTap)
- {
- this.armorKey = 0;
- this.kTimer = 0;
- }
- }
- if (this.armorKey == 2)
- {
- this.Armor = !this.Armor;
- if (this.Armor)
- {
- if (this.soundEffect)
- {
- new System.Media.SoundPlayer("armor.wav").Play();
- }
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "MAIMUM ARMOR", 1500, true);
- this.stealth = false;
- this.power = false;
- this.speed = false;
- this.at = 0;
- this.qTimer = 0;
- }
- this.armorKey = 0;
- }
- if (!this.stealth && !this.power && !this.speed && !this.Armor)
- {
- this.Armor = true;
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", 1500, true);
- if (this.soundEffect == true)
- {
- new System.Media.SoundPlayer("armor.wav").Play();
- }
- }
- if (this.Armor == true)
- {
- Player.Character.MakeProofTo(false, true, false, true, true);
- this.qTimer++;
- if (this.qTimer >= 100)
- {
- Player.Character.Armor += 15;
- Player.Character.Health += 10;
- this.qTimer = 0;
- }
- if (this.energy > 10)
- {
- this.at++;
- if (this.at > 3)
- {
- this.armor1 = Player.Character.Armor;
- this.aHealth1 = Player.Character.Health;
- this.at = 1;
- }
- this.aHealth2 = Player.Character.Health;
- this.armor2 = Player.Character.Armor;
- if (this.armor1 > this.armor2)
- {
- this.armor = this.armor1 - this.armor2;
- Player.Character.Armor += (int)(0.6f * this.armor);
- this.energy -= 10;
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 255, 255, 255, 6, 2.5f);
- }
- if (this.aHealth1 > this.aHealth2)
- {
- this.newHealth = (int)(this.aHealth2 + 0.6 * (this.aHealth1 - this.aHealth2));
- if (Player.Character.isDead)
- this.newHealth = 0;
- Player.Character.Health = this.newHealth;
- this.energy -= 10;
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 255, 255, 255, 6, 2.5f);
- }
- }
- if (this.energy < 0)
- this.energy = -this.energy + 1;
- this.energy += this.a;
- }
- else
- {
- Player.Character.MakeProofTo(false, false, false, false, false);
- }
- int keyStealth = this.settings.GetValueInteger("StealthKey", "Keys", 112);
- if (isKeyPressed((Keys)keyStealth))
- this.stealthKey++;
- if (this.stealthKey == 1)
- {
- this.kTimer++;
- if (this.kTimer >= this.doubleTap)
- {
- this.stealthKey = 0;
- this.kTimer = 0;
- }
- }
- if (this.stealthKey == 2)
- {
- this.stealth = !this.stealth;
- if (this.stealth)
- {
- if (this.soundEffect == true)
- new System.Media.SoundPlayer("cloak.wav").Play();
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "CLOAK ENGAGED", 1000, true);
- this.Armor = false;
- this.speed = false;
- this.power = false;
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 0, 0, 200, 10, 10);
- }
- else
- {
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "CLOAK DISABLED", 1000, true);
- this.Armor = true; //enable armor if stealth is off
- if (this.soundEffect == true)
- new System.Media.SoundPlayer("armor.wav").Play();
- }
- this.stealthKey = 0;
- }
- if (this.stealth && this.lEnergy)
- {
- Player.IgnoredByEveryone = true;
- GTA.Native.Function.Call("SET_PED_ALPHA", Player.Character, 80);
- this.energy -= 0.07;
- this.b = 0;
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 0, 0, 200, 4, 1.3f);
- 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"))
- this.energy -= 0.5;
- if (Player.Character.isInVehicle())
- Player.IgnoredByEveryone = false;
- if (this.energy < 10)
- {
- this.stealth = false;
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAl_STRING_NOW", "STRING", "LOW ENERGY. CLOAK DISABLED", 1000, true);
- this.Armor = true;
- }
- if (Player.Character.isShooting)
- {
- GTA.Native.Function.Call("PRINT_SRING_WITH_LITERAL_STRING_NOW", "STRING", "LOW ENERGY, CLOAK DISABLED", 1000, true);
- this.energy = 0;
- }
- if (GTA.Native.Function.Call<bool>("IS_CHAR_DUCKING", Player.Character))
- this.energy += 0.04;
- }
- else
- {
- Player.IgnoredByEveryone = false;
- GTA.Native.Function.Call("SET_PED_ALPHA", Player.Character, 255);
- this.b = 0.05;
- }
- int keySpeed = this.settings.GetValueInteger("SpeedKey", "Keys", 113);
- if (isKeyPressed((Keys)keySpeed))
- this.speedKey++;
- if (this.speedKey == 1)
- {
- this.kTimer++;
- if (this.kTimer >= this.doubleTap)
- {
- this.speedKey = 0;
- this.kTimer = 0;
- }
- }
- if (this.speedKey == 2)
- {
- this.speed = !this.speed;
- if (this.speed)
- {
- if (this.soundEffect)
- new System.Media.SoundPlayer("speed.wav").Play();
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "SPEED MODE ENGAGED", 1000, true);
- this.Armor = false;
- this.stealth = false;
- this.power = false;
- }
- else
- {
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "String", "SPEED MODE DISABLED", 1000, true);
- this.Armor = true;
- if (this.soundEffect)
- {
- new System.Media.SoundPlayer("armor.wav").Play();
- }
- }
- this.speedKey = 0;
- }
- if (this.speed && this.lEnergy)
- {
- GTA.Native.Function.Call("SET_CHAR_MOVE_ANIM_SPEED_MULTIPLIER", Player.Character, 2);
- GTA.Native.Function.Call("SET_CHAR_CLIMB_ANIM_RATE", Player.Character, 2);
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 200, 200, 0, 3, 2.3f);
- 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"))
- {
- this.energy -= 0.60;
- GTA.Native.Function.Call("SET_CHAR_MOVE_ANIM_SPEED_MULTIPLIER", Player.Character, 4);
- GTA.Native.Function.Call("SET_SWIM_SPEED", Player.Character, 8);
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 200, 200, 0, 6, 2.3f);
- }
- if (this.energy < 10)
- {
- this.speed = false;
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "LOW ENERGY. SPEED DISABLED", 1000, true);
- this.Armor = true;
- }
- }
- else
- {
- GTA.Native.Function.Call("SET_CHAR_MOVE_ANIM_SPEED_MULTIPLIER", Player.Character, 1);
- GTA.Native.Function.Call("SET_CHAT_CLIMB_RATE", Player.Character, 1);
- GTA.Native.Function.Call("SET_SWIM_SPEED", Player.Character, 1);
- }
- int keyStrength = this.settings.GetValueInteger("StrengthKey", "Keys", 114);
- if (isKeyPressed((Keys)keyStrength))
- this.strengthKey++;
- if (this.strengthKey == 1)
- {
- this.kTimer++;
- if (this.kTimer >= this.doubleTap)
- {
- this.strengthKey = 0;
- this.kTimer = 0;
- }
- }
- if (this.strengthKey == 2)
- {
- this.power = !this.power;
- if (this.power)
- {
- if (this.soundEffect == true)
- new System.Media.SoundPlayer("strength.wav").Play();
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "STRENGTH MODE ENGAGED", 1000, true);
- this.Armor = false;
- this.speed = false;
- this.stealth = false;
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 10, 10);
- }
- else
- {
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "STRENGTH MODE DISABLED", 1000, true);
- this.Armor = true;
- if (this.soundEffect)
- new System.Media.SoundPlayer("armor.wav").Play();
- }
- this.strengthKey = 0;
- }
- if (this.power && !this.lEnergy)
- {
- Vehicle otherVeh;
- float offsetX, offsetY, offsetZ;
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 5, 2.3f);
- otherVeh = World.GetClosestVehicle(new Vector3(this.position.X, this.position.Y, this.position.Z), 10);
- if (Game.Exists(otherVeh) && Player.Character.isTouching(otherVeh))
- {
- if (Player.Character.isTouching(otherVeh) && Player.Character.isInMeleeCombat)
- {
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 10, 10);
- this.energy -= 30;
- this.vehPosition = otherVeh.Position;
- offsetX = this.vehPosition.X - this.position.X;
- offsetY = this.vehPosition.Y - this.position.Y;
- offsetZ = this.vehPosition.Z - this.position.Z;
- 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);
- otherVeh.EngineHealth = -1;
- Ped card = otherVeh.GetPedOnSeat(VehicleSeat.Driver);
- if (Game.Exists(card))
- card.Health = 0;
- }
- }
- 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"))
- {
- GTA.Native.Function.Call("DRAW_LIGHT_WITH_RANGE", this.position.X, this.position.Y, this.position.Z, 100, 0, 0, 10, 10);
- this.charVelocity = Player.Character.Velocity;
- Player.Character.Velocity = new Vector3(this.charVelocity.X * 1.04f, this.charVelocity.Y * 1.04f, 6);
- this.energy--;
- }
- if (this.energy < 10)
- {
- this.power = false;
- GTA.Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", "LOW ENERGY. STRENGTH DISABLED", 1000, true);
- this.Armor = true;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement