/// <summary> /// Test environment. /// </summary> public static void Main() { PedModels.BuildLookupDictionary(); while (true) { foreach (KeyValuePair <string, PedModelMeta> modelMeta in PedModels.PedModelMetaLookup) { Ped demoPed = new Ped(modelMeta.Key, Game.LocalPlayer.Character.GetOffsetPositionFront(1.5f), 0f); demoPed.Face(Game.LocalPlayer.Character); Game.DisplayNotification($"{demoPed.Model.Name}: {PedModels.GetTextDescription(demoPed, PedDescriptionPropertyType.Build | PedDescriptionPropertyType.Clothing | PedDescriptionPropertyType.Extras | PedDescriptionPropertyType.Hair | PedDescriptionPropertyType.RaceSex)}"); GameFiber.Sleep(8000); if (demoPed) { demoPed.Delete(); } } GameFiber.Yield(); } }
private static void Fiber() { GameFiber.Sleep(1500); if (Hungry > 10f) { Hungry = 10f; } if (Hungry <= 2.5f) { Game.LocalPlayer.Character.Health--; } float offset = 0.01f; if (Game.LocalPlayer.Character.IsSprinting) { offset = 0.1f; hungryBar.ForegroundColor = Color.Red; hungryBar.BackgroundColor = Color.DarkRed; } else { hungryBar.ForegroundColor = Color.White; hungryBar.BackgroundColor = Color.Gray; } Hungry = Hungry - offset; hungryBar.Progress = Hungry * 10; GameFiber.Yield(); }
// Token: 0x06000025 RID: 37 RVA: 0x00005684 File Offset: 0x00003884 private static void Functions_OnOnDutyStateChanged(bool onDuty) { if (onDuty) { Main.RegisterCallouts(); Game.Console.Print("_____________________________________________________________________"); Game.Console.Print(" [Los Santos Protection Squad 2.0]"); Game.Console.Print("Your candidacy as a motorcade driver has been accepted."); Game.Console.Print("© Connor.S - 30/07/2020"); Game.Console.Print("---------------------------------------------------------------------------------------------------------"); Game.FrameRender += EManager.Mod_Credits; if (Main.< > o__12.< > p__0 == null) { Main.< > o__12.< > p__0 = CallSite <Action <CallSite, object, string, bool> > .Create(Binder.InvokeMember(CSharpBinderFlags.ResultDiscarded, "RequestStreamedTextureDict", null, typeof(Main), new CSharpArgumentInfo[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, null), CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.Constant, null) })); } Main.< > o__12.< > p__0.Target(Main.< > o__12.< > p__0, NativeFunction.Natives, "heisthud", true); GameFiber.Sleep(8000); Game.FrameRender -= EManager.Mod_Credits; } }
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); }
public override void Process() { if (state == EHostageSituationState.EnRoute && Vector3.Distance(Game.LocalPlayer.Character.Position, suspect.Position) < 16.5f) { state = EHostageSituationState.OnScene; Scenario(); } if (((!suspect.IsPlayingAnimation(GrabHostageAnimDict, SuspectGrabAnimName) || !hostage.IsPlayingAnimation(GrabHostageAnimDict, HostageGrabbedAnimName)) || (suspect.IsRagdoll || hostage.IsRagdoll)) && arePedsPlayingAnim) { hostage.Tasks.Clear(); suspect.Tasks.Clear(); hostage.ReactAndFlee(suspect); GameFiber.Sleep(1000); if (Globals.Random.Next(4) <= 2) { suspect.Tasks.FightAgainst(Game.LocalPlayer.Character); } else { suspect.ReactAndFlee(Game.LocalPlayer.Character); } arePedsPlayingAnim = false; } if (!suspect.Exists() || suspect.IsDead || Functions.IsPedArrested(suspect)) { this.End(); } base.Process(); }
private static void Main() { while (Game.IsLoading) { GameFiber.Sleep(1000); } Fetcher = new ScriptNativeCallsFetcher() { IsActive = true }; Forms = new FormsManager(); while (true) { GameFiber.Yield(); Fetcher.Tick(); if (Fetcher.HasJustFetched && Forms.IsMainFormVisible) { Forms.MainForm?.Invoke((System.Action)(() => { Forms.MainForm.UpdateCurrentScriptTab(); })); } if (Game.IsKeyDown(Keys.F11)) { Forms.MainForm?.Invoke((System.Action)(() => { Forms.IsMainFormVisible = !Forms.IsMainFormVisible; })); } } }
internal static void CheckVersion() { if (CompareVersions()) { "L.S. Noir Update Check".DisplayNotification("You have the current version of L.S. Noir!", 0); } else { "Newer version available".DisplayNotification($"A newer version of L.S. Noir is available", 0); "Newer version available".DisplayNotification("You are being directed to the download page to download the latest version\nPress ~y~enter~w~ to cancel", 0); var count = 0; while (count <= 300) { if (Game.IsKeyDownRightNow(System.Windows.Forms.Keys.Enter)) { break; } GameFiber.Sleep(20); count++; } System.Diagnostics.Process.Start("http://bit.ly/LSNDownload"); } }
private void SearchForSuspect() { if (!search_fiber.IsAlive) { output_info.SetText("Searching. Please wait..."); search_fiber = GameFiber.StartNew(delegate { GameFiber.Sleep(2500); string name = input_name.Text.ToLower(); List <Ped> peds = World.GetAllPeds().ToList(); peds.RemoveAll(p => !p); peds.OrderBy(p => p.DistanceTo(Game.LocalPlayer.Character.Position)); Ped ped = peds.Where(p => p && Functions.GetPersonaForPed(p).FullName.ToLower() == name).FirstOrDefault(); if (ped) { output_info.Text = GetFormattedInfoForPed(ped); Function.AddPedToRecents(ped); } else { output_info.Text = "No record for the specified name was found."; } }); } }
/// <summary> /// OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from eariler to the pursuit as well /// </summary> /// <returns></returns> public override bool OnCalloutAccepted() { //We accepted the callout, so lets initilize our blip from before and attach it to our ped so we know where he is. heliBlip = crash.AttachBlip(); if (crash.Model == new Model("prop_crashed_heli") || crash.Model == new Model("prop_wrecked_buzzard")) { heliBlip.Sprite = BlipSprite.Helicopter; } else if (crash.Model == new Model("prop_shamal_crash") || crash.Model == new Model("apa_mp_apa_crashed_usaf_01a")) { heliBlip.Sprite = BlipSprite.Plane; } heliBlip.Color = Color.Yellow; heliBlip.EnableRoute(Color.Yellow); Functions.PlayScannerAudioUsingPosition("CRIME_AMBULANCE_REQUESTED IN_OR_ON_POSITION", spawnPoint); explosionBool = true; GameFiber.StartNew(delegate { GameFiber.Sleep(MathHelper.GetRandomInteger(500, 12501)); if (crash.Exists()) { int rndFarExplosion = MathHelper.GetRandomInteger(101); if (rndFarExplosion < 75) { World.SpawnExplosion(crash.Position.AroundPosition(5.0f), 5, 10.0f, true, false, MathHelper.GetRandomSingle(0.0f, 4.0f)); } } }); return(base.OnCalloutAccepted()); }
internal void Launch() { while (Globals.IsPlayerOnDuty) { if (!Globals.PlayerPed.IsOnFoot && Globals.PlayerVehicle.Exists()) { if (Globals.PlayerVehicle.IsPoliceVehicle) { if (!mALPR.IsVehicleAlreadyVerified(Globals.PlayerVehicle)) { ResetTimeAndDisplayWelcome(); GameFiber.Sleep(1000); } if (mALPR.IsActive(Globals.PlayerVehicle) && !Functions.IsPoliceComputerActive()) { mALPR.ScanPlates(); } else if (!mALPR.IsActive(Globals.PlayerVehicle) && !Functions.IsPoliceComputerActive()) { TimeSpan ts = DateTime.Now - Globals.ALPRLastReadyOrActivation; if (ts.TotalMinutes >= 30) { ResetTimeAndDisplayWelcome(); GameFiber.Sleep(1000); } } } } GameFiber.Yield(); } }
private void LoadInteriors() { var wait = CurrentMission.Interiors.Any(x => StaticData.IPLData.Database[x].Item1); foreach (string interior in CurrentMission.Interiors) { if (!StaticData.IPLData.Database.ContainsKey(interior)) { continue; } if (StaticData.IPLData.Database[interior].Item1) { Util.LoadOnlineMap(); } foreach (string s in StaticData.IPLData.Database[interior].Item2) { Util.LoadInterior(s); } foreach (string s in StaticData.IPLData.Database[interior].Item3) { Util.RemoveInterior(s); } } if (wait) { GameFiber.Sleep(5000); } }
internal static void Init() { GameFiber.Sleep(500); Game.LogTrivial("Rel.C: Initializing external plugins"); var plugins = Functions.GetAllUserPlugins(); foreach (var plugin in plugins) { // Prevents multiple plug-ins loading at same time // Wasting resources GameFiber.Yield(); switch (plugin.GetName().Name) { case "StopThePed": Game.LogTrivial("Rel.C: Found Stop The Ped"); StopThePedInstalled = true; break; case "UltimateBackup": Game.LogTrivial("Rel.C: Found Ultimate Backup"); UltimateBackupInstalled = true; break; } } }
private void DisplayCodeFourMessage() { if (CalloutRunning) { foreach (Ped suspect in Suspects) { EscapeCount++; } msg = "Control,"; if (ArrestCount > 0) { msg += " ~g~" + ArrestCount.ToString() + " suspects in custody."; } if (DeadCount > 0) { msg += " ~o~" + DeadCount.ToString() + " suspects dead."; } if (EscapeCount > 0) { msg += " ~r~" + EscapeCount.ToString() + " suspects escaped."; } msg += "~b~Street Race CODE 4, over."; GameFiber.Sleep(4000); Game.DisplayNotification(msg); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); CalloutFinished = true; End(); } }
private void SearchForVehicle() { if (!search_fiber.IsAlive) { output_info.Text = "Searching. Please wait..."; search_fiber = GameFiber.StartNew(delegate { GameFiber.Sleep(2500); string lp_input = input_name.Text.ToLower(); List <Vehicle> vehs = World.GetAllVehicles().ToList(); vehs.RemoveAll(v => !v); vehs.OrderBy(v => v.DistanceTo(Game.LocalPlayer.Character.Position)); Vehicle veh = vehs.Where(v => v && v.LicensePlate.ToLower().Trim() == lp_input).FirstOrDefault(); if (veh) { output_info.Text = GetFormattedInfoForVehicle(veh); Function.AddVehicleToRecents(veh); } else { output_info.Text = "No record for the specified license plate was found."; } }); } }
public void VeryClose() { if (Game.LocalPlayer.Character.Position.DistanceTo(_mainMe) <= 15f) { "At main ME's office".AddLog(); SwapStages(VeryClose, AtLocation); } if (!_main) { _state = ELocation.Done; if (_dialogstate == EDialog.Pre) { _dialogstate = EDialog.During; "Dialog Starting".AddLog(); _driverDialog.StartDialog(); } if (_driverDialog.HasEnded && _dialogstate == EDialog.During) { "Dialog Ending".AddLog(); Game.DisplayHelp("Enter the driver's car"); _dialogstate = EDialog.Post; _playerCar = Game.LocalPlayer.Character.LastVehicle; _me.KeepTasks = true; _me.Tasks.GoStraightToPosition(_meCar.LeftPosition, 3f, 0f, 0f, 1000); GameFiber.Sleep(1000); _me.Tasks.EnterVehicle(_meCar, -1); SwapStages(VeryClose, GettingInCar); } } }
private void SuccessFail() { Game.HideHelp(); var successPlayer = _playerAnims.GetAnimation(Success); var successCop = _targetAnims.GetAnimation(Success); var failPlayer = _playerAnims.GetAnimation(Fail); var failCop = _targetAnims.GetAnimation(Fail); var cop = CopPedList[0]; if (MathHelper.GetChance(2)) { cop.PlayAnimation(successCop); cop.Resurrect(); cop.Health = 1; cop.IsInvincible = true; Player.PlayAnimation(successPlayer); GameFiber.Sleep(successPlayer.AnimationTime); Player.PlayAmbientSpeech("CHAT_STATE"); Game.DisplayHelp("Take the ~b~officer~w~ to the nearest ~g~hospital~w~"); NativeFunction.Natives.CAN_SHUFFLE_SEAT <bool>(Player.LastVehicle, false); cop.Tasks.EnterVehicle(Player.LastVehicle, 0); _stopwatch.Start(); _procHost.SwapProcesses(SuccessFail, WaitForEnterVehicle); } else { cop.PlayAnimation(failCop); Player.PlayAnimation(failPlayer); GameFiber.Sleep(failPlayer.AnimationTime); Player.PlayAmbientSpeech("GENERIC_SHOCKED_HIGH"); _procHost.SwapProcesses(SuccessFail, WaitForPursuitEnd); } }
private static void SpawnVehicleModel <T>(T model) { Type type = model.GetType(); if (!type.IsEnum) { Game.LogTrivial($"Type is not an enum."); return; } try { Vehicle vehicle = new Vehicle(model.ToString(), Game.LocalPlayer.Character.GetOffsetPositionFront(5), Game.LocalPlayer.Character.Heading); Game.LogTrivial($"Spawned {vehicle.GetMakeName()} {vehicle.Model.Name} ({vehicle.Model.Hash})"); _vehicles.Add($"{vehicle.Model.Name} = {vehicle.Model.Hash}"); GameFiber.Sleep(1000); if (vehicle) { vehicle.Delete(); } GameFiber.Sleep(1000); } catch { Game.LogTrivial($"Error spawning {model}"); } }
internal static void DisplayResponseCode(CalloutResponseType code) { string codeDisplay; string codeSound = "RC_"; switch (code) { default: codeSound += "CODE2"; codeDisplay = "~g~Code 2"; break; case CalloutResponseType.Code3: codeSound += "CODE3"; codeDisplay = "~r~Code 3"; break; case CalloutResponseType.Code99: codeSound += "CODE99"; codeDisplay = "~r~Code 99"; break; } GameFiber.StartNew(() => { GameFiber.Sleep(4500); Functions.PlayScannerAudio(codeSound); Game.DisplayNotification("Respond " + codeDisplay); }); }
private void CPRMouth() { Game.HideHelp(); var startPlayer = _playerAnims.GetAnimation(CPR_to_Mouth); var startCop = _targetAnims.GetAnimation(CPR_to_Mouth); var mtmPlayer = _playerAnims.GetAnimation(MTM); var mtmCop = _targetAnims.GetAnimation(MTM); var stopPlayer = _playerAnims.GetAnimation(Mouth_to_CPR); var stopCop = _targetAnims.GetAnimation(Mouth_to_CPR); var cop = CopPedList[0]; cop.PlayAnimation(startCop); Player.PlayAnimation(startPlayer); GameFiber.Sleep(startPlayer.AnimationTime); cop.PlayAnimation(mtmCop); Player.PlayAnimation(mtmPlayer); GameFiber.Sleep(mtmPlayer.AnimationTime); cop.PlayAnimation(stopCop); Player.PlayAnimation(stopPlayer); GameFiber.Sleep(stopPlayer.AnimationTime); if (Rand.RandomNumber(4) == 1) { _procHost.SwapProcesses(CPRMouth, SuccessFail); } _procHost.SwapProcesses(CPRMouth, AwaitKeypress); }
public override void Action() { GameFiber.StartNew(delegate { try { base.Action(); if (this.Animal.Exists()) { this.Animal.ReactAndFlee(this.Hunter); } if (this.Animal.Exists()) { this.Animal.KeepTasks = true; } if (this.Hunter.Exists()) { this.Hunter.AttackPed(this.Animal); } if (this.Hunter.Exists()) { this.Hunter.KeepTasks = true; } while (this.Hunter.Exists() && this.Hunter.IsAlive && this.Animal.Exists() && this.Animal.IsAlive) { GameFiber.Yield(); } if (this.Hunter.Exists() && this.Animal.Exists()) { NativeFunction.CallByName <uint>("TASK_SHOOT_AT_ENTITY", this.Hunter, this.Animal, 6000, (uint)Rage.FiringPattern.BurstFire); } GameFiber.Sleep(5000); if (this.Hunter.Exists() && this.Animal.Exists()) { this.Hunter.Tasks.FollowNavigationMeshToPosition(this.Animal.Position.AroundPosition(0.75f), this.Hunter.Heading, 20.0f).WaitForCompletion(); } if (this.Hunter.Exists() && this.Animal.Exists()) { this.Hunter.Tasks.AchieveHeading(this.Hunter.GetHeadingTowards(this.Animal)).WaitForCompletion(2250); } if (this.Hunter.Exists()) { this.Hunter.Tasks.PlayAnimation("amb@medic@standing@tendtodead@idle_a", tendToDeadIdles.GetRandomElement(), 2.0f, AnimationFlags.Loop); } GameFiber.Sleep(60000); this.CleanUp(); } catch (System.Exception e) { Logger.LogException(this.GetType().Name, e); } }); }
public override bool OnBeforeCalloutDisplayed() { location = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around2D(450f)); ShowCalloutAreaBlipBeforeAccepting(location, 150f); AddMinimumDistanceCheck(100f, location); suspect = new Ped(location); suspect.Tasks.Wander(); GameFiber.Sleep(3000); suspect.Tasks.Clear(); victim = new Ped(suspect.GetOffsetPosition(new Vector3(0, 1.8f, 0))); if (!suspect.Exists()) { return(false); } if (!victim.Exists()) { return(false); } suspect.Inventory.GiveNewWeapon("WEAPON_PISTOL", 120, true); CalloutMessage = "Domestic Disturbance"; CalloutPosition = location; Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT_01 CRIME_SHOTS_FIRED_01 IN POSITION UNITS_RESPOND_CODE_02_01", location); Game.LogTrivialDebug("Raven.Displayed"); return(base.OnBeforeCalloutDisplayed()); }
public static void Process(object sender, GraphicsEventArgs e) { timerBarPool.Draw(); if (Game.IsKeyDown(Keys.F5)) { GameFiber.StartNew(delegate { for (float i = 0f; i < 1f; i += 0.001f) { barTimerBar.Percentage = i; GameFiber.Sleep(10); } }); } if (Game.IsKeyDown(Keys.F6)) { barTimerBar.ForegroundColor = Color.FromArgb(MathHelper.GetRandomInteger(256), MathHelper.GetRandomInteger(256), MathHelper.GetRandomInteger(256)); barTimerBar.BackgroundColor = ControlPaint.Dark(barTimerBar.ForegroundColor); } textTimerBar.Text = World.TimeOfDay.ToString("c"); textTimerBar2.Text = MathHelper.ConvertMetersPerSecondToKilometersPerHourRounded(Game.LocalPlayer.Character.Speed) + " km/h"; }
private void UpdateInstancesLoop <T>(List <object> list) { Func <object, bool> instanceCanDoUpdate = UpdatableDataByType[typeof(T)].InstanceCanDoUpdateCallback; Action <object> onInstanceUpdateCallback = UpdatableDataByType[typeof(T)].OnInstanceUpdateCallback; Action <object> onInstanceUnregisteredCallback = UpdatableDataByType[typeof(T)].OnInstanceUnregisteredCallback; int updatesInterval = UpdatableDataByType[typeof(T)].UpdatesInterval; while (true) { for (int i = list.Count - 1; i >= 0; i--) { object o = list[i]; if (o != null && (instanceCanDoUpdate == null || instanceCanDoUpdate(o))) { onInstanceUpdateCallback?.Invoke(o); } else { onInstanceUnregisteredCallback?.Invoke(o); list.RemoveAt(i); } } GameFiber.Sleep(updatesInterval); } }
public void Procedures() { bool emt = false, emtd = false; GameFiber.StartNew(delegate { GameFiber.Sleep(3000); PedWorker.Position = patient.LeftPosition; NativeFunction.CallByName <uint>("TASK_TURN_PED_TO_FACE_ENTITY", PedDriver, patient, 1000); GameFiber.Sleep(1100); PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@enter", "enter", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(9000); PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@idle_a", "idle_b", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(6000); PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@exit", "exit", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(7000); emtd = true; }); //==================== GameFiber.StartNew(delegate { NativeFunction.CallByName <uint>("TASK_TURN_PED_TO_FACE_ENTITY", PedWorker, patient, 1000); GameFiber.Sleep(1100); PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@enter", "enter", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(2000); PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@idle_a", "idle_b", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(4000); PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@exit", "exit", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(2000); PedWorker.Tasks.PlayAnimation("amb@code_human_police_investigate@idle_intro", "idle_intro", 4, AnimationFlags.StayInEndFrame); GameFiber.Sleep(1500); PedWorker.Tasks.PlayAnimation("amb@code_human_police_investigate@idle_b", "idle_d", 3, AnimationFlags.None); GameFiber.Sleep(9000); emt = true; }); while (!emt && !emtd) { GameFiber.Yield(); } }
protected override void OnUse(Ped playerped, DBVehicle dbVehicle, MyPlayer myPlayer) { // Any erfordert eine Delegate vom Typ Predicate, das als Parameter ein Objekt vom Typ der zugegriffenen Liste hat und Boolean als Rückgabetyp erwartet if (playerped.IsInAnyVehicle(false) && dbVehicle.tankful < 99) { Game.DisplaySubtitle("~h~Seller:~s~ Hey Sir, Please drive to a gas pump and then leave the car", 1000); return; } if (refuelPoints.Any(r => r.IsInRange(playerped.Position)) && dbVehicle.tankful < 99) // Wir checken, ob eines der refuelPoints Items innerhalb des Radius zum Spieler und dessen Auto ist { Game.DisplayHelp("Go to a tank column and press [E]"); if (Game.IsKeyDown(Keys.E)) { dbVehicle.tankful = maxTankful; DBVehicleManager.UpdateVehicle(dbVehicle, maxTankful); Game.DisplayHelp("Wait, your vehicle is being refueled ... "); Game.DisplaySubtitle("~h~Seller: ~b~Please wait", 4000); GameFiber.Sleep(4000); Game.DisplayHelp("Your vehicle has now a full tank!"); if (myPlayer.playerMoney >= 500) { myPlayer.playerMoney -= 500; } Game.DisplaySubtitle("~h~Seller: ~g~Thank you for your visit", 12000); } } base.OnUse(playerped, dbVehicle, myPlayer); }
private void DisplayCodeFourMessage() { if (CalloutRunning) { if (!driver.Exists()) { msg = "The driver ceased to exist."; } else if (Functions.IsPedArrested(driver)) { msg = "The driver is ~g~in custody.~s~"; } else if (driver.IsDead) { msg = "The driver is dead."; } else if (PursuitCreated) { if (Functions.GetActivePursuit() == null) { msg = "The driver has ~r~escaped."; } } msg += " The DUI call is ~g~CODE 4~s~, over."; GameFiber.Sleep(4000); Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Driver Under The Influence", "Dispatch to ~b~" + TrafficPolicerHandler.DivisionUnitBeat, msg); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); CalloutFinished = true; End(); } }
private void DisplayCodeFourMessage() { DeletingNearbyEntities = false; msg = RobberyStore.Name + " ~r~ robbery ~b~code 4."; GameFiber.Wait(2000); //Game.DisplayHelp("If you wish, you can talk to the shopkeeper.") while (CalloutRunning) { GameFiber.Yield(); Game.DisplayHelp("Press ~b~" + AssortedCalloutsHandler.kc.ConvertToString(AssortedCalloutsHandler.EndCallKey) + " ~s~to end the call."); if (Game.IsKeyDown(AssortedCalloutsHandler.EndCallKey)) { break; } } if (CalloutRunning) { GameFiber.Sleep(2000); Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "~b~" + RobberyStore.Name + " ~r~robbery", "~b~" + AssortedCalloutsHandler.DivisionUnitBeat + "~s~ to Dispatch", msg); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); CalloutFinished = true; End(); } }
public override void OnProcessEvent() { GameFiber.Yield(); if (this.IsPulledOverDriver()) { if (Tools.HavingChance(5, 10)) { this.Driver.CanAttackFriendlies = true; } Logger.Log("The driver's behaviour is ~o~supect. You can investigate", true); FunctionsLSPDFR.PlayScannerAudioUsingPosition("INTRO_01 OFFICERS_REPORT_02 SUSPICIOUS PERSON IN_OR_ON_POSITION OUTRO_03 NOISE_SHORT CODE4_ADAM PROCEED_WITH_PATROL NOISE_SHORT OUTRO_02", PedsManager.LocalPlayer().Position); this.IsPerformedPullOver = true; this.IsEventRunning = false; return; } if (PedsManager.IsAwayFromLocalPlayer(this.Driver.Position)) { this.IsEventRunning = false; return; } if (Tools.HavingChance(30, 100) && false == this.RecklessDriving) { this.HandleRecklessDrinving(); } this.HandleSafeEventRunning(); GameFiber.Sleep(300); }
public static void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index) { if (sender == mainMenu) { if (selectedItem == confirmRoute && !isinRoute) { if (routeList.Items[routeList.Index] != "Empty") { GameFiber.StartNew(delegate { GameFiber.Sleep(500); Game.DisplayNotification("Route Loaded"); isinRoute = !isinRoute; confirmRoute.Text = "Stop Route"; loadedRoute = routeList.Items[routeList.Index]; }); } } if (selectedItem == confirmRoute && isinRoute) { GameFiber.StartNew(delegate { isinRoute = !isinRoute; GameFiber.Sleep(500); Game.DisplayNotification("Route Unloaded"); confirmRoute.Text = "Start Route"; loadedRoute = "Empty"; }); } } }
public static void Main() { Vector3 spawnPosition = Game.LocalPlayer.Character.GetOffsetPositionFront(7f); Vehicle vehicle = new Vehicle(spawnPosition); Camera.DeleteAllCameras(); GameFiber.Sleep(1000); Camera CharacterDesignerCam = new Camera(false); CharacterDesignerCam.FOV = 60.0f; CharacterDesignerCam.Active = true; CharacterDesignerCam.PointAtEntity(vehicle, new Vector3(), false); //Camera CharacterDesignerCam = new Camera(false); //Nati //GameFiber.Sleep(5000); //CharacterDesignerCam.PointAtEntity(Game.LocalPlayer.Character, new Vector3(), false); //CharacterDesignerCam.Active = true; float angle = 0; float dist = 10; for (int i = 0; i < 10000; i++) { // Start a new fiber, that'll execute the HandleSuicideBomber method. //GameFiber.StartNew(Class1.HandleSuicideBomber); //NativeFunction.Natives.DrawLine(vehicle.FrontPosition.X, vehicle.FrontPosition.Y, vehicle.FrontPosition.Z, vehicle.FrontPosition.X, vehicle.FrontPosition.Y, vehicle.FrontPosition.Z + 2, 255, 0, 0, 255); //NativeFunction.Natives.DrawLine(vehicle.LeftPosition.X, vehicle.LeftPosition.Y, vehicle.LeftPosition.Z, vehicle.LeftPosition.X, vehicle.LeftPosition.Y, vehicle.LeftPosition.Z + 1, 255, 0, 0, 255); CharacterDesignerCam.Position = vehicle.Position + new Vector3((float)Math.Sin(angle) * dist, (float)Math.Cos(angle) * dist, 0.5f); angle += 0.01f; GameFiber.Yield(); //NativeFunction.Natives.DrawCircle(Rage.World.ConvertWorldPositionToScreenPosition(vehicle.FrontPosition), 10.0f, 10, 255, 255); try { Game.DisplaySubtitle(Rage.World.ConvertWorldPositionToScreenPosition(vehicle.FrontPosition).ToString()); Vector2 position = new Vector2(0, 0); //Game.LogTrivial("Enabling Player Loop..."); float radius = 0; Color color = Color.White; //Rage.Graphics.DrawCircle(position, radius, color); } finally { } } }