Hidden Extra Scripts - KimonoBoy/SHVDNTutorial-NucleiLite GitHub Wiki

Warp in Spawned

In order to do this script we'll need a variable to hold the value of the checked-state of our checkBoxWarpInSpawned-item and if this variable is true when the itemSpawnVehicle is activated we check an if-statement to see if it's true and if it is - place the Character in the Driver-Seat, Driver-Seat is specified in this Enum-collection VehicleSeat

Procedure

  1. Create a new Variable named isWarpInSpawnedEnabled and place it just beneath your canSuperJump;
        ObjectPool menuPool = new ObjectPool();
        NativeMenu mainMenu = new NativeMenu("NucleiLite", "Main Menu");
        NativeMenu playerMenu = new NativeMenu("NucleiLite", "Player Menu");
        NativeMenu vehicleSpawnerMenu = new NativeMenu("NucleiLite", "Vehicle Spawner Menu");
        NativeMenu weaponsMenu = new NativeMenu("NucleiLite", "Weapons Menu");

        bool canSuperJump = false;
        bool isWarpInSpawnedEnabled = false;
  1. In your CreateVehicleSpawnerMenu()-method Create a NativeCheckboxItem named checkBoxWarpInSpawned that changes the value of the isWarpInSpawnedEnabled-variable
            NativeCheckboxItem warpInSpawnedVehicle = new NativeCheckboxItem("Warp in Spawned", "Place your Character in the Driver Seat of the Vehicle you Spawn!");
            warpInSpawnedVehicle.CheckboxChanged += (sender, args) =>
            {
                isWarpInSpawnedEnabled = warpInSpawnedVehicle.Checked;
            };
            vehicleSpawnerMenu.Add(warpInSpawnedVehicle);
  1. Inside your Vehicle Spawner-loop, create an if-statement inside the activated-event that checks the state of the isWarpInSpawnedEnabled-variable - if it is put the Player in the VehichleSeat.Driver
            foreach(VehicleHash vehicleHash in Enum.GetValues(typeof(VehicleHash)))
            {
                NativeItem itemSpawnVehicle = new NativeItem(vehicleHash.ToString(), $"Spawns a {vehicleHash} right in front of you!");
                itemSpawnVehicle.Activated += (sender, args) =>
                {
                    Ped character = Game.Player.Character;

                    Model vehicleModel = new Model(vehicleHash);
                    vehicleModel.Request();

                    Vehicle vehicle = World.CreateVehicle(vehicleModel, character.Position + character.ForwardVector * 3.0f, character.Heading + 90.0f);

                    vehicleModel.MarkAsNoLongerNeeded();

                    if (isWarpInSpawnedEnabled)
                    {
                        character.SetIntoVehicle(vehicle, VehicleSeat.Driver);
                    }

                    Notification.Show($"Vehicle: {vehicleHash} has been spawned!");
                };
                vehicleSpawnerMenu.Add(itemSpawnVehicle);
            }

image

Shoot Fire-Bullets

This script is similar to the Super Jump Script - we need a Variable to hold the value of whether Fire-Bullets are enabled or not and then inside our Tick we need to check if it is true and if it is call the SetFireAmmoThisFrame()-method, then have our NativeCheckboxItem change the state

Procedure

  1. Create a variable to hold the value - isFireBulletsEnabled
        ObjectPool menuPool = new ObjectPool();
        NativeMenu mainMenu = new NativeMenu("NucleiLite", "Main Menu");
        NativeMenu playerMenu = new NativeMenu("NucleiLite", "Player Menu");
        NativeMenu vehicleSpawnerMenu = new NativeMenu("NucleiLite", "Vehicle Spawner Menu");
        NativeMenu weaponsMenu = new NativeMenu("NucleiLite", "Weapons Menu");

        bool canSuperJump = false;
        bool isWarpInSpawnedEnabled = false;
        bool isFireBulletsEnabled = false;
  1. Create a NativeCheckboxItem called checkBoxShootFireBullets inside your CreateWeaponsMenu()-method that changes the state of the isFireBulletsEnabled-variable, place the checkbox just below your itemGiveAllWeapons()
        private void CreateWeaponsMenu()
        {
            NativeItem itemGiveAllWeapons = new NativeItem("Give All Weapons", "Gives the Player all Weapons.");
            itemGiveAllWeapons.Activated += (sender, args) =>
            {
                Ped character = Game.Player.Character;
                foreach (WeaponHash weaponHash in Enum.GetValues(typeof(WeaponHash)))
                {
                    character.Weapons.Give(weaponHash, 100, false, true);
                    character.Weapons[weaponHash].Ammo = character.Weapons[weaponHash].MaxAmmo;
                }
                Notification.Show("Player gained all weapons with max ammunition.");
            };
            weaponsMenu.Add(itemGiveAllWeapons);

            NativeCheckboxItem checkBoxShootFireBullets = new NativeCheckboxItem("Shoot Fire Bullets", "Ablaze your enemies with fire!");
            checkBoxShootFireBullets.CheckboxChanged += (sender, args) =>
            {
                isFireBulletsEnabled = checkBoxShootFireBullets.Checked;
            };
            weaponsMenu.Add(checkBoxShootFireBullets);
        }
  1. Call the Game.Player.SetFireAmmoThisFrame(); inside your Tick-event, if the isFireBulletsEnabled-variable is true
        private void OnTick(object sender, EventArgs e)
        {
            menuPool.Process();

            if (canSuperJump)
            {
                Game.Player.SetSuperJumpThisFrame();
            }

            if (isFireBulletsEnabled)
            {
                Game.Player.SetFireAmmoThisFrame();
            }
       }

image

image

Never Wanted Script

One thing is to adjust the Wanted Level, but wouldn't it be nice if we could just do whatever we please and never care about the cops - let's make a Never Wanted Script that automatically removes the Player's Wanted Level when he does bad stuff - we also need a variable to hold the Never Wanted-value like we did with Super Jump and Fire Bullets, let's give it a go

Procedure

  1. Create a variable named isNeverWanted
        ObjectPool menuPool = new ObjectPool();
        NativeMenu mainMenu = new NativeMenu("NucleiLite", "Main Menu");
        NativeMenu playerMenu = new NativeMenu("NucleiLite", "Player Menu");
        NativeMenu vehicleSpawnerMenu = new NativeMenu("NucleiLite", "Vehicle Spawner Menu");
        NativeMenu weaponsMenu = new NativeMenu("NucleiLite", "Weapons Menu");

        bool canSuperJump = false;
        bool isWarpInSpawnedEnabled = false;
        bool isFireBulletsEnabled = false;
        bool isNeverWanted = false;
  1. Create a NativeCheckboxItem named checkBoxNeverWanted inside our CreatePlayerMenu()-method, this checkBox changes the state of the isNeverWanted-variable depending on the checkBox-checked state

Note: I've placed mine just below my itemWantedLevel so that the two items are grouped together.

        private void CreatePlayerMenu()
        {
            // Fix Player
            NativeItem itemFixPlayer = new NativeItem("Fix Player", "Restores Player's Health and Armor");
            itemFixPlayer.Activated += (sender, args) =>
            {
                Game.Player.Character.Health = Game.Player.Character.MaxHealth;
                Game.Player.Character.Armor = Game.Player.MaxArmor;
                Notification.Show("Health and Armor Restored!");
            };
            playerMenu.Add(itemFixPlayer);

            // Invincible
            NativeCheckboxItem checkBoxInvincible = new NativeCheckboxItem("Invincible", "Your character can no longer die.");
            checkBoxInvincible.CheckboxChanged += (sender, args) =>
            {
                Game.Player.Character.IsInvincible = checkBoxInvincible.Checked;
                Notification.Show($"Invincible: {Game.Player.Character.IsInvincible}");
            };
            playerMenu.Add(checkBoxInvincible);

            // Wanted Level
            NativeListItem<int> listItemWantedLevel = new NativeListItem<int>("Wanted Level", "Adjust Player's Wanted Level.", 0, 1, 2, 3, 4, 5);
            listItemWantedLevel.ItemChanged += (sender, args) =>
            {
                Game.Player.WantedLevel = args.Object;
            };
            playerMenu.Add(listItemWantedLevel);

            // Never Wanted
            NativeCheckboxItem checkBoxNeverWanted = new NativeCheckboxItem("Never Wanted", "Kill anyone, explode anything, don't mind the cops.");
            checkBoxNeverWanted.CheckboxChanged += (sender, args) =>
            {
                isNeverWanted = checkBoxNeverWanted.Checked;
            };
            playerMenu.Add(checkBoxNeverWanted);

            // Super Jump
            NativeCheckboxItem checkBoxSuperJump = new NativeCheckboxItem("Super Jump", "Allows the Player to Jump higher than a building.");
            checkBoxSuperJump.CheckboxChanged += (sender, args) =>
            {
                canSuperJump = checkBoxSuperJump.Checked;
            };
            playerMenu.Add(checkBoxSuperJump);
        }
  1. In our Tick let's check the condition of the isNeverWanted-variable, if it's true - remove stars else do nothing
        private void OnTick(object sender, EventArgs e)
        {
            menuPool.Process();

            if (canSuperJump)
            {
                Game.Player.SetSuperJumpThisFrame();
            }

            if (isFireBulletsEnabled)
            {
                Game.Player.SetFireAmmoThisFrame();
            }

            if (isNeverWanted && Game.Player.WantedLevel > 0)
            {
                Game.Player.WantedLevel = 0;
            }
        }

Note: We also check with the && - if the current Wanted Level is greater than 0

image

Kill All Peds

This is actually quite simple - we need a keypress and if that key is pressed - kill all peds

Procedure

  1. In your OnKeyDown-method Copy and Paste the following
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.F5)
            {
                mainMenu.Visible = !mainMenu.Visible;                
            }

            if (e.KeyCode == Keys.K && e.Control)
            {
                int numPeds = 0;
                foreach(Ped ped in World.GetAllPeds())
                {
                    if (ped != Game.Player.Character)
                    {
                        ped.Kill();
                        numPeds++;
                    }
                }
                Notification.Show($"You've killed a total of: {numPeds}");
            }
        }
  1. Press CTRL + K and boom

image

⚠️ **GitHub.com Fallback** ⚠️