public static async Task PetCompanion() { int player = Game.Player.Character.Handle; 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); }
public static async Task PocceCompanion() { int ped; int player = Game.Player.Character.Handle; 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); }
private 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); while (API.IsPedInVehicle(ped, vehicle, false)) { await BaseScript.Delay(100); } } 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; } }
private 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.SetPedAsNoLongerNeeded(ref tmp_ped); } }