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); }
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); }
public Rope(string player, int id, int entity1, int entity2, Vector3 offset1, Vector3 offset2, float length) { Player = player; ID = id; Entity1 = entity1; Entity2 = entity2; Offset1 = offset1; Offset2 = offset2; Length = length; if (API.IsEntityAPed(Entity1)) { _bone1 = Peds.GetClosestPedBoneToOffset(Entity1, Offset1); _boneIndex1 = API.GetEntityBoneIndexByName(Entity1, _bone1); Offset1 = Vector3.Zero; } if (API.IsEntityAPed(Entity2)) { _bone2 = Peds.GetClosestPedBoneToOffset(Entity2, Offset2); _boneIndex2 = API.GetEntityBoneIndexByName(Entity2, _bone2); Offset2 = Vector3.Zero; } _handle = RopePool.AddRope(); Attach(); API.StartRopeWinding(_handle); API.RopeForceLength(_handle, length); }
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); }
public static async Task SpawnTrashPed() { var ped = await Peds.Spawn(Config.TrashPedList); TriggerServerEvent("PocceMod:Burn", API.PedToNet(ped)); API.SetEntityAsNoLongerNeeded(ref ped); }
public static async Task SpawnTrashPed() { var ped = await Peds.Spawn(Config.TrashPedList); await Delay(500); Common.Burn(ped); API.SetEntityAsNoLongerNeeded(ref ped); }
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; } }
public static List <string> IdentifyPedModels() { var coords = API.GetEntityCoords(API.GetPlayerPed(-1), true); var peds = Peds.Get(); var models = new List <string>(); foreach (var ped in peds) { var pos = API.GetEntityCoords(ped, true); if (coords.DistanceToSquared(pos) < 4f) { var model = string.Format("0x{0:X8}", API.GetEntityModel(ped)); models.Add(model); Hud.Notification("ped:" + model); } } return(models); }
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); }
private static Task Update() { var player = API.GetPlayerPed(-1); var peds = Peds.Get(Peds.Filter.None); var companions = Get(peds); if (companions.Count == 0 || CheckAndHandlePlayerCombat(peds, companions)) { return(Delay(2000)); } if (API.IsPedInAnyVehicle(player, false)) { FollorPlayerToVehicle(player, companions); } else { FollowPlayer(player, companions); } return(Delay(2000)); }
public static async Task PocceParty(float radius, int speakers, int peds, int balloons, int booze) { var center = API.GetEntityCoords(API.GetPlayerPed(-1), true); var station = API.GetPlayerRadioStationIndex(); for (int i = 0; i < speakers; ++i) { var model = SpeakerList[API.GetRandomIntInRange(0, SpeakerList.Length)]; var prop = await Props.SpawnInRange(center, model, 1f, radius); API.DecorSetInt(prop, SpeakerRadioDecor, station); // cleanup later in update } for (int i = 0; i < peds; ++i) { var ped = await Peds.SpawnInRange(Config.PocceList, center, 1f, radius); API.TaskStartScenarioInPlace(ped, "WORLD_HUMAN_PARTYING", 0, true); API.SetPedAsNoLongerNeeded(ref ped); } for (int i = 0; i < balloons; ++i) { var coords = Common.GetRandomSpawnCoordsInRange(center, 1f, radius, out float heading); var balloon = await Props.SpawnBalloons(coords); API.FreezeEntityPosition(balloon, true); API.SetEntityAsNoLongerNeeded(ref balloon); } for (int i = 0; i < booze; ++i) { var model = BoozeList[API.GetRandomIntInRange(0, BoozeList.Length)]; var prop = await Props.SpawnInRange(center, model, 1f, radius); API.SetEntityAsNoLongerNeeded(ref prop); } }
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); } }
private static void SetupMenu() { _menu = new MainMenu(); #region Vehicle if (Permission.CanDo(Ability.SpawnVehicle)) { _menu.AddMenuListItem("Vehicle", "Spawn from list ↕", _menu.Submenu <VehicleMenu>().OpenMenu); } if (Permission.CanDo(Ability.SpawnVehicleByName)) { _menu.AddMenuListItemAsync("Vehicle", "Spawn by name", _menu.Submenu <VehicleMenu>().SpawnByName); } if (Permission.CanDo(Ability.Autopilot)) { _menu.AddMenuListItemAsync("Vehicle", "Autopilot (toggle)", Autopilot.Toggle); } if (Permission.CanDo(Ability.TeleportToClosestVehicle)) { _menu.AddMenuListItem("Vehicle", "TP into closest", () => VehicleMenu.TeleportToClosestVehicle()); _menu.AddMenuListItem("Vehicle", "TP into closest as passenger", () => VehicleMenu.TeleportToClosestVehicle(true)); } #endregion #region Prop if (Permission.CanDo(Ability.SpawnProp)) { _menu.AddMenuListItem("Prop", "Spawn from list ↕", _menu.Submenu <PropMenu>().OpenMenu); _menu.AddMenuListItem("Prop", "Spawn from list (search)", async() => { var prop = await Common.GetUserInput("Filter props", "", 30); _menu.Submenu <PropMenu>().Filter(prop); }); _menu.AddMenuListItemAsync("Prop", "Spawn by name", PropMenu.SpawnByName); _menu.AddMenuListItemAsync("Prop", "Clear last", Props.ClearLast); _menu.AddMenuListItemAsync("Prop", "Clear all", Props.ClearAll); } #endregion #region Rope if (Permission.CanDo(Ability.RopeGun)) { _menu.AddMenuListItem("Rope", "Equip rope gun", Ropes.EquipRopeGun); } if (Permission.CanDo(Ability.Rope)) { _menu.AddMenuListItem("Rope", "Closest ped", () => Ropes.AttachToClosest(Peds.Get(Peds.Filter.LocalPlayer | Peds.Filter.Dead | Peds.Filter.CurrentVehiclePassengers))); _menu.AddMenuListItem("Rope", "Closest vehicle", () => Ropes.AttachToClosest(Vehicles.Get())); _menu.AddMenuListItem("Rope", "Closest vehicle tow", () => Ropes.AttachToClosest(Vehicles.Get(), true)); _menu.AddMenuListItem("Rope", "Closest prop", () => Ropes.AttachToClosest(Props.Get())); } if (Permission.CanDo(Ability.Rope) || Permission.CanDo(Ability.RopeGun)) { _menu.AddMenuListItem("Rope", "Free myself", Ropes.ClearPlayer); _menu.AddMenuListItem("Rope", "Clear last", Ropes.ClearLast); _menu.AddMenuListItem("Rope", "Clear all", Ropes.ClearAll); } #endregion #region Companion if (Permission.CanDo(Ability.SpawnPocceCompanion)) { _menu.AddMenuListItemAsync("Companion", "Spawn pocce", CompanionMenu.PocceCompanion); } if (Permission.CanDo(Ability.SpawnPetCompanion)) { _menu.AddMenuListItemAsync("Companion", "Spawn pet", CompanionMenu.PetCompanion); } if (Permission.CanDo(Ability.SpawnCustomCompanion)) { _menu.AddMenuListItem("Companion", "Spawn custom ↕", _menu.Submenu <CompanionMenu>().CustomCompanion); _menu.AddMenuListItemAsync("Companion", "Spawn custom by name", CompanionMenu.CustomCompanionByName); } if (Permission.CanDo(Ability.SpawnPoccePassengers)) { _menu.AddMenuListItemAsync("Companion", "Pocce passengers", CompanionMenu.PoccePassengers); } #endregion #region Event if (Permission.CanDo(Ability.PocceParty)) { _menu.AddMenuListItemAsync("Event", "Pocce party", EventMenu.PocceParty); } if (Permission.CanDo(Ability.MassScenario)) { _menu.AddMenuListItem("Event", "Play mass scenario", _menu.Submenu <MassScenarioMenu>().OpenMenu); } if (Permission.CanDo(Ability.PocceRiot)) { _menu.AddMenuListItemAsync("Event", "Pocce riot", EventMenu.PocceRiot); } if (Permission.CanDo(Ability.PocceRiotArmed)) { _menu.AddMenuListItemAsync("Event", "Pocce riot (armed)", EventMenu.PocceRiotArmed); } if (Permission.CanDo(Ability.PedRiot)) { _menu.AddMenuListItemAsync("Event", "Ped riot", EventMenu.PedRiot); } if (Permission.CanDo(Ability.PedRiotArmed)) { _menu.AddMenuListItemAsync("Event", "Ped riot (armed)", EventMenu.PedRiotArmed); } #endregion #region Skin if (Permission.CanDo(Ability.IdentifySkins)) { _menu.AddMenuListItem("Skin", "Detect nearby skins", _menu.Submenu <SkinMenu>().DetectSkins); _menu.AddMenuListItem("Skin", "Detect player skin", _menu.Submenu <SkinMenu>().DetectPlayerSkin); } if (Permission.CanDo(Ability.ChangeSkin)) { _menu.AddMenuListItem("Skin", "Choose from last detect ↕", _menu.Submenu <SkinMenu>().ShowLastSkins); _menu.AddMenuListItem("Skin", "Choose from all ↕", _menu.Submenu <SkinMenu>().ShowAllSkins); } #endregion #region Upgrade if (Permission.CanDo(Ability.BackToTheFuture)) { _menu.AddMenuListItem("Upgrade", "Back to the Future (toggle)", UpgradeMenu.ToggleBackToTheFuture); } if (Permission.CanDo(Ability.UltrabrightHeadlight)) { _menu.AddMenuListItem("Upgrade", "Ultrabright headlight (toggle)", UpgradeMenu.ToggleUltrabrightHeadlight); } if (Permission.CanDo(Ability.CargobobMagnet)) { _menu.AddMenuListItem("Upgrade", "Cargobob magnet", UpgradeMenu.CargobobMagnet); } if (Permission.CanDo(Ability.CompressVehicle)) { _menu.AddMenuListItem("Upgrade", "Compress vehicle", UpgradeMenu.CompressVehicle); } if (Permission.CanDo(Ability.AntiGravity)) { _menu.AddMenuListItem("Upgrade", "Anti-gravity (toggle)", UpgradeMenu.ToggleAntiGravity); } if (Permission.CanDo(Ability.CustomHorn)) { _menu.AddMenuListItem("Upgrade", "Custom horn ↕", _menu.Submenu <CustomHornMenu>().OpenMenu); } if (Permission.CanDo(Ability.TurboBoost)) { _menu.AddMenuListItem("Upgrade", "Turbo Boost (toggle)", UpgradeMenu.ToggleTurboBoost); } if (Permission.CanDo(Ability.TurboBrake)) { _menu.AddMenuListItem("Upgrade", "Turbo Brake (toggle)", UpgradeMenu.ToggleTurboBrake); } if (Permission.CanDo(Ability.RemoteControl)) { _menu.AddMenuListItem("Upgrade", "Remote control (toggle)", UpgradeMenu.ToggleRemoteControl); } if (Permission.CanDo(Ability.JesusMode)) { _menu.AddMenuListItem("Upgrade", "Jesus mode (toggle)", UpgradeMenu.ToggleJesusMode); } if (Permission.CanDo(Ability.Stabilizer)) { _menu.AddMenuListItem("Upgrade", "Stabilizer (toggle)", UpgradeMenu.ToggleStabilizer); } #endregion #region Extra if (Permission.CanDo(Ability.OceanWaves)) { _menu.AddMenuListItem("Extra", "Crazy ocean waves (toggle)", ExtraMenu.ToggleCrazyOceanWaves); } if (Permission.CanDo(Ability.RappelFromHeli)) { _menu.AddMenuListItemAsync("Extra", "Rappel from heli", ExtraMenu.RappelFromHeli); } if (Permission.CanDo(Ability.EMP)) { _menu.AddMenuListItemAsync("Extra", "EMP", Vehicles.EMP); } if (Permission.CanDo(Ability.SpawnTrashPed)) { _menu.AddMenuListItemAsync("Extra", "Trash ped", ExtraMenu.SpawnTrashPed); } if (Permission.CanDo(Ability.Balloons)) { _menu.AddMenuListItemAsync("Extra", "Balloons", ExtraMenu.Balloons); } if (Permission.CanDo(Ability.FreezePosition)) { _menu.AddMenuListItem("Extra", "Freeze position (toggle)", ExtraMenu.FreezePosition); } #endregion }
public static void EquipRopeGun() { Peds.GiveWeapon(API.GetPlayerPed(-1), Ropegun); }
private static void SetupMenu() { if (Permission.CanDo(Ability.SpawnVehicle)) { Hud.AddSubmenu("Spawn vehicle", async(vehicle) => await Vehicles.Spawn(vehicle), Config.VehicleList); } if (Permission.CanDo(Ability.SpawnProp)) { Hud.AddSubmenu("Spawn prop", async(prop) => await Props.Spawn(prop), Config.PropList, 10); } if (Permission.CanDo(Ability.SpawnPocceCompanion)) { Hud.AddMenuListItem("Spawn ped", "Pocce companion", PocceCompanion); } if (Permission.CanDo(Ability.SpawnPetCompanion)) { Hud.AddMenuListItem("Spawn ped", "Pet companion", PetCompanion); } if (Permission.CanDo(Ability.SpawnPoccePassengers)) { Hud.AddMenuListItem("Spawn ped", "Pocce passengers", PoccePassengers); } if (Permission.CanDo(Ability.SpawnTrashPed)) { Hud.AddMenuListItem("Spawn ped", "Trash ped", SpawnTrashPed); } if (Permission.CanDo(Ability.Rope)) { Hud.AddMenuListItem("Rope", "Closest ped", () => RopeClosest(Peds.Get(Peds.Filter.Dead | Peds.Filter.CurrentVehiclePassengers))); Hud.AddMenuListItem("Rope", "Closest vehicle", () => RopeClosest(Vehicles.Get())); Hud.AddMenuListItem("Rope", "Closest vehicle tow", () => RopeClosest(Vehicles.Get(), true)); Hud.AddMenuListItem("Rope", "Closest prop", () => RopeClosest(Props.Get())); } if (Permission.CanDo(Ability.RopeGun)) { Hud.AddMenuListItem("Rope", "Equip rope gun", () => Ropes.EquipRopeGun()); } if (Permission.CanDo(Ability.RappelFromHeli)) { Hud.AddMenuListItem("Rope", "Rappel from heli", () => RappelFromHeli()); } if (Permission.CanDo(Ability.Rope) || Permission.CanDo(Ability.RopeGun)) { Hud.AddMenuListItem("Clear", "Ropes", () => Ropes.ClearAll()); Hud.AddMenuListItem("Clear", "Last rope", () => Ropes.ClearLast()); } if (Permission.CanDo(Ability.SpawnProp)) { Hud.AddMenuListItem("Clear", "Props", () => Props.ClearAll()); Hud.AddMenuListItem("Clear", "Last prop", () => Props.ClearLast()); } if (Permission.CanDo(Ability.TeleportToClosestVehicle)) { Hud.AddMenuListItem("Teleport", "Closest vehicle", () => TeleportToClosestVehicle()); Hud.AddMenuListItem("Teleport", "Closest vehicle as passenger", () => TeleportToClosestVehicle(true)); } if (Permission.CanDo(Ability.OceanWaves)) { Hud.AddMenuListItem("Ocean waves", "High", () => API.SetWavesIntensity(8f)); Hud.AddMenuListItem("Ocean waves", "Mid", () => API.SetWavesIntensity(2f)); Hud.AddMenuListItem("Ocean waves", "Low", () => API.SetWavesIntensity(0f)); Hud.AddMenuListItem("Ocean waves", "Reset", () => API.ResetWavesIntensity()); } if (Permission.CanDo(Ability.PocceRiot)) { Hud.AddMenuListItem("Riot", "Pocce riot", async() => await PocceRiot(false)); } if (Permission.CanDo(Ability.PocceRiotArmed)) { Hud.AddMenuListItem("Riot", "Armed pocce riot", async() => await PocceRiot(true)); } if (Permission.CanDo(Ability.PedRiot)) { Hud.AddMenuListItem("Riot", "Ped riot", async() => await PedRiot(false)); } if (Permission.CanDo(Ability.PedRiotArmed)) { Hud.AddMenuListItem("Riot", "Armed ped riot", async() => await PedRiot(true)); } if (Permission.CanDo(Ability.Autopilot)) { Hud.AddMenuListItem("Other", "Autopilot", Autopilot.Toggle); } if (Permission.CanDo(Ability.EMP)) { Hud.AddMenuListItem("Other", "EMP", () => Vehicles.EMP()); } if (Permission.CanDo(Ability.CargobobMagnet)) { Hud.AddMenuListItem("Other", "Cargobob magnet", () => CargobobMagnet()); } if (Permission.CanDo(Ability.IdentifySkins)) { if (Permission.CanDo(Ability.ChangeSkin)) { var skins = new DataSource <string>(); Hud.AddMenuItem("Indentify skins", () => skins.Push(IdentifyPedModels())); Hud.AddSubmenu("Change skin", async(skin) => await ChangeSkin(skin), skins); } else { Hud.AddMenuItem("Indentify skins", () => IdentifyPedModels()); } } var menukey = Config.GetConfigInt("MenuKey"); if (menukey > 0) { Hud.SetMenuKey(menukey); } }