internal static async Task MoveTraffic() { int veh = API.GetClosestVehicle(Game.PlayerPed.CurrentVehicle.Position.X, Game.PlayerPed.CurrentVehicle.Position.Y, Game.PlayerPed.CurrentVehicle.Position.Z, 50f, 0, 70); API.TaskVehicleTempAction(Ped.FromHandle(API.GetPedInVehicleSeat(veh, -1)).Handle, veh, 32, 1000); Screen.ShowNotification("Move Bitch Get out the way"); }
public string GetPedInjuries(int pedHandle) { var ped = Ped.FromHandle(pedHandle); string str = ""; if (ped.Exists()) { var vehicleInt = API.DecorGetInt(ped.Handle, "Damage.Vehicle"); var petrolInt = API.DecorGetInt(ped.Handle, "Damage.Petrol"); var projectileInt = API.DecorGetInt(ped.Handle, "Damage.Projectile"); var meleeSharpInt = API.DecorGetInt(ped.Handle, "Damage.Melee.Sharp"); var meleeBluntInt = API.DecorGetInt(ped.Handle, "Damage.Melee.Blunt"); var animalInt = API.DecorGetInt(ped.Handle, "Damage.Animal"); str = str + "Vehicle Impact Wound[" + vehicleInt + "]\nBurn Wound[" + petrolInt + "]\nGunshot Wound[" + projectileInt + "]\nBlade Wound[" + meleeSharpInt + "]\nBlunt Force Wound[" + meleeBluntInt + "]\nAnimal Bites[" + animalInt + "]\n"; } return(str); }
static List <Ped> GetNearestVehicles(float range) { int handle = 0; List <Ped> peds = new List <Ped>(); //API.isentityin ELS.Delay(10); if (handle == 0) { API.FindFirstPed(ref handle); } else { API.FindNextPed(handle, ref handle); } Ped ped = (Ped)Ped.FromHandle(handle); if (getDistanceBetweenEntities(Game.PlayerPed, ped) <= range && ped.IsInVehicle()) { peds.Add(ped); } return(peds); }
public async Task PedManager() { Vector3 position = new Vector3(901.1047f, -173.3021f, 73.07f); const float heading = 223f; if (this.Peds == null) { Client.Log("Spawning cabby"); var pedModel = new Model(PedHash.Downtown01AFM); await pedModel.Request(-1); Ped newPed = await CitizenFX.Core.World.CreatePed(pedModel, position, heading); this.Peds = new List <Ped> { newPed }; newPed.Task?.ClearAllImmediately(); } foreach (Ped spawnedPed in Peds) { if (Ped.FromHandle(spawnedPed.Handle) == null) { Client.Log("Spawning cabby"); var pedModel = new Model(PedHash.Downtown01AFM); await pedModel.Request(-1); Ped newPed = await CitizenFX.Core.World.CreatePed(pedModel, position, heading); this.Peds = new List <Ped> { newPed }; newPed.Task?.ClearAllImmediately(); } spawnedPed.Position = position; spawnedPed.Heading = heading; spawnedPed.Task?.StandStill(1); spawnedPed.AlwaysKeepTask = true; spawnedPed.IsInvincible = true; spawnedPed.IsPositionFrozen = true; spawnedPed.BlockPermanentEvents = true; spawnedPed.IsCollisionProof = false; } Ped ped = this.Peds .Select(p => new { ped = p, distance = p.Position.DistanceToSquared(Game.Player.Character.Position) }) .Where(t => t.distance < 5.0F) // Nearby .OrderBy(t => t.distance) .Select(p => p.ped) .FirstOrDefault(); if (ped == null) { return; } new Text($"Press M to rent a cab", new PointF(50, Screen.Height - 50), 0.4f, Color.FromArgb(255, 255, 255), Font.ChaletLondon, Alignment.Left, false, true).Draw(); if (!Input.Input.IsControlJustPressed(Control.InteractionMenu)) { return; } Car car = new Car { Id = GuidGenerator.GenerateTimeBasedGuid(), Hash = (uint)Core.Models.Objects.Vehicles.VehicleHash.Taxi, Position = new Vector3(904.05f, -183.71f, 73f), Seats = new List <VehicleSeat> { new VehicleSeat { Index = VehicleSeatIndex.LeftFront }, new VehicleSeat { Index = VehicleSeatIndex.RightFront }, new VehicleSeat { Index = VehicleSeatIndex.LeftRear }, new VehicleSeat { Index = VehicleSeatIndex.RightRear } }, Wheels = new List <VehicleWheel> { new VehicleWheel { Index = 0, IsBurst = false, Type = VehicleWheelType.Sport }, new VehicleWheel { Index = 0, IsBurst = false, Type = VehicleWheelType.Sport }, new VehicleWheel { Index = 0, IsBurst = false, Type = VehicleWheelType.Sport }, new VehicleWheel { Index = 0, IsBurst = false, Type = VehicleWheelType.Sport } }, Windows = new List <VehicleWindow> { new VehicleWindow { Index = VehicleWindowIndex.FrontLeftWindow, IsIntact = false, IsRolledDown = false }, new VehicleWindow { Index = VehicleWindowIndex.FrontRightWindow, IsIntact = false, IsRolledDown = false }, new VehicleWindow { Index = VehicleWindowIndex.BackLeftWindow, IsIntact = false, IsRolledDown = false }, new VehicleWindow { Index = VehicleWindowIndex.BackRightWindow, IsIntact = false, IsRolledDown = false } }, Doors = new List <VehicleDoor> { new VehicleDoor { Index = VehicleDoorIndex.FrontLeftDoor }, new VehicleDoor { Index = VehicleDoorIndex.FrontRightDoor }, new VehicleDoor { Index = VehicleDoorIndex.BackLeftDoor }, new VehicleDoor { Index = VehicleDoorIndex.BackRightDoor }, new VehicleDoor { Index = VehicleDoorIndex.Hood }, new VehicleDoor { Index = VehicleDoorIndex.Trunk } } }; Car spawnedCar = await Client.Instance.Controllers.First <VehicleController>().Create(car); this.Cars.Add(spawnedCar); }