Пример #1
0
        public async static void Summon()
        {
            Ped player = Game.Player.Character;

            Screen.ShowNotification("The coroner is on his way to you now!");

            // Van
            Vector3 spawnLocation = new Vector3();
            float   spawnHeading  = 0F;
            int     unusedVar     = 0;

            API.GetNthClosestVehicleNodeWithHeading(player.Position.X, player.Position.Y, player.Position.Z, 80, ref spawnLocation, ref spawnHeading, ref unusedVar, 9, 3.0F, 2.5F);
            await LoadModel((uint)VehicleHash.Burrito3);

            cVanEntity = await World.CreateVehicle(VehicleHash.Burrito3, spawnLocation, spawnHeading);

            cVanEntity.Mods.PrimaryColor      = VehicleColor.MetallicBlack;
            cVanEntity.Mods.LicensePlate      = $"SA C {random.Next(10)}";
            cVanEntity.Mods.LicensePlateStyle = LicensePlateStyle.BlueOnWhite3;

            // Van Blip
            cVanBlip = API.AddBlipForEntity(cVanEntity.Handle);
            API.SetBlipColour(cVanBlip, 40);
            API.BeginTextCommandSetBlipName("STRING");
            API.AddTextComponentString("Coroner");
            API.EndTextCommandSetBlipName(cVanBlip);

            // Driver
            await LoadModel((uint)PedHash.Doctor01SMM);

            cVanPed1 = await World.CreatePed(PedHash.Doctor01SMM, spawnLocation);

            cVanPed1.SetIntoVehicle(cVanEntity, VehicleSeat.Driver);
            cVanPed1.CanBeTargetted = false;

            // Passenger
            await LoadModel((uint)PedHash.Scientist01SMM);

            cVanPed2 = await World.CreatePed(PedHash.Scientist01SMM, spawnLocation);

            cVanPed2.SetIntoVehicle(cVanEntity, VehicleSeat.Passenger);
            cVanPed2.CanBeTargetted = false;

            // Configuration
            Vector3 targetLocation = new Vector3();
            float   targetHeading  = 0F;

            API.GetClosestVehicleNodeWithHeading(player.Position.X, player.Position.Y, player.Position.Z, ref targetLocation, ref targetHeading, 1, 3.0F, 0);
            cVanPed1.Task.DriveTo(cVanEntity, targetLocation, 10F, 20F, 262972);
            eventSpawned = true;
        }
Пример #2
0
        private async static void LawEvent()
        {
            eventSpawned = true;
            int     playerPedId = API.PlayerPedId();
            Vector3 pos         = GetPedCoords(playerPedId);

            Vector3 spawnPos = Vector3.Zero;
            float   spawnHdg = 0F;
            int     unk1     = 0;

            API.GetNthClosestVehicleNodeWithHeading(pos.X, pos.Y, pos.Z, 25, ref spawnPos, ref spawnHdg, ref unk1, 0, 0, 0);

            for (int i = 0; i < 5; i++)
            {
                Lawman spawnedLawman = await CreateLawman(spawnPos, spawnHdg);

                horses.Add(spawnedLawman.Horse);
                peds.Add(spawnedLawman.Ped);
                blips.Add(spawnedLawman.Blip);

                spawnPos += GetEntityForwardVector(spawnedLawman.Ped, 3);
                API.TaskGoToEntity(spawnedLawman.Ped, playerPedId, -1, 15F, 10F, 0F, 0);
            }
        }