コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
ファイル: Companions.cs プロジェクト: razzie/PocceMod
        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);
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: 0xt0b3r/PocceMod
        public static async Task SpawnTrashPed()
        {
            var ped = await Peds.Spawn(Config.TrashPedList);

            TriggerServerEvent("PocceMod:Burn", API.PedToNet(ped));
            API.SetEntityAsNoLongerNeeded(ref ped);
        }
コード例 #5
0
        public static async Task SpawnTrashPed()
        {
            var ped = await Peds.Spawn(Config.TrashPedList);

            await Delay(500);

            Common.Burn(ped);
            API.SetEntityAsNoLongerNeeded(ref ped);
        }
コード例 #6
0
ファイル: Companions.cs プロジェクト: razzie/PocceMod
        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);
        }
コード例 #7
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);
            }
        }