private void LootShops() { if (!this.Spawn || ((Entity)Loot247.PlayerPed).IsPlayingAnim("oddjobs@shop_robbery@rob_till", "loop")) { return; } // ISSUE: method pointer Prop closest = (Prop)World.GetClosest <Prop>(Loot247.PlayerPosition, (M0[])((IEnumerable <Prop>)Enumerable.Where <Prop>((IEnumerable <M0>)World.GetNearbyProps(Loot247.PlayerPosition, 15f), (Func <M0, bool>) new Func <Prop, bool>((object)this, __methodptr(IsShelf)))).ToArray <Prop>()); if (Entity.op_Equality((Entity)closest, (Entity)null) || (double)((Entity)closest).get_Position().VDist(Loot247.PlayerPosition) > 1.5) { return; } Game.DisableControlThisFrame(2, (Control)51); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to loot the shelf.", false); if (!Game.IsDisabledControlJustPressed(2, (Control)51)) { return; } this._lootedShelfes.Add(closest); PlayerInventory.Instance.PickupItem(Database.Random.NextDouble() > 0.300000011920929 ? PlayerInventory.Instance.ItemFromName("Packaged Food") : PlayerInventory.Instance.ItemFromName("Clean Water"), ItemType.Item); Loot247.PlayerPed.get_Task().PlayAnimation("oddjobs@shop_robbery@rob_till", "loop"); Ped playerPed = Loot247.PlayerPed; Vector3 vector3 = Vector3.op_Subtraction(((Entity)closest).get_Position(), Loot247.PlayerPosition); double heading = (double)((Vector3) ref vector3).ToHeading(); ((Entity)playerPed).set_Heading((float)heading); }
private void LootShops() { if (Spawn && !PlayerPed.IsPlayingAnim("oddjobs@shop_robbery@rob_till", "loop")) { IEnumerable <Prop> props = World.GetNearbyProps(PlayerPosition, 15f).Where(IsShelf); Prop closest = World.GetClosest <Prop>(PlayerPosition, props.ToArray()); if (!(closest == null)) { float dist = closest.Position.VDist(PlayerPosition); if (!(dist > 1.5f)) { Game.DisableControlThisFrame(2, GTA.Control.Context); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to loot the shelf.", false); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context)) { _lootedShelfes.Add(closest); bool rand = Database.Random.NextDouble() > 0.30000001192092896; PlayerInventory.Instance.PickupItem(rand ? PlayerInventory.Instance.ItemFromName("Packaged Food") : PlayerInventory.Instance.ItemFromName("Clean Water"), ItemType.Item); PlayerPed.Task.PlayAnimation("oddjobs@shop_robbery@rob_till", "loop"); Ped playerPed = new Ped(PlayerPed.Handle); Vector3 val = closest.Position - PlayerPosition; playerPed.Heading = val.ToHeading(); } } } } }
private void LootDeadPeds() { if (PlayerInventory.PlayerPed.IsInVehicle()) { return; } Ped closest = (Ped)World.GetClosest <Ped>(PlayerInventory.PlayerPosition, (M0[])World.GetNearbyPeds(PlayerInventory.PlayerPed, 1.5f)); if (Entity.op_Equality((Entity)closest, (Entity)null) || !((Entity)closest).get_IsDead() || this._lootedPeds.Contains(closest)) { return; } UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to loot.", false); Game.DisableControlThisFrame(2, (Control)51); if (!Game.IsDisabledControlJustPressed(2, (Control)51)) { return; } // ISSUE: reference to a compiler-generated field PlayerInventory.OnLootedEvent lootedPed = PlayerInventory.LootedPed; if (lootedPed == null) { return; } lootedPed(closest); }
private static void OnTick(object sender, EventArgs eventArgs) { if (!MenuConrtoller.MenuPool.IsAnyMenuOpen() && PlayerPed.CurrentPedGroup.MemberCount < 6) { Ped[] peds = World.GetNearbyPeds(PlayerPed, 1.5f); Ped ped = World.GetClosest <Ped>(PlayerPosition, peds); if (!(ped == null) && !ped.IsDead && !ped.IsInCombatAgainst(PlayerPed) && (int)ped.GetRelationshipWithPed(PlayerPed) != 5 && ped.RelationshipGroup == Relationships.FriendlyRelationship && !(ped.CurrentPedGroup == PlayerPed.CurrentPedGroup)) { Game.DisableControlThisFrame(2, GTA.Control.Enter); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_ENTER~ to recruit this ped.", false); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Enter)) { if (FriendlySurvivors.Instance != null) { FriendlySurvivors.Instance.RemovePed(ped); } ped.Recruit(PlayerPed); if (PlayerPed.CurrentPedGroup.MemberCount >= 6) { UI.Notify("You've reached the max amount of ~b~guards~s~."); } } } } }
private static void OnTick(object sender, EventArgs eventArgs) { if (MenuConrtoller.MenuPool.IsAnyMenuOpen() || RecruitPeds.PlayerPed.get_CurrentPedGroup().get_MemberCount() >= 6) { return; } Ped closest = (Ped)World.GetClosest <Ped>(RecruitPeds.PlayerPosition, (M0[])World.GetNearbyPeds(RecruitPeds.PlayerPed, 1.5f)); if (Entity.op_Equality((Entity)closest, (Entity)null) || ((Entity)closest).get_IsDead() || (closest.IsInCombatAgainst(RecruitPeds.PlayerPed) || closest.GetRelationshipWithPed(RecruitPeds.PlayerPed) == 5) || (closest.get_RelationshipGroup() != Relationships.FriendlyRelationship || PedGroup.op_Equality(closest.get_CurrentPedGroup(), RecruitPeds.PlayerPed.get_CurrentPedGroup()))) { return; } Game.DisableControlThisFrame(2, (Control)23); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_ENTER~ to recruit this ped.", false); if (!Game.IsDisabledControlJustPressed(2, (Control)23)) { return; } if (FriendlySurvivors.Instance != null) { FriendlySurvivors.Instance.RemovePed(closest); } closest.Recruit(RecruitPeds.PlayerPed); if (RecruitPeds.PlayerPed.get_CurrentPedGroup().get_MemberCount() < 6) { return; } UI.Notify("You've reached the max amount of ~b~guards~s~."); }
private void TryUseMapProp(MapProp mapProp) { bool pickup = mapProp.CanBePickedUp && EditMode; if (pickup || mapProp.Interactable) { if (pickup) { Game.DisableControlThisFrame(2, GTA.Control.Context); } if (mapProp.Interactable) { DisableAttackActions(); } GameExtended.DisableWeaponWheel(); UiExtended.DisplayHelpTextThisFrame(string.Format("{0}", pickup ? $"Press ~INPUT_CONTEXT~ to pickup the {mapProp.Id}.\n" : ((!EditMode) ? "You're not in edit mode.\n" : "")) + string.Format("{0}", mapProp.Interactable ? string.Format("Press ~INPUT_ATTACK~ to {0}.", mapProp.IsDoor ? "Lock/Unlock" : "interact") : ""), false); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Attack) && mapProp.Interactable) { PlayerMap.Interacted?.Invoke(mapProp, PlayerInventory.Instance.ItemFromName(mapProp.Id)); } if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context) && mapProp.CanBePickedUp && PlayerInventory.Instance.PickupItem(PlayerInventory.Instance.ItemFromName(mapProp.Id), ItemType.Item)) { mapProp.Delete(); _map.Remove(mapProp); ZombieVehicleSpawner.Instance.SpawnBlocker.Remove(mapProp.Position); } } }
private void CreateItemPreview() { if (Entity.op_Equality((Entity)this._currentPreview, (Entity)null)) { this.PreviewComplete = false; this._currentOffset = Vector3.get_Zero(); Prop prop = World.CreateProp(Model.op_Implicit(this._currnetPropHash), (Vector3)null, (Vector3)null, false, false); if (Entity.op_Equality((Entity)prop, (Entity)null)) { UI.Notify(string.Format("Failed to load prop, even after request.\nProp Name: {0}", (object)this._currnetPropHash)); this._resultProp = (Prop)null; this._preview = false; this.PreviewComplete = true; } else { ((Entity)prop).set_HasCollision(false); this._currentPreview = prop; ((Entity)this._currentPreview).set_Alpha(150); Database.PlayerPed.get_Weapons().Select((WeaponHash) - 1569615261, true); this._resultProp = (Prop)null; } } else { UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_AIM~ to cancel.\nPress ~INPUT_ATTACK~ to place the item.", true); Game.DisableControlThisFrame(2, (Control)25); Game.DisableControlThisFrame(2, (Control)24); Game.DisableControlThisFrame(2, (Control)257); Game.DisableControlThisFrame(2, (Control)152); Game.DisableControlThisFrame(2, (Control)153); Game.DisableControlThisFrame(2, (Control)44); Game.DisableControlThisFrame(2, (Control)27); Game.DisableControlThisFrame(2, (Control)172); Game.DisableControlThisFrame(2, (Control)173); Game.DisableControlThisFrame(2, (Control)21); GameExtended.DisableWeaponWheel(); if (Game.IsDisabledControlPressed(2, (Control)25)) { ((Entity)this._currentPreview).Delete(); this._currentPreview = this._resultProp = (Prop)null; this._preview = false; this.PreviewComplete = true; ScriptEventHandler.Instance.UnregisterScript(new EventHandler(this.OnTick)); } else { Vector3 position = GameplayCamera.get_Position(); Vector3 direction = GameplayCamera.get_Direction(); RaycastResult raycastResult = World.Raycast(position, Vector3.op_Addition(position, Vector3.op_Multiply(direction, 15f)), (IntersectOptions) - 1, (Entity)Database.PlayerPed); Vector3 hitCoords = ((RaycastResult) ref raycastResult).get_HitCoords(); if (Vector3.op_Inequality(hitCoords, Vector3.get_Zero()) && (double)((Vector3) ref hitCoords).DistanceTo(Database.PlayerPosition) > 1.5) { ItemPreview.DrawScaleForms(); float num = Game.IsControlPressed(2, (Control)21) ? 1.5f : 1f; if (Game.IsControlPressed(2, (Control)152)) { Vector3 rotation = ((Entity)this._currentPreview).get_Rotation(); ref __Null local = ref rotation.Z;
private void LootDeadPeds() { if (!PlayerPed.IsInVehicle()) { Ped ped = World.GetClosest <Ped>(PlayerPosition, World.GetNearbyPeds(PlayerPed, 1.5f)); if (!(ped == null) && ped.IsDead && !_lootedPeds.Contains(ped)) { UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to loot.", false); Game.DisableControlThisFrame(2, GTA.Control.Context); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context)) { PlayerInventory.LootedPed?.Invoke(ped); } } } }
private void OnTick(object sender, EventArgs eventArgs) { if (!PlayerPed.IsInVehicle() && !MenuConrtoller.MenuPool.IsAnyMenuOpen() && PlayerPed.CurrentPedGroup.MemberCount > 0) { Ped[] peds = World.GetNearbyPeds(PlayerPed, 1.5f); Ped ped = World.GetClosest <Ped>(PlayerPosition, peds); if (!(ped == null) && !ped.IsInVehicle() && !(ped.CurrentPedGroup != PlayerPed.CurrentPedGroup)) { Game.DisableControlThisFrame(2, GTA.Control.Context); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to configure this ped.", false); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context)) { _selectedPed = ped; _pedMenu.Visible = !_pedMenu.Visible; } } } }
private void OnTick(object sender, EventArgs eventArgs) { if (this.PlayerPed.IsInVehicle() || MenuConrtoller.MenuPool.IsAnyMenuOpen() || this.PlayerPed.get_CurrentPedGroup().get_MemberCount() <= 0) { return; } Ped closest = (Ped)World.GetClosest <Ped>(this.PlayerPosition, (M0[])World.GetNearbyPeds(this.PlayerPed, 1.5f)); if (Entity.op_Equality((Entity)closest, (Entity)null) || closest.IsInVehicle() || PedGroup.op_Inequality(closest.get_CurrentPedGroup(), this.PlayerPed.get_CurrentPedGroup())) { return; } Game.DisableControlThisFrame(2, (Control)51); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to configure this ped.", false); if (!Game.IsDisabledControlJustPressed(2, (Control)51)) { return; } this._selectedPed = closest; this._pedMenu.set_Visible(!this._pedMenu.get_Visible()); }
private void TryInteract(Entity prop) { if (!(prop == null) && !(prop.Position.VDist(base.PlayerPosition) >= 2.3f)) { UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to loot.", false); Game.DisableControlThisFrame(2, GTA.Control.Context); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context)) { prop.Delete(); switch (_dropType) { case DropType.Loot: { int rand = Database.Random.Next(1, 3); PlayerInventory.Instance.PickupLoot(null, ItemType.Item, rand, rand, 0.4f); break; } case DropType.Weapons: { int rand2 = Database.Random.Next(3, 5); int amount2 = 0; for (int i = 0; i <= rand2; i++) { WeaponHash[] weaponHashes = ((WeaponHash[])Enum.GetValues(typeof(WeaponHash))).Where(IsGoodHash).ToArray(); if (weaponHashes.Length != 0) { WeaponHash hash = weaponHashes[Database.Random.Next(weaponHashes.Length)]; base.PlayerPed.Weapons.Give(hash, Database.Random.Next(20, 45), false, true); amount2++; } } UI.Notify($"Found ~g~{amount2}~s~ weapons."); break; } } Complete(); } } }
private void TryInteract(Entity prop) { if (Entity.op_Equality(prop, (Entity)null) || (double)prop.get_Position().VDist(this.PlayerPosition) >= 2.29999995231628) { return; } UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to loot.", false); Game.DisableControlThisFrame(2, (Control)51); if (!Game.IsDisabledControlJustPressed(2, (Control)51)) { return; } prop.Delete(); switch (this._dropType) { case MerryweatherSurvivors.DropType.Weapons: int num1 = Database.Random.Next(3, 5); int num2 = 0; for (int index = 0; index <= num1; ++index) { // ISSUE: method pointer WeaponHash[] array = ((IEnumerable <WeaponHash>)Enumerable.Where <WeaponHash>((IEnumerable <M0>)Enum.GetValues(typeof(WeaponHash)), (Func <M0, bool>) new Func <WeaponHash, bool>((object)this, __methodptr(IsGoodHash)))).ToArray <WeaponHash>(); if (array.Length != 0) { this.PlayerPed.get_Weapons().Give((WeaponHash)(int)(uint)array[Database.Random.Next(array.Length)], Database.Random.Next(20, 45), false, true); ++num2; } } UI.Notify(string.Format("Found ~g~{0}~s~ weapons.", (object)num2)); break; case MerryweatherSurvivors.DropType.Loot: int num3 = Database.Random.Next(1, 3); PlayerInventory.Instance.PickupLoot((Ped)null, ItemType.Item, num3, num3, 0.4f); break; } this.Complete(); }
private void OnTick(object sender, EventArgs e) { if (this.Spawn) { if (!MenuConrtoller.MenuPool.IsAnyMenuOpen()) { if (ZombieCreator.IsNightFall() && !this._nightFall) { UiExtended.DisplayHelpTextThisFrame("Nightfall approaches. Zombies are far more ~r~aggressive~s~ at night.", false); this._nightFall = true; } else if (!ZombieCreator.IsNightFall()) { this._nightFall = false; } } this.SpawnVehicles(); this.SpawnPeds(); } else { this.ClearAll(); } }
private void OnTick(object sender, EventArgs e) { if (!Database.PlayerInVehicle) { Vehicle vehicle = World.GetClosestVehicle(Database.PlayerPosition, 20f); if (_item == null) { _item = PlayerInventory.Instance.ItemFromName("Vehicle Repair Kit"); } if (_selectedVehicle != null) { Game.DisableControlThisFrame(2, GTA.Control.Attack); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_ATTACK~ to cancel.", false); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Attack)) { PlayerPed.Task.ClearAllImmediately(); _selectedVehicle.CloseDoor(GTA.VehicleDoor.Hood, false); _selectedVehicle = null; } else if (PlayerPed.TaskSequenceProgress == -1) { _selectedVehicle.EngineHealth = 1000f; _selectedVehicle.CloseDoor(GTA.VehicleDoor.Hood, false); _selectedVehicle = null; PlayerInventory.Instance.AddItem(_item, -1, ItemType.Item); UI.Notify("Items: -~r~1"); } } else if (vehicle != null) { Model model = vehicle.Model; if (model.IsCar && vehicle.EngineHealth < 1000f && !MenuConrtoller.MenuPool.IsAnyMenuOpen() && !vehicle.IsUpsideDown && vehicle.HasBone("engine")) { Vector3 pos = vehicle.GetBoneCoord(vehicle.GetBoneIndex("engine")); if (!(pos == Vector3.Zero) && PlayerPed.IsInRangeOf(pos, 1.5f)) { if (!PlayerInventory.Instance.HasItem(_item, ItemType.Item)) { UiExtended.DisplayHelpTextThisFrame("You need a vehicle repair kit to fix this engine.", false); } else { Game.DisableControlThisFrame(2, GTA.Control.Context); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to repair engine.", false); if (Game.IsDisabledControlJustPressed(2, GTA.Control.Context)) { vehicle.OpenDoor(GTA.VehicleDoor.Hood, false, false); PlayerPed.Weapons.Select(GTA.Native.WeaponHash.Wrench, true); Vector3 position = pos + vehicle.ForwardVector; Vector3 val = vehicle.Position - Database.PlayerPosition; float heading = val.ToHeading(); TaskSequence sequence = new TaskSequence(); sequence.AddTask.ClearAllImmediately(); sequence.AddTask.GoTo(position, false, 1500); sequence.AddTask.AchieveHeading(heading, 2000); sequence.AddTask.PlayAnimation("mp_intro_seq@", "mp_mech_fix", 8f, -8f, _repairTimeMs, GTA.AnimationFlags.Loop, 1f); sequence.AddTask.ClearAll(); sequence.Close(); PlayerPed.Task.PerformSequence(sequence); sequence.Dispose(); _selectedVehicle = vehicle; } } } } } } }
private void CreateItemPreview() { if (_currentPreview == null) { PreviewComplete = false; _currentOffset = Vector3.Zero; Prop newProp = World.CreateProp(_currnetPropHash, default(Vector3), default(Vector3), false, false); if (newProp == null) { UI.Notify($"Failed to load prop, even after request.\nProp Name: {_currnetPropHash}"); _resultProp = null; _preview = false; PreviewComplete = true; } else { newProp.HasCollision = false; _currentPreview = newProp; _currentPreview.Alpha = 150; Database.PlayerPed.Weapons.Select(GTA.Native.WeaponHash.Unarmed, true); _resultProp = null; } } else { UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_AIM~ to cancel.\nPress ~INPUT_ATTACK~ to place the item.", true); Game.DisableControlThisFrame(2, GTA.Control.Aim); Game.DisableControlThisFrame(2, GTA.Control.Attack); Game.DisableControlThisFrame(2, GTA.Control.Attack2); Game.DisableControlThisFrame(2, GTA.Control.ParachuteBrakeLeft); Game.DisableControlThisFrame(2, GTA.Control.ParachuteBrakeRight); Game.DisableControlThisFrame(2, GTA.Control.Cover); Game.DisableControlThisFrame(2, GTA.Control.Phone); Game.DisableControlThisFrame(2, GTA.Control.PhoneUp); Game.DisableControlThisFrame(2, GTA.Control.PhoneDown); Game.DisableControlThisFrame(2, GTA.Control.Sprint); GameExtended.DisableWeaponWheel(); if (Game.IsDisabledControlPressed(2, GTA.Control.Aim)) { _currentPreview.Delete(); _currentPreview = (_resultProp = null); _preview = false; PreviewComplete = true; ScriptEventHandler.Instance.UnregisterScript(OnTick); } else { Vector3 camPos = GameplayCamera.Position; Vector3 camDir = GameplayCamera.Direction; RaycastResult cast = World.Raycast(camPos, camPos + camDir * 15f, -1, new IntersectOptions(), Database.PlayerPed); Vector3 coords = cast.HitCoords; if (coords != Vector3.Zero && coords.DistanceTo(Database.PlayerPosition) > 1.5f) { DrawScaleForms(); float speed = Game.IsControlPressed(2, GTA.Control.Sprint) ? 1.5f : 1f; if (Game.IsControlPressed(2, GTA.Control.ParachuteBrakeLeft)) { Vector3 rotation2 = _currentPreview.Rotation; rotation2.Z += Game.LastFrameTime * 50f * speed; _currentPreview.Rotation = rotation2; } else if (Game.IsControlPressed(2, GTA.Control.ParachuteBrakeRight)) { Vector3 rotation = _currentPreview.Rotation; rotation.Z -= Game.LastFrameTime * 50f * speed; _currentPreview.Rotation = rotation; } if (Game.IsControlPressed(2, GTA.Control.PhoneUp)) { _currentOffset.Z += Game.LastFrameTime * speed; } else if (Game.IsControlPressed(2, GTA.Control.PhoneDown)) { _currentOffset.Z -= Game.LastFrameTime * speed; } _currentPreview.Position = coords + _currentOffset; _currentPreview.IsVisible = true; if (Game.IsDisabledControlJustPressed(2, GTA.Control.Attack)) { _currentPreview.ResetAlpha(); _resultProp = _currentPreview; _resultProp.HasCollision = true; _resultProp.FreezePosition = !_isDoor; _preview = false; _currentPreview = null; _currnetPropHash = string.Empty; PreviewComplete = true; ScriptEventHandler.Instance.UnregisterScript(OnTick); } } else { _currentPreview.IsVisible = false; } } } }
private void OnTick(object sender, EventArgs e) { if (Database.PlayerInVehicle) { return; } Vehicle closestVehicle = World.GetClosestVehicle(Database.PlayerPosition, 20f); if (this._item == null) { this._item = PlayerInventory.Instance.ItemFromName("Vehicle Repair Kit"); } if (Entity.op_Inequality((Entity)this._selectedVehicle, (Entity)null)) { Game.DisableControlThisFrame(2, (Control)24); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_ATTACK~ to cancel.", false); if (Game.IsDisabledControlJustPressed(2, (Control)24)) { VehicleRepair.PlayerPed.get_Task().ClearAllImmediately(); this._selectedVehicle.CloseDoor((VehicleDoor)4, false); this._selectedVehicle = (Vehicle)null; } else { if (VehicleRepair.PlayerPed.get_TaskSequenceProgress() != -1) { return; } this._selectedVehicle.set_EngineHealth(1000f); this._selectedVehicle.CloseDoor((VehicleDoor)4, false); this._selectedVehicle = (Vehicle)null; PlayerInventory.Instance.AddItem(this._item, -1, ItemType.Item); UI.Notify("Items: -~r~1"); } } else { if (!Entity.op_Inequality((Entity)closestVehicle, (Entity)null)) { return; } Model model = ((Entity)closestVehicle).get_Model(); if (!((Model) ref model).get_IsCar() || (double)closestVehicle.get_EngineHealth() >= 1000.0 || MenuConrtoller.MenuPool.IsAnyMenuOpen() || ((Entity)closestVehicle).get_IsUpsideDown() || !((Entity)closestVehicle).HasBone("engine")) { return; } Vector3 boneCoord = ((Entity)closestVehicle).GetBoneCoord(((Entity)closestVehicle).GetBoneIndex("engine")); if (Vector3.op_Equality(boneCoord, Vector3.get_Zero()) || !((Entity)VehicleRepair.PlayerPed).IsInRangeOf(boneCoord, 1.5f)) { return; } if (!PlayerInventory.Instance.HasItem(this._item, ItemType.Item)) { UiExtended.DisplayHelpTextThisFrame("You need a vehicle repair kit to fix this engine.", false); } else { Game.DisableControlThisFrame(2, (Control)51); UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to repair engine.", false); if (!Game.IsDisabledControlJustPressed(2, (Control)51)) { return; } closestVehicle.OpenDoor((VehicleDoor)4, false, false); VehicleRepair.PlayerPed.get_Weapons().Select((WeaponHash) - 1569615261, true); Vector3 vector3_1 = Vector3.op_Addition(boneCoord, ((Entity)closestVehicle).get_ForwardVector()); Vector3 vector3_2 = Vector3.op_Subtraction(((Entity)closestVehicle).get_Position(), Database.PlayerPosition); float heading = ((Vector3) ref vector3_2).ToHeading(); TaskSequence taskSequence = new TaskSequence(); taskSequence.get_AddTask().ClearAllImmediately(); taskSequence.get_AddTask().GoTo(vector3_1, false, 1500); taskSequence.get_AddTask().AchieveHeading(heading, 2000); taskSequence.get_AddTask().PlayAnimation("mp_intro_seq@", "mp_mech_fix", 8f, -8f, this._repairTimeMs, (AnimationFlags)1, 1f); taskSequence.get_AddTask().ClearAll(); taskSequence.Close(); VehicleRepair.PlayerPed.get_Task().PerformSequence(taskSequence); taskSequence.Dispose(); this._selectedVehicle = closestVehicle; } } }