Esempio n. 1
0
        public static async Task PetCompanion()
        {
            int player = API.GetPlayerPed(-1);

            if (API.IsPedInAnyHeli(player))
            {
                Hud.Notification("Don't spawn that poor pet on a heli");
                return;
            }
            else if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (API.GetVehicleDashboardSpeed(vehicle) > 0.1f)
                {
                    Hud.Notification("Player is in a moving vehicle");
                    return;
                }
            }

            var ped = await Peds.Spawn(Config.PetList, 28);

            Companions.Add(ped);
            await Peds.Arm(ped, null);

            API.SetEntityAsNoLongerNeeded(ref ped);
        }
Esempio n. 2
0
        public static async Task PocceCompanion()
        {
            int ped;
            int player = API.GetPlayerPed(-1);

            if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (Vehicles.GetFreeSeat(vehicle, out int seat))
                {
                    var pocce = Config.PocceList[API.GetRandomIntInRange(0, Config.PocceList.Length)];
                    await Common.RequestModel(pocce);

                    ped = API.CreatePedInsideVehicle(vehicle, 26, pocce, seat, true, false);
                }
                else if (API.GetEntitySpeed(vehicle) > 0.1f)
                {
                    Hud.Notification("Player is in a moving vehicle and there are no free seats");
                    return;
                }
                else
                {
                    ped = await Peds.Spawn(Config.PocceList);
                }
            }
            else
            {
                ped = await Peds.Spawn(Config.PocceList);
            }

            Companions.Add(ped);
            await Peds.Arm(ped, Config.WeaponList);

            API.SetEntityAsNoLongerNeeded(ref ped);
        }
Esempio n. 3
0
        public static async Task <int> SpawnNonhuman(uint model)
        {
            if (!API.IsModelAPed(model))
            {
                Common.Notification(Skin.ModelToName(model) + " is not a ped model");
                return(-1);
            }

            int player = API.GetPlayerPed(-1);
            var coords = API.GetEntityCoords(player, true);

            if (API.IsPedInAnyHeli(player))
            {
                Common.Notification("Don't spawn that poor pet on a heli");
                return(-1);
            }
            else if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (API.GetVehicleDashboardSpeed(vehicle) > 0.1f)
                {
                    Common.Notification("Player is in a moving vehicle");
                    return(-1);
                }
            }

            var ped = await Peds.Spawn(model, coords, true, 28);

            Add(ped);
            await Peds.Arm(ped, null);

            return(ped);
        }
Esempio n. 4
0
        public static async Task PedRiot(bool useWeapons)
        {
            int i       = 0;
            var peds    = Peds.Get(Peds.Filter.Dead | Peds.Filter.Players | (useWeapons ? Peds.Filter.Animals : Peds.Filter.None)); // do not include animals when using weapons
            var weapons = useWeapons ? Config.WeaponList : null;

            if (peds.Count < 2)
            {
                return;
            }

            foreach (int ped in peds)
            {
                if (API.IsPedInAnyVehicle(ped, false))
                {
                    var vehicle = API.GetVehiclePedIsIn(ped, false);
                    API.TaskLeaveVehicle(ped, vehicle, 1);
                }

                await Delay(1000); // let them get out of vehicles

                API.ClearPedTasks(ped);

                await Peds.Arm(ped, weapons);

                int enemyPed;
                if (i % 2 == 0)
                {
                    enemyPed = peds[(i + 1) % peds.Count];
                }
                else if (i == peds.Count - 1)
                {
                    enemyPed = peds[0];
                }
                else
                {
                    enemyPed = peds[i - 1];
                }
                API.TaskCombatPed(ped, enemyPed, 0, 16);

                int tmp_ped = ped; API.SetEntityAsNoLongerNeeded(ref tmp_ped);

                ++i;
            }
        }
Esempio n. 5
0
        public static async Task <int> SpawnHuman(uint model)
        {
            if (!API.IsModelAPed(model))
            {
                Common.Notification(Skin.ModelToName(model) + " is not a ped model");
                return(-1);
            }

            int ped;
            int player = API.GetPlayerPed(-1);
            var coords = API.GetEntityCoords(player, true);

            if (API.IsPedInAnyVehicle(player, false))
            {
                var vehicle = API.GetVehiclePedIsIn(player, false);
                if (Vehicles.GetFreeSeat(vehicle, out int seat))
                {
                    await Common.RequestModel(model);

                    ped = API.CreatePedInsideVehicle(vehicle, 26, model, seat, true, false);
                    API.SetModelAsNoLongerNeeded(model);
                }
                else if (API.GetEntitySpeed(vehicle) > 0.1f)
                {
                    Common.Notification("Player is in a moving vehicle and there are no free seats");
                    return(-1);
                }
                else
                {
                    ped = await Peds.Spawn(model, coords, true);
                }
            }
            else
            {
                ped = await Peds.Spawn(model, coords, true);
            }

            Add(ped);
            await Peds.Arm(ped, Config.WeaponList);

            return(ped);
        }
Esempio n. 6
0
        public static async Task PocceRiot(bool useWeapons)
        {
            var peds    = new List <int>();
            var weapons = useWeapons ? Config.WeaponList : null;

            for (int i = 0; i < 4; ++i)
            {
                int ped1 = await Peds.Spawn(Config.PocceList);

                int ped2 = await Peds.Spawn(Config.PocceList);

                peds.Add(ped1);
                peds.Add(ped2);

                await Peds.Arm(ped1, weapons);

                await Peds.Arm(ped2, weapons);

                API.TaskCombatPed(ped1, ped2, 0, 16);
                API.TaskCombatPed(ped2, ped1, 0, 16);
            }

            for (int i = 0; i < 4; ++i)
            {
                int ped = await Peds.Spawn(Config.PocceList);

                peds.Add(ped);
                await Peds.Arm(ped, weapons);

                API.TaskCombatPed(ped, API.GetPlayerPed(-1), 0, 16);
            }

            foreach (int ped in peds)
            {
                int tmp_ped = ped;
                API.SetEntityAsNoLongerNeeded(ref tmp_ped);
            }
        }