public static void TeleportToClosestVehicle(bool forcePassenger = false) { var vehicles = Vehicles.Get(); if (Common.GetClosestEntity(vehicles, out int vehicle)) { if (Vehicles.GetFreeSeat(vehicle, out int seat, forcePassenger)) { var player = API.GetPlayerPed(-1); API.SetPedIntoVehicle(player, vehicle, seat); } else { if (!forcePassenger) { var driver = API.GetPedInVehicleSeat(vehicle, -1); if (Autopilot.IsOwnedAutopilot(driver)) { API.DeletePed(ref driver); var player = API.GetPlayerPed(-1); API.SetPedIntoVehicle(player, vehicle, -1); return; } } Common.Notification("Closest vehicle doesn't have a free seat"); } }
public void CorrectlyDeleteVehicle() { Vehicle vehicle = Vehicles.Create("98ASD871NFLS91", 1); var beforeAdd = vvm.VehiclesCollection.IndexOf(vehicle); Assert.AreEqual(-1, beforeAdd); Assert.AreEqual(Vehicles.Get(vehicle.Id).Id, vehicle.Id); vvm.VehiclesCollection.Add(vehicle); var beforeDelete = vvm.VehiclesCollection.IndexOf(vehicle); Assert.AreNotEqual(-1, beforeDelete); vvm.SelectedVehicle = vehicle; vvm.DeleteVehicle(); var afterDelete = vvm.VehiclesCollection.IndexOf(vehicle); Assert.AreEqual(-1, afterDelete); }
public static void TeleportToClosestVehicle(bool forcePassenger = false) { var vehicles = Vehicles.Get(); if (Common.GetClosestEntity(vehicles, out int vehicle)) { if (Vehicles.GetFreeSeat(vehicle, out int seat, forcePassenger)) { var player = Game.Player.Character.Handle; API.SetPedIntoVehicle(player, vehicle, seat); } else { Hud.Notification("Closest vehicle doesn't have a free seat"); } }
public Client() { if (Config.GetConfigBool("spawn_vehicle")) { Hud.AddSubmenu("Spawn vehicle", async(vehicle) => await Vehicles.Spawn(vehicle), Config.VehicleList); } if (Config.GetConfigBool("spawn_prop")) { Hud.AddSubmenu("Spawn prop", async(prop) => await Props.Spawn(prop), Config.PropList, 10); } if (Config.GetConfigBool("spawn_ped")) { Hud.AddMenuListItem("Spawn ped", async(spawn) => { switch (spawn) { case 0: await PocceCompanion(); break; case 1: await PetCompanion(); break; case 2: await PoccePassengers(); break; case 3: await SpawnTrashPed(); break; } }, "Pocce companion", "Pet companion", "Pocce passengers", "Trash ped"); } if (Config.GetConfigBool("rope")) { Hud.AddMenuListItem("Rope", (tow) => { switch (tow) { case 0: RopeClosest(Peds.Get(Peds.Filter.Dead | Peds.Filter.CurrentVehiclePassengers)); break; case 1: RopeClosest(Vehicles.Get()); break; case 2: RopeClosest(Vehicles.Get(), true); break; case 3: RopeClosest(Props.Get()); break; case 4: RappelFromHeli(); break; } return(Delay(0)); }, "Closest ped", "Closest vehicle", "Closest vehicle tow", "Closest prop", "Rappel from heli"); } if (Config.GetConfigBool("rope") || Config.GetConfigBool("spawn_prop")) { Hud.AddMenuListItem("Clear", (clear) => { switch (clear) { case 0: Ropes.ClearAll(); break; case 1: Ropes.ClearLast(); break; case 2: Props.ClearAll(); break; case 3: Props.ClearLast(); break; } return(Delay(0)); }, "Ropes", "Last rope", "Props", "Last prop"); } if (Config.GetConfigBool("teleport")) { Hud.AddMenuListItem("Teleport", (teleport) => { switch (teleport) { case 0: TeleportToClosestVehicle(); break; case 1: TeleportToClosestVehicle(true); break; } return(Delay(0)); }, "Closest vehicle", "Closest vehicle as passenger"); } if (Config.GetConfigBool("wave")) { Hud.AddMenuListItem("Ocean waves", (waves) => { switch (waves) { case 0: API.SetWavesIntensity(8f); break; case 1: API.SetWavesIntensity(2f); break; case 2: API.SetWavesIntensity(0f); break; case 3: API.ResetWavesIntensity(); break; } return(Delay(0)); }, "High", "Mid", "Low", "Reset"); } if (Config.GetConfigBool("riot")) { Hud.AddMenuListItem("Riot", async(riot) => { switch (riot) { case 0: await PocceRiot(false); break; case 1: await PocceRiot(true); break; case 2: await PedRiot(false); break; case 3: await PedRiot(true); break; } }, "Pocce riot", "Armed pocce riot", "Ped riot", "Armed ped riot"); } if (Config.GetConfigBool("other")) { Hud.AddMenuListItem("Other", async(other) => { switch (other) { case 0: await Autopilot.Toggle(); break; case 1: Vehicles.EMP(); break; case 2: CargobobMagnet(); break; } }, "Autopilot", "EMP", "Cargobob magnet"); } if (Config.GetConfigBool("skin")) { var skins = new DataSource <string>(); Hud.AddMenuItem("Indentify skins", () => { skins.Push(IdentifyPedModels()); return(Delay(0)); }); Hud.AddSubmenu("Change skin", async(skin) => await ChangeSkin(skin), skins); } var menukey = Config.GetConfigInt("menu_key"); if (menukey > 0) { Hud.SetMenuKey(menukey); } }