Exemple #1
0
        public ZombiePed ZombieSpawn(Vector3 pos)
        {
            ZombiePed ped;
            int       maxZombies = Population.maxZombies;

            if (IsCityZone(Game.Player.Character.Position))
            {
                maxZombies = Population.maxZombies * 2;
            }
            if (((this.zombieCount >= maxZombies) || ((pos == Vector3.Zero) || (Extensions.DistanceBetweenV3(pos, this.startingLoc) < minSpawnDistance))) || (Extensions.DistanceBetweenV3(pos, Game.Player.Character.Position) < minSpawnDistance))
            {
                ped = null;
            }
            else
            {
                Ped ped;
                if (!customZombies)
                {
                    ped = World.CreateRandomPed(pos);
                }
                else
                {
                    Model model = new Model(RandoMath.GetRandomElementFromList <string>(ZombieModels));
                    ped = World.CreatePed(model, pos);
                }
                Infect(ped);
                ZombiePed objA = zombieList.Find(a => a.pedEntity == ped);
                ped = !ReferenceEquals(objA, null) ? objA : null;
            }
            return(ped);
        }
Exemple #2
0
 public void Update()
 {
     for (int i = 0; i < zombieList.Count; i++)
     {
         if ((!zombieList[i].pedEntity.IsAlive || (Extensions.DistanceBetween(zombieList[i].pedEntity, Game.Player.Character) > maxSpawnDistance)) || (zombieList[i].pedEntity == null))
         {
             zombieList.RemoveAt(i);
         }
         else
         {
             ZombiePed local1 = zombieList[i];
             local1.ticksSinceLastUpdate++;
             if (zombieList[i].ticksSinceLastUpdate >= zombieList[i].ticksBetweenUpdates)
             {
                 zombieList[i].Update();
                 zombieList[i].ticksSinceLastUpdate = 0;
             }
         }
     }
 }
Exemple #3
0
        public static Ped Infect(Ped ped)
        {
            ped.Task.ClearAllImmediately();
            ped.Weapons.Drop();
            ped.LeaveGroup();
            ped.RelationshipGroup    = Relationships.ZombieGroup;
            ped.BlockPermanentEvents = true;
            InputArgument[] arguments = new InputArgument[] { ped.Handle, 0x2e, true };
            Function.Call(Hash._0x9F7794730795E019, arguments);
            InputArgument[] argumentArray2 = new InputArgument[] { ped.Handle, "BigHitByVehicle", 0, 1 };
            Function.Call(Hash._0x46DF918788CB093F, argumentArray2);
            InputArgument[] argumentArray3 = new InputArgument[] { ped.Handle, "HOSPITAL_8", 0, 1 };
            Function.Call(Hash._0x46DF918788CB093F, argumentArray3);
            InputArgument[] argumentArray4 = new InputArgument[] { ped.Handle, "HOSPITAL_9", 0, 1 };
            Function.Call(Hash._0x46DF918788CB093F, argumentArray4);
            InputArgument[] argumentArray5 = new InputArgument[] { ped.Handle, "Explosion_Med", 0, 1 };
            Function.Call(Hash._0x46DF918788CB093F, argumentArray5);
            ped.CanPlayGestures = false;
            InputArgument[] argumentArray6 = new InputArgument[] { ped.Handle, false };
            Function.Call(Hash._0x6373D1349925A70E, argumentArray6);
            InputArgument[] argumentArray7 = new InputArgument[] { ped.Handle, false };
            Function.Call(Hash._0x0EB0585D15254740, argumentArray7);
            InputArgument[] argumentArray8 = new InputArgument[] { ped.Handle, false };
            Function.Call(Hash._0x77A5B103C87F476E, argumentArray8);
            InputArgument[] argumentArray9 = new InputArgument[] { ped.Handle, false };
            Function.Call(Hash._0x6B7A646C242A7059, argumentArray9);
            InputArgument[] argumentArray10 = new InputArgument[] { ped.Handle, true };
            Function.Call(Hash._0x38FE1EC73743793C, argumentArray10);
            InputArgument[] argumentArray11 = new InputArgument[] { ped.Handle, true };
            Function.Call(Hash._0x4455517B28441E60, argumentArray11);
            InputArgument[] argumentArray12 = new InputArgument[] { ped.Handle, 0 };
            Function.Call(Hash._0xDBA71115ED9941A6, argumentArray12);
            InputArgument[] argumentArray13 = new InputArgument[] { ped.Handle, 0, 0 };
            Function.Call(Hash._0x70A2D1137C8ED7C9, argumentArray13);
            ped.DrownsInWater        = true;
            ped.DiesInstantlyInWater = true;
            InputArgument[] argumentArray14 = new InputArgument[] { ped.Handle };
            if (Function.Call <bool>(Hash._0x9072C8B49907BFAD, argumentArray14))
            {
                InputArgument[] argumentArray15 = new InputArgument[] { ped.Handle };
                Function.Call(Hash._0xB8BEC0CA6F0EDB0F, argumentArray15);
            }
            InputArgument[] argumentArray16 = new InputArgument[] { ped.Handle, 1 };
            Function.Call(Hash._0x9D64D7405520E3D3, argumentArray16);
            InputArgument[] argumentArray17 = new InputArgument[] { ped.Handle, true };
            Function.Call(Hash._0xA9A41C1E940FB0E8, argumentArray17);
            int      num            = 0;
            TimeSpan currentDayTime = World.CurrentDayTime;

            num = ((currentDayTime.Hours < 20) && (currentDayTime.Hours > 3)) ? RandoMath.CachedRandom.Next(0, 50) : RandoMath.CachedRandom.Next(0, 100);
            bool flag = false;

            if (!zombieRunners)
            {
                num = 100;
            }
            if (num <= 10)
            {
                flag = true;
                InputArgument[] argumentArray18 = new InputArgument[] { "move_m@injured" };
                if (!Function.Call <bool>(Hash._0xC4EA073D86FB29B0, argumentArray18))
                {
                    InputArgument[] argumentArray19 = new InputArgument[] { "move_m@injured" };
                    Function.Call(Hash._0x6EA47DAE7FAD0EED, argumentArray19);
                }
                InputArgument[] argumentArray20 = new InputArgument[] { ped.Handle, "move_m@injured", 0x3e800000 };
                Function.Call(Hash._0xAF8A94EDE7712BEF, argumentArray20);
                InputArgument[] argumentArray21 = new InputArgument[] { ped.Handle, true };
                Function.Call(Hash._0x8E06A6FE76C9EFF4, argumentArray21);
            }
            else
            {
                flag = false;
                InputArgument[] argumentArray22 = new InputArgument[] { "move_m@drunk@verydrunk" };
                if (!Function.Call <bool>(Hash._0xC4EA073D86FB29B0, argumentArray22))
                {
                    InputArgument[] argumentArray23 = new InputArgument[] { "move_m@drunk@verydrunk" };
                    Function.Call(Hash._0x6EA47DAE7FAD0EED, argumentArray23);
                }
                InputArgument[] argumentArray24 = new InputArgument[] { ped.Handle, "move_m@drunk@verydrunk", 0x3e800000 };
                Function.Call(Hash._0xAF8A94EDE7712BEF, argumentArray24);
                InputArgument[] argumentArray25 = new InputArgument[] { ped.Handle, false };
                Function.Call(Hash._0x8E06A6FE76C9EFF4, argumentArray25);
            }
            ped.CanWrithe = false;
            ped.MaxHealth = zombieHealth;
            ped.Health    = ped.MaxHealth;
            ped.Armor     = 0;
            ped.Money     = 0;
            InputArgument[] argumentArray26 = new InputArgument[] { ped.Handle, 150f };
            Function.Call(Hash._0xF29CF591C4BF6CEE, argumentArray26);
            InputArgument[] argumentArray27 = new InputArgument[] { ped.Handle, 300f };
            Function.Call(Hash._0x33A8F7F7D5F7F33C, argumentArray27);
            ped.AlwaysDiesOnLowHealth = false;
            ped.AlwaysKeepTask        = true;
            ZombiePed item  = new ZombiePed(ped);
            bool      flag2 = false;
            int       num2  = 0;

            while (true)
            {
                if (num2 < zombieList.Count)
                {
                    if (zombieList[num2].pedEntity != null)
                    {
                        num2++;
                        continue;
                    }
                    zombieList[num2].AttachData(ped);
                    zombieList[num2].isRunner = flag;
                    item  = zombieList[num2];
                    flag2 = true;
                }
                if (flag2)
                {
                    UI.Notify("Zombie not added to list");
                }
                else
                {
                    zombieList.Add(item);
                    zombieList[zombieList.Count - 1].isRunner = flag;
                }
                return(ped);
            }
        }