Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public void VehicleSpawn(Vector3 position, float heading)
        {
            int maxVehicles = Population.maxVehicles;

            if (IsCityZone(Game.Player.Character.Position))
            {
                maxVehicles = Population.maxVehicles * 2;
            }
            if (((this.vehicleCount < maxVehicles) && ((position != Vector3.Zero) && (Extensions.DistanceBetweenV3(position, this.startingLoc) >= minSpawnDistance))) && (Extensions.DistanceBetweenV3(position, Game.Player.Character.Position) >= minSpawnDistance))
            {
                Vehicle vehicle = Extensions.SpawnVehicle(GetRandomVehicleModel(), position, heading);
                vehicle.EngineHealth = (RandoMath.CachedRandom.Next(0, 100) > 10) ? 0f : 1000f;
                vehicle.DirtLevel    = 14f;
                VehicleDoor[] doors = vehicle.GetDoors();
                int           num3  = 0;
                while (true)
                {
                    if (num3 >= 5)
                    {
                        int item = 0;
                        while (true)
                        {
                            if (item >= 3)
                            {
                                break;
                            }
                            List <int>      theList   = new List <int>();
                            InputArgument[] arguments = new InputArgument[] { vehicle.Handle, item };
                            if (Function.Call <bool>(Hash._0x46E571A0E20D01F1, arguments))
                            {
                                theList.Add(item);
                            }
                            if (theList.Count > 0)
                            {
                                int             randomElementFromList = RandoMath.GetRandomElementFromList <int>(theList);
                                InputArgument[] argumentArray2        = new InputArgument[] { vehicle.Handle, randomElementFromList };
                                Function.Call(Hash._0x9E5B5E4D2CCD2259, argumentArray2);
                            }
                            item++;
                        }
                        break;
                    }
                    VehicleDoor randomElementFromArray = RandoMath.GetRandomElementFromArray <VehicleDoor>(doors);
                    vehicle.OpenDoor(randomElementFromArray, false, true);
                    num3++;
                }
            }
        }