Quantcast

Jump to content

» «
Photo

How to create a script which spawn weapon pickup

7 replies to this topic
Zheung Yik
  • Zheung Yik

    Player Hater

  • Members
  • Joined: 02 Jul 2011

#1

Posted 10 April 2015 - 07:49 AM

Title said everything

Jitnaught
  • Jitnaught

    Grass tastes bad

  • Members
  • Joined: 24 Aug 2013
  • United-States

#2

Posted 10 April 2015 - 04:42 PM Edited by LetsPlayOrDy, 10 April 2015 - 04:43 PM.

GTA IV or GTA V?
If IV, .NET Scripthook, C++ Scripthook, or SCOCL?
If .NET, then I believe the function is World.CreateWeaponPickup. I'm currently on my phone so I cannot confirm this.

Zheung Yik
  • Zheung Yik

    Player Hater

  • Members
  • Joined: 02 Jul 2011

#3

Posted 15 April 2015 - 09:18 AM

GTA IV or GTA V?
If IV, .NET Scripthook, C++ Scripthook, or SCOCL?
If .NET, then I believe the function is World.CreateWeaponPickup. I'm currently on my phone so I cannot confirm this.


Gta iv. I will try world.createweaponpickup

But how can I determine the weapon type on the script and the location?

byteMe420
  • byteMe420

    allah akbar!

  • BUSTED!
  • Joined: 02 Jul 2014
  • United-States

#4

Posted 16 April 2015 - 08:56 PM Edited by byteMe420, 16 April 2015 - 10:35 PM.

here i made this a long time ago, you can have it...

void CreateRandomPickupAroundPlayer()
{
    Random random = new Random();
    Pickup pickup = null;
    int pickupSelection = random.Next(0, 3);
    switch (pickupSelection)
    {
        case 0:
            switch (episode == GameEpisode.GTAIV ? (random.Next(0, 9)) : episode == GameEpisode.TBOGT ? (random.Next(0, 2) == 0 ? random.Next(0, 9) : random.Next(9, 18)) : (random.Next(0, 2) == 0 ? random.Next(0, 9) : random.Next(18, 23)))
            {
                case 0: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Handgun_DesertEagle, 500); break;
                case 1: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.SMG_MP5, 500); break;
                case 2: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Shotgun_Baretta, 500); break;
                case 3: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Rifle_M4, 500); break;
                case 4: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Thrown_Grenade, 500); break;
                case 5: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Rifle_M4, 500); break;
                case 6: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Heavy_RocketLauncher, 500); break;
                case 7: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.SniperRifle_M40A1, 500); break;
                case 8: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Thrown_Grenade, 500); break;

                //tbogt
                case 9: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_AdvancedMG, 600); break;
                case 10: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_AdvancedSniper, 600); break;
                case 11: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_AssaultSMG, 600); break;
                case 12: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_ExplosiveShotgun, 600); break;
                case 13: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_GoldenSMG, 600); break;
                case 14: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_GrenadeLauncher, 600); break;
                case 15: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_NormalShotgun, 600); break;
                case 16: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_Pistol44, 600); break;
                case 17: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_StickyBomb, 600); break;

                //tlad
                case 18: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_AssaultShotgun, 600); break;
                case 19: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_Automatic9mm, 600); break;
                case 20: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_GrenadeLauncher, 600); break;
                case 21: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_PipeBomb, 600); break;
                case 22: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_SawedOffShotgun, 600); break;
            }
            break;
        case 1:
            pickup = Pickup.CreatePickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), "CJ_FIRST_AID_PICKUP", PickupType.Weapon);//health
            break;
        case 2:
            pickup = Pickup.CreatePickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), 0x972daa10, PickupType.Weapon);//Armor
            break;
    }
    if (!Game.Exists(pickup)) return;

    Blip blip = pickup.AttachBlip();
    blip.Name = pickupSelection == 0 ? "Weapon" : pickupSelection == 1 ? "Health" : "Armour";
    blip.Color = pickupSelection == 0 ? BlipColor.Orange : pickupSelection == 1 ? BlipColor.LightRed : BlipColor.Cyan;//you can use BlipIcon if you like, I decided to just use colors for some reason
    //pickupList.Add(pickup); pickupBlipList.Add(blip);//you can track what you create by creating lists if you want to refer to them later
}
  • Zheung Yik and alialherk like this

Scrumilation
  • Scrumilation

    Player Hater

  • New Members
  • Joined: 21 Feb 2015
  • Brazil

#5

Posted 17 April 2015 - 04:52 AM

 

here i made this a long time ago, you can have it...

void CreateRandomPickupAroundPlayer()
{
    Random random = new Random();
    Pickup pickup = null;
    int pickupSelection = random.Next(0, 3);
    switch (pickupSelection)
    {
        case 0:
            switch (episode == GameEpisode.GTAIV ? (random.Next(0, 9)) : episode == GameEpisode.TBOGT ? (random.Next(0, 2) == 0 ? random.Next(0, 9) : random.Next(9, 18)) : (random.Next(0, 2) == 0 ? random.Next(0, 9) : random.Next(18, 23)))
            {
                case 0: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Handgun_DesertEagle, 500); break;
                case 1: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.SMG_MP5, 500); break;
                case 2: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Shotgun_Baretta, 500); break;
                case 3: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Rifle_M4, 500); break;
                case 4: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Thrown_Grenade, 500); break;
                case 5: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Rifle_M4, 500); break;
                case 6: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Heavy_RocketLauncher, 500); break;
                case 7: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.SniperRifle_M40A1, 500); break;
                case 8: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.Thrown_Grenade, 500); break;

                //tbogt
                case 9: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_AdvancedMG, 600); break;
                case 10: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_AdvancedSniper, 600); break;
                case 11: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_AssaultSMG, 600); break;
                case 12: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_ExplosiveShotgun, 600); break;
                case 13: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_GoldenSMG, 600); break;
                case 14: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_GrenadeLauncher, 600); break;
                case 15: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_NormalShotgun, 600); break;
                case 16: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_Pistol44, 600); break;
                case 17: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TBOGT_StickyBomb, 600); break;

                //tlad
                case 18: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_AssaultShotgun, 600); break;
                case 19: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_Automatic9mm, 600); break;
                case 20: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_GrenadeLauncher, 600); break;
                case 21: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_PipeBomb, 600); break;
                case 22: pickup = Pickup.CreateWeaponPickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), Weapon.TLAD_SawedOffShotgun, 600); break;
            }
            break;
        case 1:
            pickup = Pickup.CreatePickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), "CJ_FIRST_AID_PICKUP", PickupType.Weapon);//health
            break;
        case 2:
            pickup = Pickup.CreatePickup(Game.LocalPlayer.Character.Position.Around(random.Next(15, 25)).ToGround(), 0x972daa10, PickupType.Weapon);//Armor
            break;
    }
    if (!Game.Exists(pickup)) return;

    Blip blip = pickup.AttachBlip();
    blip.Name = pickupSelection == 0 ? "Weapon" : pickupSelection == 1 ? "Health" : "Armour";
    blip.Color = pickupSelection == 0 ? BlipColor.Orange : pickupSelection == 1 ? BlipColor.LightRed : BlipColor.Cyan;//you can use BlipIcon if you like, I decided to just use colors for some reason
    //pickupList.Add(pickup); pickupBlipList.Add(blip);//you can track what you create by creating lists if you want to refer to them later
}

what are arrays

baby dont hurt me

no more

  • XeClutch likes this

yoloman
  • yoloman

    Crackhead

  • Members
  • Joined: 21 Jul 2014
  • None

#6

Posted 17 April 2016 - 07:18 PM

So this script spawns a random weapon on an random location? And if so, when it spawns the next weapon if you picked up the previous before?

alialherk
  • alialherk

    Alialherk

  • Members
  • Joined: 24 Aug 2016
  • Libya

#7

Posted 05 October 2016 - 06:36 PM Edited by alialherk, 05 October 2016 - 06:36 PM.

ALLAH AKBAR!!!

 

#E


yoloman
  • yoloman

    Crackhead

  • Members
  • Joined: 21 Jul 2014
  • None

#8

Posted 03 December 2016 - 08:50 PM

push




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users