Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using GTA;
- bool Armor, Stealth, Power, Speed, lEnergy, NightVision, know, kold;;
- int aArmor;
- double aEnergy;
- double a, b;
- int armorkey, stealthkey, speedkey, strengthkey;
- float x, y, z;
- float sx, sy, sz;
- float ovx, ovy, ovz;
- float cx, cy, cz;
- //f32 camx, camy, camz;
- float vehx, vehy, vehz;
- float powx, powy, powz;
- float dpowx, dpowy, dpowz;
- float chead, vhead;
- int at, qTimer, ktimer, doubletap;
- int health, pArmor;
- int armor1, armor2, armor;
- int ahealth1, ahealth2, newhealth;
- namespace MOD
- {
- public class NanoSuit
- {
- public NanoSuit()
- {
- // Give your own name here!
- //SetName("Nanosuit");
- this.Tick += new EventHandler(this.NanoSuit_Tick);
- }
- private void NanoSuit_Tick(object sender, EventArgs e)
- {
- int doubletap = GetPrivateProfileInt("Options", "DoubletapSpeed", 112, "./Nanosuit.ini");
- bool SoundEffect = GetPrivateProfileInt("Options", "EnableVoice", 112, "./Nanosuit.ini");
- Player PlayerIndex = ConvertIntToPlayerIndex(GetPlayerId()); //getting PlayerIndex and PlayerChar for usage in script
- Ped PlayerChar;
- GetPlayerChar(PlayerIndex, &PlayerChar);
- GetCharCoordinates(PlayerChar, &x, &y, &z); //coordinates for easy access
- if (IsHUDPreferenceSwitchedOn() == true)
- {
- SetTextDropshadow(false, 0, 0, 0, 0);
- SetTextFont(5);
- SetTextColour(0, 180, 240, 200); //RGBA
- DisplayTextWithNumber(0.95f, 0.89f, "NUMBER", aEnergy);
- f32 tempn1 = 0.05f + (0.000625 * aEnergy);
- f32 tempn2 = (0.00125 * aEnergy);
- DrawRect(tempn1, 0.96f, tempn2, 0.015f, 0, 180, 240, 200);
- }
- if (aEnergy < 100)
- {
- a = 0.25;
- aEnergy = aEnergy + b;
- }
- if (aEnergy > 100)
- {
- a = 0;
- b = 0;
- }
- if (aEnergy > 10)
- {
- lEnergy = false;
- }
- else
- {
- lEnergy = true;
- Stealth = false;
- Speed = false;
- Power = false;
- }
- /*if ((GetKeyState(VK_MBUTTON)& 1) != 0) //Suit menu
- {
- PrintStringWithLiteralStringNow("STRING", "ACCESSING SUIT MENU", 1000, true);
- SetTextFont(1);
- SetTextColour(90, 250, 90, 100);
- DisplayTextWithLiteralString(0.5f, 0.5f, "STRING", "MENU");
- SetTextFont(1);
- SetTextColour(90, 250, 90, 100);
- DisplayTextWithLiteralString(0.5f, 0.7f, "STRING", "Armor");
- SetTextFont(1);
- SetTextColour(90, 250, 90, 100);
- DisplayTextWithLiteralString(0.5f, 0.3f, "STRING", "Strength");
- SetTextFont(1);
- SetTextColour(90, 250, 90, 100);
- DisplayTextWithLiteralString(0.3f, 0.5f, "STRING", "Cloak");
- SetTextFont(1);
- SetTextColour(90, 250, 90, 100);
- DisplayTextWithLiteralString(0.7f, 0.5f, "STRING", "Speed");
- SetCameraControlsDisabledWithPlayerControls(true);
- SetPlayerControl(PlayerIndex, false);
- //xPos = GET_X_LPARAM(lParam);
- //yPos = GET_Y_LPARAM(lParam);
- }
- else
- {
- SetCameraControlsDisabledWithPlayerControls(false);
- SetPlayerControl(PlayerIndex, true);
- }*/
- int kNv = GetPrivateProfileInt("Keys", "NightVision", 112, "./Nanosuit.ini");
- if (IsGameKeyboardKeyJustPressed(kNv))
- {
- this.NightVision = !this.NightVision;
- }
- //cube = MODEL_CJ_GAME_CUBE_4;
- //Object box;
- if (NightVision)// && ((DoesObjectExist(box)&1) == false))
- {
- DrawRect(0.5f, 0.5f, 1.0f, 1.0f, 128, 255, 128, 60);
- /*Camera cam;
- GetGameCam(&cam);
- GetCamPos(cam, &camx, &camy, &camz);
- RequestModel(cube);
- CreateObject(cube, camx, camy, camz, &box, true);*/
- }
- /*if (NightVision != true)
- {
- if (DoesObjectExist(box))
- {
- DeleteObject(&box);
- }
- }*/
- int kArmor = GetPrivateProfileInt("Keys", "ArmorKey", 112, "./Nanosuit.ini");
- if (IsGameKeyboardKeyJustPressed(kArmor))
- {
- armorkey++;
- }
- if (armorkey == 1)
- {
- ktimer++;
- //DisplayTextWithNumber(0.8f, 0.2f, "NUMBER", ktimer);
- if (ktimer >= doubletap)
- {
- armorkey = 0;
- ktimer = 0;
- }
- }
- if (armorkey == 2)
- {
- Armor = !Armor;
- if (Armor)
- {
- if (SoundEffect)
- {
- PlaySound("armor.wav", NULL, SND_FILENAME | SND_ASYNC);
- }
- PrintStringWithLiteralStringNow("STRING", "MAXIMUM ARMOR", 1500, true);
- Stealth = false;
- Power = false;
- Speed = false;
- at = 0;
- qTimer = 0;
- }
- armorkey = 0;
- }
- if (!Stealth && !Power && !Speed && !Armor)
- {
- Armor = true;
- PrintStringWithLiteralStringNow("STRING", "MAXIMUM ARMOR", 1500, true);
- if(SoundEffect == true)
- {
- PlaySound(TEXT("armor.wav"), NULL, SND_FILENAME | SND_ASYNC);
- }
- }
- if (Armor == true)
- {
- SetCharProofs(PlayerChar, false, true, false, true, true);
- qTimer = qTimer + 1;
- if (qTimer >= 100) //timert
- {
- AddArmourToChar(PlayerChar,15); //add armour to char
- GetCharHealth(PlayerChar, &health);
- health = health + 10; //add health
- SetCharHealth(PlayerChar, health);
- qTimer = 0;
- }
- if (aEnergy > 10)
- {
- at = at + 1;
- if (at > 3)
- {
- GetCharArmour(PlayerChar, &armor1);
- GetCharHealth(PlayerChar, &ahealth1);
- at = 1;
- }
- GetCharHealth(PlayerChar, &ahealth2);
- GetCharArmour(PlayerChar, &armor2);
- if (armor1 > armor2)
- {
- armor = armor1-armor2;
- AddArmourToChar(PlayerChar, int(0.6*armor));
- aEnergy = aEnergy - 10;
- DrawLightWithRange(x, y, z, 255, 255, 255, 6, 2.5f);
- }
- if (ahealth1 > ahealth2)
- {
- newhealth = int(ahealth2 + 0.6 * (ahealth1 - ahealth2));
- if (IsPlayerDead(PlayerIndex) == true)
- {
- newhealth = 0;
- }
- SetCharHealth(PlayerChar, newhealth);
- aEnergy = aEnergy - 10;
- DrawLightWithRange(x, y, z, 255, 255, 255, 6, 2.5f);
- }
- }
- if (aEnergy < 0)
- {
- aEnergy = -aEnergy + 1;
- }
- aEnergy = aEnergy + a;
- }
- else
- {
- SetCharProofs(PlayerChar, false, false, false, false, false);
- }
- int kStealth = GetPrivateProfileInt(TEXT("Keys"),TEXT("StealthKey"),112,TEXT("./Nanosuit.ini"));
- if (IsGameKeyboardKeyJustPressed(kStealth))
- {
- stealthkey++;
- }
- if (stealthkey == 1)
- {
- ktimer++;
- //DisplayTextWithNumber(0.8f,0.2f,"NUMBER",int(ktimer));
- if (ktimer >= doubletap)
- {
- stealthkey = 0;
- ktimer = 0;
- }
- }
- if (stealthkey == 2)
- {
- Stealth = !Stealth;
- if(Stealth)
- {
- if(SoundEffect == true)
- {
- PlaySound(TEXT("cloak.wav"), NULL, SND_FILENAME | SND_ASYNC);
- }
- PrintStringWithLiteralStringNow("STRING", "CLOAK ENGAGED", 1000, true);
- Armor = false; //disable other modes
- Speed = false;
- Power = false;
- DrawLightWithRange(x, y, z, 0, 0, 200, 10, 10);
- }
- else
- {
- PrintStringWithLiteralStringNow("STRING", "CLOAK DISABLED", 1000, true);
- Armor = true; //enable armor if stealth is off
- if(SoundEffect == true)
- {
- PlaySound(TEXT("armor.wav"), NULL, SND_FILENAME | SND_ASYNC);
- }
- }
- stealthkey = 0;
- }
- if ((Stealth == true) && (lEnergy == false)) //won't enable stealth if energy is low
- {
- SetEveryoneIgnorePlayer(PlayerIndex, 1); //everybody ignores player
- SetPedAlpha(PlayerChar, 80); //nice to see character not disappearing, but also not visible.
- aEnergy = aEnergy - 0.07; //in cloak mode, energy will decrease
- b = 0; //don't add energy anymore. it's in here because only this mode needs constant energy
- DrawLightWithRange(x, y, z, 0, 0, 200, 4, 1.3f);
- if (IsCharPlayingAnim(PlayerChar, "move_melee", "run") || IsCharPlayingAnim(PlayerChar, "move_rifle", "sprint") || IsCharPlayingAnim(PlayerChar, "move_rpg", "sprint")) //if running
- {
- aEnergy = aEnergy - 0.5; //increase energy decrease
- }
- if (IsCharInAnyCar(PlayerChar) == true) //if in car
- {
- SetEveryoneIgnorePlayer(PlayerIndex, 0); //player won't be ignored anymore
- }
- if (AreAnyCharsNearChar(PlayerChar, 5))
- {
- }
- if (aEnergy < 10) //if energy is low
- {
- Stealth = false; //disable stealth mode
- PrintStringWithLiteralStringNow("STRING", "LOW ENERGY. CLOAK DISABLED", 1000, true);
- Armor = true; //re-enable armor
- }
- if (IsCharShooting(PlayerChar) == true) //if shooting
- {
- PrintStringWithLiteralStringNow("STRING", "LOW ENERGY. CLOAK DISABLED", 1000, true);
- aEnergy = 0; //all energy drained
- }
- if (IsCharDucking(PlayerChar) == true) //if crouching
- {
- aEnergy = aEnergy + 0.04;
- }
- }
- else
- {
- SetEveryoneIgnorePlayer(PlayerIndex, 0); //not ignored
- SetPedAlpha(PlayerChar, 255); //vully visible
- b = 0.05; //set added energy to this
- }
- int kSpeed = GetPrivateProfileInt(TEXT("Keys"),TEXT("SpeedKey"),113,TEXT("./Nanosuit.ini"));
- if (IsGameKeyboardKeyJustPressed(kSpeed))
- {
- speedkey = speedkey + 1;
- }
- if (speedkey == 1)
- {
- ktimer++;
- //DisplayTextWithNumber(0.8f,0.2f,"NUMBER",int(ktimer));
- if (ktimer >= doubletap)
- {
- speedkey = 0;
- ktimer = 0;
- }
- }
- if (speedkey == 2)
- {
- Speed = !Speed;
- //Speed = true;
- if(Speed)
- {
- if(SoundEffect == true)
- {
- PlaySound(TEXT("speed.wav"), NULL, SND_FILENAME | SND_ASYNC);
- }
- PrintStringWithLiteralStringNow("STRING", "SPEED MODE ENGAGED", 1000, true);
- Armor = false;
- Stealth = false;
- Power = false;
- }
- else
- {
- PrintStringWithLiteralStringNow("STRING", "SPEED MODE DISABLED", 1000, true);
- Armor = true;
- if(SoundEffect == true)
- {
- PlaySound(TEXT("armor.wav"), NULL, SND_FILENAME | SND_ASYNC);
- }
- }
- speedkey = 0;
- }
- if ((Speed == true) && (lEnergy == false))
- {
- SetCharMoveAnimSpeedMultiplier(PlayerChar, 2.0f); //animation speed for moving is 2x
- SetCharClimbAnimRate(PlayerChar, 2.0f); //vaulting is also faster
- DrawLightWithRange(x, y, z, 200, 200, 0, 3, 2.3f);
- /*if (IsCharInWater(PlayerChar) == true)
- {
- SetSwimSpeed(PlayerChar, 4.0);
- f32 wx, wy, wz;
- f32 wx2, wy2;
- GetCharVelocity(PlayerChar, &wx, &wy, &wz);
- if (wx < 20)
- {
- wx2 = wx+wx;
- wy2 = wy+wy;
- }
- if (wx == 20) //otherwise Niko will go faster than light and your computer become a black hole
- {
- wx2 = wx-0.5*wx;
- wy2 = wy-0.5*wy;
- }
- SetCharVelocity(PlayerChar, wx2, wy2, wz);
- }*/
- if (IsCharPlayingAnim(PlayerChar, "move_player", "run") || IsCharPlayingAnim(PlayerChar, "move_player", "sprint") || IsCharPlayingAnim(PlayerChar, "move_rifle", "sprint") || IsCharPlayingAnim(PlayerChar, "move_rpg", "sprint"))
- {
- aEnergy = aEnergy - 0.60; //set energy decrease
- SetCharMoveAnimSpeedMultiplier(PlayerChar, 4.0f); //even faster anims
- SetSwimSpeed(PlayerChar, 8.0);
- DrawLightWithRange(x, y, z, 200, 200, 0, 6, 2.3f);
- }
- if (aEnergy < 10)
- {
- Speed = false;
- PrintStringWithLiteralStringNow("STRING", "LOW ENERGY. SPEED DISABLED", 1000, true);
- Armor = true;
- }
- }
- else //reset everything
- {
- SetCharMoveAnimSpeedMultiplier(PlayerChar, 1.0f);
- SetCharClimbAnimRate(PlayerChar, 1.0f);
- SetSwimSpeed(PlayerChar, 1.0);
- }
- int kStrength = GetPrivateProfileInt(TEXT("Keys"),TEXT("StrengthKey"),114,TEXT("./Nanosuit.ini"));
- if (IsGameKeyboardKeyJustPressed(kStrength))
- {
- strengthkey++;
- }
- if (strengthkey == 1)
- {
- ktimer++;
- //DisplayTextWithNumber(0.8f,0.2f,"NUMBER",int(ktimer));
- if (ktimer >= doubletap)
- {
- strengthkey = 0;
- ktimer = 0;
- }
- }
- if (strengthkey == 2)
- {
- Power = !Power;
- if(Power)
- {
- if(SoundEffect == true)
- {
- PlaySound(TEXT("strength.wav"), NULL, SND_FILENAME | SND_ASYNC);
- }
- PrintStringWithLiteralStringNow("STRING", "STRENGTH MODE ENGAGED", 1000, true);
- Armor = false;
- Speed = false;
- Stealth = false;
- DrawLightWithRange(x, y, z, 100, 0, 0, 10, 10);
- }
- else
- {
- PrintStringWithLiteralStringNow("STRING", "STRENGTH MODE DISABLED", 1000, true);
- Armor = true;
- if(SoundEffect == true)
- {
- PlaySound(TEXT("armor.wav"), NULL, SND_FILENAME | SND_ASYNC);
- }
- }
- strengthkey = 0;
- }
- if ((Power == true) && (lEnergy == false))
- {
- Ped otherChar;
- Vehicle otherVeh;
- f32 offsetX, offsetY, offsetZ;
- DrawLightWithRange(x, y, z, 100, 0, 0, 5, 2.3f);
- otherVeh = GetClosestCar(x, y, z, 10.0f, true, 70); //get closest car
- if ( (DoesVehicleExist(otherVeh) == true) && (IsCharTouchingVehicle(PlayerChar, otherVeh) == true)) //if vehicle exists and is in range and if player is touching it
- {
- if ( (IsCharTouchingVehicle(PlayerChar, otherVeh) == true) && ((IsCharInMeleeCombat(PlayerChar)& 1) == true) ) //check for player in melee
- {
- DrawLightWithRange(x, y, z, 100, 0, 0, 10, 10);
- aEnergy = aEnergy - 30; //energy decrease
- //SetCarHeading(otherVeh, 0);
- GetCarCoordinates(otherVeh, &vehx, &vehy, &vehz); //getting car coords
- offsetX = vehx-x;
- offsetY = vehy-y;
- offsetZ = vehz-z;
- //ApplyForceToCar(otherVeh, 3, 10*offsetX, 10*offsetY, 10*offsetZ, rotx, roty, rotz, 0, vehicle heading in consideration, 1, 1);
- ApplyForceToCar(otherVeh, 3, 5*offsetX, 5*offsetY, 5*offsetZ, 0.0f, 0.0f, 2.0f, 0, 0, 1, 1);
- //SetCarHealth(otherVeh, 0);
- //SetPetrolTankHealth(otherVeh, 0);
- SetEngineHealth(otherVeh, -1.0f);
- Ped card, carp0, carp1, carp2;
- GetDriverOfCar(otherVeh, &card);
- if (DoesCharExist(card))
- {
- SetCharHealth(card, 0);
- }
- }
- }
- /*if (IsCharPlayingAnim(PlayerChar, "throw_grenade", "grenade_throw_short"))
- {
- //eWeapon weaponinhand;
- //GetCurrentCharWeapon(PlayerChar, &weaponinhand);
- //if ((weaponinhand == 4) || (weaponinhand == 5))
- //{
- //}
- Object obj;
- obj = GetObjectPedIsHolding(PlayerChar);
- //if (DoesObjectExist(obj))
- //{
- Wait(200);
- f32 ox, oy, oz, difx, dify, difz;
- GetObjectCoordinates(obj, &ox, &oy, &oz);
- difx = ox-x;
- dify = oy-y;
- difz = oz-z;
- ApplyForceToObject(obj, 3, 50*ox, 50*oy, 50*oz, 0, 0, 0, 0, 0, 1, 1);
- aEnergy = aEnergy - 10;
- //}
- }*/
- if (IsCharPlayingAnim(PlayerChar, "jump_std", "jump_takeoff_l") || IsCharPlayingAnim(PlayerChar, "jump_std", "jump_takeoff_r") || IsCharPlayingAnim(PlayerChar, "jump_rifle", "jump_takeoff_r") || IsCharPlayingAnim(PlayerChar, "jump_rifle", "jump_takeoff_l") || IsCharPlayingAnim(PlayerChar, "jump_std", "jump_on_spot")
- || IsCharPlayingAnim(PlayerChar, "jump_rifle", "jump_on_spot"))
- {
- DrawLightWithRange(x, y, z, 100, 0, 0, 10, 10);
- GetCharVelocity(PlayerChar, &ovx, &ovy, &ovz);
- //ovx = ovx*0.84f;
- //ovy = ovy*0.84f;
- SetCharVelocity(PlayerChar, 1.04f*ovx, 1.04f*ovy, 6.0f); // add upward speed + speed maintained during flight.
- aEnergy = aEnergy - 1; //decrease energy
- }
- if (aEnergy < 10)
- {
- Power = false;
- PrintStringWithLiteralStringNow("STRING", "LOW ENERGY. STRENGTH DISABLED", 1000, true);
- Armor = true;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement