private void StartScenario() { _scenario = new ScenarioHelper(DetectivePed, ScenarioHelper.Scenario.CODE_HUMAN_POLICE_INVESTIGATE); _scenario.StartLooped(); GameFiber.Sleep(1500); var sw = new Stopwatch(); sw.Start(); var ran = Fiskey111Common.Rand.RandomNumber(10, 25); while (sw.Elapsed.Seconds < ran) { GameFiber.Yield(); } _scenario.Stop(); DetectivePed.Tasks.GoToOffsetFromEntity(Game.LocalPlayer.Character, 3f, 10f, 4f); while (DetectivePed.Position.DistanceTo(Game.LocalPlayer.Character) > 3.5f) { GameFiber.Yield(); } "Scenario ended".AddLog(); _processHost.SwapProcesses(StartScenario, AwaitPlayerTalk); }
private void Searching() { if (NativeFunction.Natives.HAS_ENTITY_CLEAR_LOS_TO_ENTITY <bool>(Game.LocalPlayer.Character, _sus, 17)) { if (!_areaBlip.Exists()) { _areaBlip = new Blip(_sus) { Scale = 0.75f } } ; } if (!NativeFunction.Natives.HAS_ENTITY_CLEAR_LOS_TO_ENTITY <bool>(Game.LocalPlayer.Character, _sus, 17)) { if (_areaBlip.Exists()) { _areaBlip.Delete(); } } if (Game.LocalPlayer.Character.Position.DistanceTo(_sus) < 10f && !_isPursuit && !_isBusy) { var helper = MathHelper.GetRandomInteger(50); switch (helper) { case 1: case 2: case 3: if (_scenario.Exists) { if (_scenario.IsRunning) { _scenario.Stop(); } } _isPursuit = true; _pursuit = Functions.CreatePursuit(); Functions.SetPursuitIsActiveForPlayer(_pursuit, true); Functions.AddPedToPursuit(_pursuit, _sus); _isBusy = true; break; case 4: case 5: case 6: case 7: if (_scenario.Exists) { if (_scenario.IsRunning) { _scenario.Stop(); } } string[] gun = { "WEAPON_CARBINERIFLE", "WEAPON_PISTOL", "WEAPON_KNIFE" }; var weapon = new Weapon(new WeaponAsset(gun[MathHelper.GetRandomInteger(gun.Length)]), _sus.Position, 200); weapon.GiveTo(_sus); _sus.KeepTasks = true; _sus.RelationshipGroup = new RelationshipGroup("Suspect"); _sus.RelationshipGroup.SetRelationshipWith(Game.LocalPlayer.Character.RelationshipGroup, Relationship.Hate); _sus.RelationshipGroup.SetRelationshipWith(RelationshipGroup.Cop, Relationship.Hate); _sus.Tasks.FightAgainstClosestHatedTarget(50f); _isBusy = true; break; } } if (Functions.IsPedGettingArrested(_sus) || Functions.IsPedStoppedByPlayer(_sus)) { if (_scenario.Exists) { if (_scenario.IsRunning) { _scenario.Stop(); } } } if (_isPursuit && !Functions.IsPursuitStillRunning(_pursuit)) { this.SetScriptFinished(); } if (!Functions.IsPedArrested(_sus) && !_sus.IsDead) { return; } this.SetScriptFinished(); }