protected override bool Initialize() { "Initializing L.S. Noir Callout: Sexual Assault -- Stage 4a [Suspect Home]".AddLog(); var spawn_scene = LoadDict(); var random = Rand.RandomNumber(spawn_scene.Count); _scenario = spawn_scene.Values.ToArray()[random]; _oneSpawn = spawn_scene.Keys.ToArray()[random]; _areaBlip = new Blip(_oneSpawn.Spawn) { Sprite = BlipSprite.GangAttackPackage, Color = Color.DarkOrange, Name = "Interrogate Suspect" }; _cData = Serializer.LoadItemFromXML <CaseData>(Main.CDataPath); _sData = Serializer.GetSelectedListElementFromXml <PedData>(Main.SDataPath, s => s.FirstOrDefault <PedData>(c => String.Equals(c.Name, _cData.CurrentSuspect, StringComparison.CurrentCultureIgnoreCase))); "Sexual Assault Case Update".DisplayNotification("Speak to suspect", _cData.Number); return(true); }
private bool FillData() { try { var witDataList = Serializer.LoadItemFromXML <List <PedData> >(Main.WDataPath); if (witDataList.Count < 1) { return(false); } if (witDataList.Count == 1) { _w1Data = Serializer.GetSelectedListElementFromXml <PedData>(Main.WDataPath, c => Enumerable.FirstOrDefault <PedData>(c, p => p.Type == PedType.Witness1)); wit_select_combobox.AddItem(_w1Data.Name); } else { _w1Data = Serializer.GetSelectedListElementFromXml <PedData>(Main.WDataPath, c => Enumerable.FirstOrDefault <PedData>(c, p => p.Type == PedType.Witness1)); wit_select_combobox.AddItem(_w1Data.Name); _w2Data = Serializer.GetSelectedListElementFromXml <PedData>(Main.WDataPath, c => Enumerable.FirstOrDefault <PedData>(c, p => p.Type == PedType.Witness2)); wit_select_combobox.AddItem(_w2Data.Name); } return(true); } catch (Exception ex) { $"Error loading witnesses: {ex.ToString()}".AddLog(true); return(false); } }
public void SavePeds() { if (this._peds == null) { this.Deserialize(); } List <Ped> list = this.PlayerPed.get_CurrentPedGroup().ToList(false); if (list.Count <= 0) { UI.Notify("You have no bodyguards."); } else { List <PedData> pedDatas = this._peds.ToList <PedData>(); list.ConvertAll <PedData>((Converter <Ped, PedData>)(ped => { PedData data = pedDatas.Find((Predicate <PedData>)(pedData => pedData.Handle == ((Entity)ped).get_Handle())); return(this.UpdatePedData(ped, data)); })).ToList <PedData>().ForEach((Action <PedData>)(data => { if (this._peds.Contains(data)) { return; } this._peds.Add(data); })); Serializer.Serialize <PedCollection>("./scripts/Guards.dat", this._peds); UI.Notify("~b~Guards~s~ saved!"); } }
public void SavePeds() { if (_peds == null) { Deserialize(); } List <Ped> group = PlayerPed.CurrentPedGroup.ToList(false); if (group.Count <= 0) { UI.Notify("You have no bodyguards."); } else { List <PedData> pedDatas = _peds.ToList(); List <PedData> peds = group.ConvertAll(delegate(Ped ped) { PedData data2 = pedDatas.Find((PedData pedData) => pedData.Handle == ped.Handle); return(UpdatePedData(ped, data2)); }).ToList(); peds.ForEach(delegate(PedData data) { if (!_peds.Contains(data)) { _peds.Add(data); } }); Serializer.Serialize("./scripts/Guards.dat", _peds); UI.Notify("~b~Guards~s~ saved!"); } }
// Runs when the player enters the blipped area. public override void OnStart(Ped player) { base.OnStart(player); // Attaches a blip to the vehicle. vehicle.AttachBlip(); // Variables for the driver data and the vehicle data. PedData pedData = new PedData(); VehicleData vehicleData = new VehicleData(); // Shows a simple subtitle at the bottom of the screen. Screen.ShowSubtitle("It looks like the driver is not here, they shouldn't be too far."); // String variables. string firstname = pedData.FirstName; string lastname = pedData.LastName; // Sets the driver's driving license to revoked. pedData.DriverLicense.LicenseStatus = PedData.License.Status.Revoked; // Essentially sets the vehicle to be owned by the driver, as FivePD doesn't do that automatically. vehicleData.OwnerFirstName = firstname; vehicleData.OwnerLastName = lastname; // Sets the vehicle to be flagged up on the system - doesn't seem to actually do it though. vehicleData.Flag = "Owner has revoked driving license"; // Push the data we just set to both the driver and the vehicle. Utilities.SetPedData(suspect.NetworkId, pedData); Utilities.SetVehicleData(vehicle.NetworkId, vehicleData); }
private void _infoBut_Clicked(Base sender, ClickedEventArgs arguments) { var isMatch = false; PedData suspect = null; foreach (var s in _sData) { if (s.Name.ToLower() != _susBox.Text.ToLower()) { continue; } isMatch = true; suspect = s; } if (isMatch) { _cData.CurrentSuspect = _susBox.Text; Serializer.SaveItemToXML(_cData, Main.CDataPath); this._susBox.Text = suspect.Name; "Displaying MessageBox".AddLog(); MessageBoxCode.Message = $"Name: {suspect.Name}; DOB: {suspect.Dob}\nGender: {suspect.Gender}\n\nAdd address to GPS?"; OpenMessageBox(); } else { "Displaying MessageBox".AddLog(); MessageBoxCode.Message = "No information available on suspect"; OpenMessageBox(); } }
public async override void OnStart(Ped player) { base.OnStart(player); vic = await SpawnPed(RandomUtils.GetRandomPed(), Location); PedData data = new PedData(); data.BloodAlcoholLevel = 0.07; Utilities.SetPedData(vic.NetworkId, data); vic.AlwaysKeepTask = true; vic.BlockPermanentEvents = true; PedData data1 = await Utilities.GetPedData(vic.NetworkId); string firstname = data1.FirstName; vic.AttachBlip(); Random random = new Random(); int x = random.Next(1, 100 + 1); if (x <= 40) { vic.Task.Wait(1000); //wait DrawSubtitle("~r~[" + firstname + "] ~s~Please grab me and get me out of here!", 5000); } else if (x > 40 && x <= 65) { vic.Task.ReactAndFlee(player); //run DrawSubtitle("~r~[" + firstname + "] ~s~Leave me alone!", 5000); } else { vic.Weapons.Give(WeaponHash.Pistol, 100, true, true); DrawSubtitle("~r~[" + firstname + "] ~s~DIE!", 5000); } }
protected override bool Initialize() { "Initializing L.S. Noir Callout: Sexual Assault -- Stage 4c [Suspect Work]".AddLog(); Xml = XDocument.Load(SaPath); _sData = LtFlash.Common.Serialization.Serializer.GetSelectedListElementFromXml <PedData>(Main.SDataPath, c => c.FirstOrDefault(s => s.Type == PedType.Suspect)); _cData = LtFlash.Common.Serialization.Serializer.LoadItemFromXML <CaseData>(Main.CDataPath); "Sexual Assault Case Update".DisplayNotification( "Meet with your ~b~team~w~ to perform a raid on the ~r~suspect's~w~ work", _cData.Number); CreateStage(); while (!_stageCreated) { GameFiber.Yield(); } _position = GetLocation("Mortuary", "Meeting", "Blip").Spawn; _areaBlip = new Blip(_position) { Sprite = BlipSprite.GangAttackPackage, Color = Color.DarkOrange, Name = "Meet with SWAT Team" }; ActivateStage(AwaitingArrival); return(true); }
public static void UpdatePlayer(Client player) { var data = new PedData(); if (player.Position == null) { player.Position = Vector3.RandomXY() * 3000f * (float)_randObj.NextDouble(); } data.Position = player.Position; player.LastUpdate = DateTime.Now; data.NetHandle = player.handle.Value; data.PedArmor = 0; data.Flag = 0; data.PedModelHash = (int)PedHash.Michael; data.PlayerHealth = 100; data.Quaternion = new Vector3(); data.Speed = 0; data.Velocity = new Vector3(); data.WeaponHash = (int)WeaponHash.Unarmed; data.Latency = 0.1f; Program.ServerInstance.ResendPacket(data, player, true); if (Environment.TickCount - player.GameVersion > 1500) { Program.ServerInstance.ResendPacket(data, player, false); player.GameVersion = Environment.TickCount; } }
private PluginResponse <PedData> OnNpcPed(Client c, PedData p) { //Server.KickPlayer(c, "NPC sharing is not allowed", true); return(new PluginResponse <PedData> { ContinueServerProc = false, ContinuePluginProc = false, Data = p }); }
public async override void OnStart(Ped player) { base.OnStart(player); driver = await SpawnPed(RandomUtils.GetRandomPed(), Location + 2); Random random = new Random(); string cartype = carList[random.Next(carList.Length)]; VehicleHash Hash = (VehicleHash)API.GetHashKey(cartype); car = await SpawnVehicle(Hash, Location); driver.SetIntoVehicle(car, VehicleSeat.Driver); PlayerData playerData = Utilities.GetPlayerData(); string displayName = playerData.DisplayName; Notify("~r~[DrunkCallouts] ~y~Officer ~b~" + displayName + ",~y~ the suspect is driving a " + cartype + "!"); //Driver Data PedData data = new PedData(); data.BloodAlcoholLevel = 0.18; List <Item> items = new List <Item>(); Item BeerBottle = new Item { Name = "Beer", IsIllegal = false }; Item DogCollar = new Item { Name = "Dog Collar", IsIllegal = false }; items.Add(BeerBottle); items.Add(DogCollar); data.Items = items; Utilities.SetPedData(driver.NetworkId, data); Utilities.ExcludeVehicleFromTrafficStop(car.NetworkId, true); //Tasks driver.AlwaysKeepTask = true; driver.BlockPermanentEvents = true; API.SetPedIsDrunk(driver.GetHashCode(), true); API.SetDriveTaskMaxCruiseSpeed(driver.GetHashCode(), 35f); API.SetDriveTaskDrivingStyle(driver.GetHashCode(), 524852); driver.Task.FleeFrom(player); Notify("~o~Officer ~b~" + displayName + ",~o~ the driver is fleeing!"); car.AttachBlip(); driver.AttachBlip(); PedData data1 = await Utilities.GetPedData(driver.NetworkId); string firstname = data1.FirstName; API.Wait(6000); DrawSubtitle("~r~[" + firstname + "] ~s~Is that a bird?", 5000); }
public async override void OnStart(Ped player) { base.OnStart(player); PlayerData playerData = Utilities.GetPlayerData(); string displayName = playerData.DisplayName; Notify("~r~[BeachCallouts] ~y~Officer ~b~" + displayName + ",~y~ reports show multiple victims down!"); suspect = await SpawnPed(RandomUtils.GetRandomPed(), Location); vic1 = await SpawnPed(RandomUtils.GetRandomPed(), Location + 1); vic2 = await SpawnPed(RandomUtils.GetRandomPed(), Location + 2); vic3 = await SpawnPed(RandomUtils.GetRandomPed(), Location + 4); vic4 = await SpawnPed(RandomUtils.GetRandomPed(), Location - 5); vic5 = await SpawnPed(RandomUtils.GetRandomPed(), Location - 1); //Suspect 1 PedData data = new PedData(); List <Item> items = new List <Item>(); data.BloodAlcoholLevel = 0.08; Item Rifle = new Item { Name = "Rifle", IsIllegal = true }; items.Add(Rifle); data.Items = items; Utilities.SetPedData(suspect.NetworkId, data); suspect.AlwaysKeepTask = true; suspect.BlockPermanentEvents = true; suspect.AttachBlip(); suspect.Weapons.Give(WeaponHash.MarksmanRifle, 1000, true, true); suspect.Task.ShootAt(player); vic1.Kill(); vic2.Kill(); vic3.Kill(); vic4.Kill(); vic5.Kill(); vic1.AttachBlip(); vic2.AttachBlip(); vic3.AttachBlip(); vic4.AttachBlip(); vic5.AttachBlip(); PedData data1 = await Utilities.GetPedData(suspect.NetworkId); string firstname = data1.FirstName; DrawSubtitle("~r~[" + firstname + "] ~s~I knew this was coming... DIE!", 5000); }
public PedData AddPed(PedHash ped, PedData data) { data.Hash(); if (this.pedData.ContainsKey((int)ped)) { return(this.pedData[(int)ped]); } this.pedData.Add((int)ped, data); return(data); }
public async override void OnStart(Ped player) { base.OnStart(player); vic = await SpawnPed(RandomUtils.GetRandomPed(), Location); suspect = await SpawnPed(RandomUtils.GetRandomPed(), Location); PedData data = new PedData(); data.BloodAlcoholLevel = 0.05; Utilities.SetPedData(vic.NetworkId, data); suspect.AlwaysKeepTask = true; suspect.BlockPermanentEvents = true; vic.AlwaysKeepTask = true; vic.BlockPermanentEvents = true; vic.AttachBlip(); suspect.AttachBlip(); PedData data1 = await Utilities.GetPedData(vic.NetworkId); string firstname = data1.FirstName; PedData data2 = await Utilities.GetPedData(suspect.NetworkId); string firstname2 = data2.FirstName; Random random = new Random(); int x = random.Next(1, 100 + 1); if (x <= 40) { vic.Task.ReactAndFlee(suspect); DrawSubtitle("~r~[" + firstname + "] ~s~Please help me!", 5000); suspect.Task.FightAgainst(vic); suspect.Weapons.Give(WeaponHash.Nightstick, 1000, true, true); DrawSubtitle("~r~[" + firstname2 + "] ~s~Let me have your money!", 5000); } else if (x > 40 && x <= 65) { vic.Task.ReactAndFlee(suspect); DrawSubtitle("~r~[" + firstname + "] ~s~Leave me alone!", 5000); suspect.Weapons.Give(WeaponHash.Knife, 1000, true, true); suspect.Task.FightAgainst(player); DrawSubtitle("~r~[" + firstname2 + "] ~s~Die Pigs!", 5000); } else { vic.Task.ReactAndFlee(suspect); DrawSubtitle("~r~[" + firstname + "] ~s~Please don't kill me!", 5000); suspect.Weapons.Give(WeaponHash.Pistol, 1000, true, true); suspect.Task.FightAgainst(player); DrawSubtitle("~r~[" + firstname2 + "] ~s~Time to die!", 5000); } }
public async override void OnStart(Ped player) { base.OnStart(player); suspect = await SpawnPed(RandomUtils.GetRandomPed(), Location + 2); suspect2 = await SpawnPed(RandomUtils.GetRandomPed(), Location + 2); //Suspect Data PedData data = new PedData(); List <Item> items = new List <Item>(); data.BloodAlcoholLevel = 0.10; Item Wine = new Item { Name = "Wine", IsIllegal = false }; items.Add(Wine); data.Items = items; Utilities.SetPedData(suspect.NetworkId, data); //Suspect2 Data PedData data2 = new PedData(); List <Item> items2 = new List <Item>(); data.BloodAlcoholLevel = 0.15; Item BeerBottle = new Item { Name = "Beer", IsIllegal = false }; items.Add(BeerBottle); data.Items = items2; Utilities.SetPedData(suspect2.NetworkId, data2); //Tasks suspect.AlwaysKeepTask = true; suspect.BlockPermanentEvents = true; suspect2.AlwaysKeepTask = true; suspect2.BlockPermanentEvents = true; API.SetPedIsDrunk(suspect.GetHashCode(), true); API.SetPedIsDrunk(suspect2.GetHashCode(), true); suspect.Task.FightAgainst(suspect2); suspect2.Task.FightAgainst(suspect); suspect.AttachBlip(); suspect2.AttachBlip(); }
private PedData UpdatePedData(Ped ped, PedData data) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type PlayerGroupManager.\u003C\u003Ec__DisplayClass18_0 cDisplayClass180 = new PlayerGroupManager.\u003C\u003Ec__DisplayClass18_0(); // ISSUE: reference to a compiler-generated field cDisplayClass180.ped = ped; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field PedTask pedTask = this._pedTasks.ContainsKey(cDisplayClass180.ped) ? this._pedTasks[cDisplayClass180.ped] : ~PedTask.StandStill; // ISSUE: method pointer IEnumerable <WeaponHash> source = (IEnumerable <WeaponHash>)Enumerable.Where <WeaponHash>((IEnumerable <M0>)Enum.GetValues(typeof(WeaponHash)), (Func <M0, bool>) new Func <WeaponHash, bool>((object)cDisplayClass180, __methodptr(\u003CUpdatePedData\u003Eb__0))); // ISSUE: reference to a compiler-generated field cDisplayClass180.componentHashes = (WeaponComponent[])Enum.GetValues(typeof(WeaponComponent)); // ISSUE: reference to a compiler-generated method List <Weapon> list = source.ToList <WeaponHash>().ConvertAll <Weapon>(new Converter <WeaponHash, Weapon>(cDisplayClass180.\u003CUpdatePedData\u003Eb__1)).ToList <Weapon>(); bool flag = data == null; if (flag) { if (flag) { // ISSUE: reference to a compiler-generated field int handle = ((Entity)cDisplayClass180.ped).get_Handle(); // ISSUE: reference to a compiler-generated field Model model = ((Entity)cDisplayClass180.ped).get_Model(); int hash = ((Model) ref model).get_Hash(); // ISSUE: reference to a compiler-generated field Vector3 rotation = ((Entity)cDisplayClass180.ped).get_Rotation(); // ISSUE: reference to a compiler-generated field Vector3 position = ((Entity)cDisplayClass180.ped).get_Position(); int num = (int)pedTask; List <Weapon> weapons = list; data = new PedData(handle, hash, rotation, position, (PedTask)num, weapons); } } else { // ISSUE: reference to a compiler-generated field data.Position = ((Entity)cDisplayClass180.ped).get_Position(); // ISSUE: reference to a compiler-generated field data.Rotation = ((Entity)cDisplayClass180.ped).get_Rotation(); data.Task = pedTask; data.Weapons = list; } return(data); }
private static void FillData(PedData vic, PedData sus) { _modelName = vic.Model; ("Victim model: " + _modelName).AddLog(); _photo = Game.CreateTextureFromFile(@"Plugins\LSPDFR\LSNoir\Textures\Persons\" + _modelName + ".jpg"); _vicName = vic.Name; _birthDay = vic.Dob.ToShortDateString(); var bfgf = sus.Gender == ExtensionMethods.Gender.Male ? "boo" : "bae"; _status1 = $"I can't wait to hang out with my {bfgf} and go see a movie!! :)"; _susName = sus.Name; _status2 = $"The best 2 months of my life have been spent with {_susName}"; }
public override void InitializeLayout() { base.InitializeLayout(); Window.IsClosable = false; Position = new Point(Game.Resolution.Width / 2 - Window.Width / 2, Game.Resolution.Height / 2 - Window.Height / 2); "Initializing San Andreas Joint Records System Warrant Statement Viewer".AddLog(); _cData = Serializer.LoadItemFromXML <CaseData>(Main.CDataPath); _sData = Serializer.GetSelectedListElementFromXml <PedData>(Main.SDataPath, c => Enumerable.FirstOrDefault <PedData>(c, s => s.Type == PedType.Suspect)); StartMethods(); FillData(); HideStuff(); }
public async override void OnStart(Ped player) { base.OnStart(player); driver = await SpawnPed(RandomUtils.GetRandomPed(), Location + 2); Random random = new Random(); string cartype = carList[random.Next(carList.Length)]; VehicleHash Hash = (VehicleHash)API.GetHashKey(cartype); car = await SpawnVehicle(Hash, Location); driver.SetIntoVehicle(car, VehicleSeat.Driver); dynamic playerData = Utilities.GetPlayerData(); string displayName = playerData.DisplayName; Notify("~r~[DrunkCallouts] ~y~Officer ~b~" + displayName + ",~y~ the suspect is driving a " + cartype + "!"); //Driver Data PedData data = new PedData(); List <Item> items = new List <Item>(); data.BloodAlcoholLevel = 0.10; Item BeerBottle = new Item { Name = "Beer", IsIllegal = false }; items.Add(BeerBottle); data.Items = items; Utilities.SetPedData(driver.NetworkId, data); //Tasks driver.AlwaysKeepTask = true; driver.BlockPermanentEvents = true; API.SetPedIsDrunk(driver.GetHashCode(), true); driver.Task.WanderAround(); driver.Task.CruiseWithVehicle(car, 35f, 524852); car.AttachBlip(); driver.AttachBlip(); PedData data1 = await Utilities.GetPedData(driver.NetworkId); string firstname = data1.FirstName; API.Wait(6000); DrawSubtitle("~r~[" + firstname + "] ~s~My head hurts!", 5000); }
// Runs when the player enters the blipped area. public override void OnStart(Ped player) { base.OnStart(player); // Attaches a blip to the vehicle. vehicle.AttachBlip(); // Variables for the driver data and the vehicle data. PedData pedData = new PedData(); VehicleData vehicleData = new VehicleData(); // Shows a simple subtitle at the bottom of the screen. Screen.ShowSubtitle("It looks like the driver is not here, they shouldn't be too far."); // String variables. string firstname = pedData.FirstName; string lastname = pedData.LastName; // Sets the driver's driving license to revoked. pedData.DriverLicense.LicenseStatus = PedData.License.Status.Expired; Utilities.SetPedData(suspect.NetworkId, pedData); // Essentially sets the vehicle to be owned by the driver, as FivePD doesn't do that automatically. vehicleData.OwnerFirstName = firstname; vehicleData.OwnerLastName = lastname; // Sets the vehicle to be flagged up on the system - doesn't seem to actually do it though. vehicleData.Flag = "Owner has expired driving license"; // Push the data we just set to both the driver and the vehicle. Utilities.SetVehicleData(vehicle.NetworkId, vehicleData); // 40% chance for the suspect to flee using the IPursuit interface. int chance = rnd.Next(0, 10); // If the number is between, or equal to, 0 through 3, initiate a pursuit. if (chance >= 0 && chance <= 3) { var pursuit = Pursuit.RegisterPursuit(suspect); pursuit.Init(true, 30f, 125f, true); pursuit.ActivatePursuit(); Utilities.ExcludeVehicleFromTrafficStop(vehicle.NetworkId, true); } }
public void AddClearAppearanceToMenu(UIMenu menu) { Action Clear = () => { var ped = Game.Player.Character; foreach (SlotType slot_type in Enum.GetValues(typeof(SlotType))) { for (int slot_id = 0; slot_id < PedData.GetNumId(slot_type); slot_id++) { var slot_key = new SlotKey(slot_type, slot_id); ped_data.ClearSlot(ped, slot_key); } } }; var clearitem = new UIMenuItem("Clear Appearance"); AddItem(menu, clearitem, OnSelect: Clear); }
public async override void OnStart(Ped player) { base.OnStart(player); driver = await SpawnPed(RandomUtils.GetRandomPed(), Location + 2); bike = await SpawnVehicle(VehicleHash.TriBike, Location); driver.SetIntoVehicle(bike, VehicleSeat.Driver); //Driver Data PedData data = new PedData(); List <Item> items = new List <Item>(); data.BloodAlcoholLevel = 0.10; Item Wine = new Item { Name = "Wine", IsIllegal = true }; items.Add(Wine); data.Items = items; Utilities.SetPedData(driver.NetworkId, data); Utilities.ExcludeVehicleFromTrafficStop(bike.NetworkId, true); //Tasks driver.AlwaysKeepTask = true; driver.BlockPermanentEvents = true; PlayerData playerData = Utilities.GetPlayerData(); string displayName = playerData.DisplayName; API.SetPedIsDrunk(driver.GetHashCode(), true); API.SetDriveTaskMaxCruiseSpeed(driver.GetHashCode(), 35f); API.SetDriveTaskDrivingStyle(driver.GetHashCode(), 524852); driver.Task.FleeFrom(player); Notify("~o~Officer ~b~" + displayName + ",~o~ the biker is fleeing!"); bike.AttachBlip(); driver.AttachBlip(); PedData data1 = await Utilities.GetPedData(driver.NetworkId); string firstname = data1.FirstName; API.Wait(6000); DrawSubtitle("~r~[" + firstname + "] ~s~Are those police lights?", 5000); }
public override async Task OnAccept() { this.InitBlip(); Random ranPed = new Random(); PedHash chosenWitness = this.witnessHashes[ranPed.Next(this.witnessHashes.Length)]; Ped ped = await this.SpawnPed(chosenWitness, new Vector3(this.Location.X + 2.5f, this.Location.Y + 2.5f, this.Location.Z)); this.witness = ped; this.witness.IsPersistent = true; this.witness.BlockPermanentEvents = true; PedData pData = await Utilities.GetPedData(witness.NetworkId); string wFN = pData.FirstName; Screen.ShowNotification("~y~[DISPATCH]~w~: A witness by the name of ~p~" + wFN + "~w~ is reporting a homicide, respond and investigate."); PlayerData playerData = Utilities.GetPlayerData(); string playerName = playerData.DisplayName; string callsign = playerData.Callsign; }
/// <summary> /// Internal method. Triggers OnPedDataUpdate /// </summary> /// <param name="c">Client who sent the update</param> /// <param name="p">PedData object</param> /// <returns>A PluginResponse, with the ability to rewrite the received data.</returns> public static PluginResponse <PedData> PedDataUpdate(Client c, PedData p) { var result = new PluginResponse <PedData>() { ContinuePluginProc = true, ContinueServerProc = true, Data = p }; foreach (var f in OnPedDataUpdate) { result = f(c, p); if (!result.ContinuePluginProc) { return(result); } p = result.Data; } return(result); }
// Undress but keep all head overlays. Returns dictionary that can be used to redress. public Dictionary <SlotKey, SlotValue> FreemodeUndress(Ped ped) { var old_data = new Dictionary <SlotKey, SlotValue>(); old_data.Clear(); SlotType[] typs = { SlotType.CompVar, SlotType.Prop }; foreach (SlotType slot_type in typs) { for (int slot_id = 0; slot_id < PedData.GetNumId(slot_type); slot_id++) { if (slot_id == 2) { continue; // don't "undress" hair } var slot_key = new SlotKey(slot_type, slot_id); old_data[slot_key] = GetSlotValue(slot_key); FreemodeUndressSlot(ped, slot_key); } } return(old_data); }
public override void InitializeLayout() { base.InitializeLayout(); Window.IsClosable = false; Position = new Point(Game.Resolution.Width / 2 - Window.Width / 2, Game.Resolution.Height / 2 - Window.Height / 2); "Initializing Victim Info Viewer".AddLog(); _vData = Serializer.GetSelectedListElementFromXml <PedData>(Main.PDataPath, c => Enumerable.FirstOrDefault <PedData>(c, p => p.Type == PedType.Victim)); _vfData = Serializer.GetSelectedListElementFromXml <PedData>(Main.PDataPath, c => Enumerable.FirstOrDefault <PedData>(c, p => p.Type == PedType.VictimFamily)); _sData = Serializer.GetSelectedListElementFromXml <PedData>(Main.SDataPath, c => Enumerable.FirstOrDefault <PedData>(c, p => p.Type == PedType.Suspect)); this.Window.Show(); StartMethods(); FillData(); HideStuff(); }
public object PositionalCompressData(int netHandle, object fullPacket) { if (fullPacket is PedData) { var full = (PedData)fullPacket; if ((_parent.Position - full.Position).LengthSquared() > 40000f) // 200 * 200 { var compressed = new PedData(); compressed.NetHandle = netHandle; compressed.Position = full.Position; compressed.Quaternion = full.Quaternion; return(compressed); } else { return(fullPacket); } } else if (fullPacket is VehicleData) { var full = (VehicleData)fullPacket; if ((_parent.Position - full.Position).LengthSquared() > 40000f) // 200 * 200 { var compressed = new VehicleData(); compressed.NetHandle = netHandle; compressed.VehicleHandle = ((VehicleData)fullPacket).VehicleHandle; compressed.Position = full.Position; compressed.Quaternion = full.Quaternion; return(compressed); } else { return(fullPacket); } } return(null); // This should not happen }
public static void DrawSocialMediaPage(PedData victim, PedData suspect, Base sender) { FillData(victim, suspect); MainCode.HideForm = true; Game.RawFrameRender += OnRawFrameRender; Stopwatch sw = new Stopwatch(); sw.Start(); GameFiber.StartNew(delegate { while (sw.Elapsed.Seconds < 10) { GameFiber.Yield(); } Game.RawFrameRender -= OnRawFrameRender; MainCode.HideForm = false; }); }
private PedData UpdatePedData(Ped ped, PedData data) { PedTask task = _pedTasks.ContainsKey(ped) ? _pedTasks[ped] : ((PedTask)(-1)); IEnumerable <WeaponHash> hashes = from hash in (WeaponHash[])Enum.GetValues(typeof(WeaponHash)) where ped.Weapons.HasWeapon(hash) select hash; WeaponComponent[] componentHashes = (WeaponComponent[])Enum.GetValues(typeof(WeaponComponent)); List <Weapon> weapons = hashes.ToList().ConvertAll(delegate(WeaponHash hash) { GTA.Weapon weapon = ped.Weapons[hash]; WeaponComponent[] components = (from h in componentHashes where weapon.IsComponentActive(h) select h).ToArray(); return(new Weapon(weapon.Ammo, weapon.Hash, components)); }).ToList(); switch (data == null) { case true: { int handle = ped.Handle; Model model = ped.Model; data = new PedData(handle, model.Hash, ped.Rotation, ped.Position, task, weapons); break; } case false: data.Position = ped.Position; data.Rotation = ped.Rotation; data.Task = task; data.Weapons = weapons; break; } return(data); }
protected override bool Initialize() { "Initializing L.S. Noir Callout: Sexual Assault -- Stage 3 [Victim Family]".AddLog(); _oneSpawn = GetRandomSpawn(); _areaBlip = new Blip(_oneSpawn.Spawn) { Sprite = BlipSprite.GangAttackPackage, Color = Color.DarkOrange, Name = "Victim's Family" }; ExtensionMethods.LogDistanceFromCallout(_oneSpawn.Spawn); _cData = Serializer.LoadItemFromXML <CaseData>(Main.CDataPath); _pData = Serializer.GetSelectedListElementFromXml <PedData>(Main.PDataPath, p => Enumerable.FirstOrDefault <PedData>(p, f => f.Type == PedType.VictimFamily)); $"Case number: {_cData.Number}".AddLog(); "Sexual Assault Case Update".DisplayNotification("Speak to family of the victim", _cData.Number); return(true); }