void DutyOn() { if (OnDutyStat) { SendScriptCommand("E8450404-F1B8-4505-A3B6-D77B9C9BF933", "ProceedSuspect"); return; } OnDutyStat = true; logger.Log("Start On Duty function", "Duty"); this.Interval = 100; if (Player.isOnMission) { logger.Log("Player is on mission, Request Aborted and disabled Mod", "Duty", Engine.API.Logger.LogLevel.Warning); return; } logger.Log("Changing Random Cop Model and Relationship", "Duty"); Player.Model = Model.BasicCopModel; Player.Character.RelationshipGroup = RelationshipGroup.Cop; Vector3 CarPosition = new Vector3(85.9519f, -724.686f, 4.99546f); Vehicle dutyCar = World.CreateVehicle(Model.BasicPoliceCarModel, CarPosition); Blip dutyCarBlip = dutyCar.AttachBlip(); dutyCarBlip.Icon = BlipIcon.Building_Garage; // yellow on IV/TLaD, pink on TBoGT dutyCarBlip.Color = BlipColor.Yellow; Programming.TransferInfo.CopCar = dutyCar; logger.Log("Sending arrest enabled signal", "Duty"); SendScriptCommand(new Guid("E8450404-F1B8-4505-A3B6-D77B9C9BF933"), "EnableArrest", dutyCar); NGame.PrintSubtitle(NLanguage.GetLangStr("OnDutyNow")); }
void Load_Mod() { try { Vector3 vector = new Vector3(79.2884f, -713.946f, 4.95886f); logger.Log("Initilazing Checkpoint", "Main"); CheckArrow = new NArrowCheckpoint(vector, new RGBColor(255, 215, 0)); World.UnlockAllIslands(); stationBlip = Blip.AddBlip(vector); stationBlip.Icon = BlipIcon.Building_PoliceStation; logger.Log("Initilazing Mod Functions", "Main"); CheckArrow.CheckpointTriggered += new NArrowCheckpoint.CheckpointTriggeredHandler(Main_Tick); this.BindKey(System.Windows.Forms.Keys.End, SirenSwitchDriver); this.GUID = new Guid("2AA8D642-C91F-4688-A32C-7D27F588014A"); InfoDraw = NLanguage.GetLangStr("OnDuty"); Wait(3000); InfoDraw = NLanguage.GetLangStr("NameDraw"); Controller.LoadAllPlugins(); if (Controller.plugins.Count != 0) { Controller.ExecuteAllPluginMethod("OnInitialized"); } } catch (Exception ex) { logger.Log("Fatal Error During Initilazing Mod, Caused by: " + ex.Message + Environment.NewLine + ex.ToString(), Engine.API.Logger.LogLevel.Fatal); Game.DisplayText("Fatal Error of Landtory! Check Landtory.log for more info."); } }
void ProceedArrestedSuspect(Script sender, ObjectCollection parameter) { try { if (suspect == null) { logger.Log("Proceed arrest signal invaild", "Arrest", Logger.LogLevel.Warning); return; } logger.Log("Proceed arrested suspect signal received", "Arrest"); if (OnArrest = false || !Exists(suspect) || PlayAnim == true || !suspect.GTAPed.isAliveAndWell) { return; } OnArrest = false; if (suspect.IsInVehicle()) { suspect.GTAPed.Task.LeaveVehicle(); } for (int num11 = 51; num11 > 1; num11--) { Functions.SetPedAlpha(suspect.GTAPed, num11 * 5); Game.WaitInCurrentScript(10); } logger.Log("Deleting suspect", "Arrest"); Functions.SetPedAlpha(suspect.GTAPed, 0); suspect.GTAPed.NoLongerNeeded(); suspect.GTAPed.Delete(); suspect = null; logger.Log("Suspect Apprehended", "Arrest"); NGame.PrintSubtitle(NLanguage.GetLangStr("Apprehended")); } catch (NullReferenceException) { logger.Log("Null Reference Exception reported", "Arrest", Logger.LogLevel.Fatal); } catch (NonExistingObjectException) { logger.Log("Non Existing Object Exception reported", "Arrest"); } }
void SirenSwitchDriver() { if (Exists(Player.Character.CurrentVehicle) == false) { logger.Log("Siren without Driver switch failed: No Vehicle", "Main"); NGame.PrintSubtitle(NLanguage.GetLangStr("SirenDriverNoVehicle")); return; } if (SirenDriver) { Player.Character.CurrentVehicle.AllowSirenWithoutDriver = false; SirenDriver = false; NGame.PrintSubtitle(NLanguage.GetLangStr("SirenWithoutDriverOff")); logger.Log("Siren without Driver OFF", "Main"); } else { Player.Character.CurrentVehicle.AllowSirenWithoutDriver = true; SirenDriver = true; NGame.PrintSubtitle(NLanguage.GetLangStr("SirenWithoutDriverOn")); logger.Log("Siren without Driver ON", "Main"); } }
void Notified_Render(Script sender, ObjectCollection parameter) { InfoDraw = Programming.TransferInfo.Render; Wait(3000); InfoDraw = NLanguage.GetLangStr("NameDraw"); }
/* * void ArrestSuspectRange() * { * Ped target = World.GetClosestPed(Player.Character.Position,5); * try * { * logger.Log("Starting Arrest"); * if (target == null) * { * logger.Log("Arrest Failed: Suspect is null", "Arrest", Logger.LogLevel.Error); * return; * } * if (!Exists(target)) * { * logger.Log("Arrest Failed: Suspect does not exist, or not targetting a ped.", "Arrest", Engine.API.Logger.LogLevel.Error); * return; * } * if (target == suspect.GTAPed) * { * logger.Log("Arrest Failed: Suspect aleardy apprehended", "Arrest", Engine.API.Logger.LogLevel.Error); * NGame.PrintSubtitle("~r~This suspect is aleardy apprehended."); * } * if (OnArrest == true) * { * logger.Log("Arrest Failed: Alerady arresting", "Arrest", Engine.API.Logger.LogLevel.Error); * NGame.PrintSubtitle("~r~You cannot arrest multiple suspect at once."); * return; * } * if (OnDuty == false) * { * return; * } * } * catch (Exception ex) * { * NGame.PrintSubtitle(NLanguage.GetLangStr("ArrestException")); * logger.Log("Exception During Arrest Check: \n" + ex.ToString(), "Arrest", Logger.LogLevel.Error); * return; * } * try * { * logger.Log("Arrest Check Passed, starting arrest", "Arrest"); * Random random = new Random(); * int randomed = random.Next(0, 4); * if (randomed == 1) * { * suspect.GTAPed.Weapons.Glock.Ammo = 5000; * suspect.GTAPed.Task.SwapWeapon(Weapon.Handgun_Glock); * suspect.GTAPed.Task.FightAgainst(Player.Character, -1); * } * suspect = new NPed(target); * OnArrest = true; * if (target.isInVehicle()) * { * target.Task.LeaveVehicle(); * } * } * catch (Exception ex) * { * NGame.PrintSubtitle(NLanguage.GetLangStr("ArrestException")); * logger.Log("Exception During Arrest Init: \n" + ex.ToString(), "Arrest", Logger.LogLevel.Error); * return; * } * if (Exists(Player.LastVehicle)) * { * try * { * AnimationSet anim = new AnimationSet("busted"); * AnimationSet anim2 = new AnimationSet("car_bomb"); * TaskSequence tasks = new TaskSequence(); * if (anim != null && anim2 != null) * { * tasks.AddTask.PlayAnimation(anim, "idle_2_hands_up", 1f); * tasks.AddTask.PlayAnimation(anim2, "set_car_bomb", 1f); * tasks.AddTask.EnterVehicle(World.GetClosestVehicle(Player.Character.Position, 10), VehicleSeat.RightRear); * tasks.Perform(target); * ReadyToProceed = true; * return; * } * else * { * tasks.AddTask.HandsUp(5000); * tasks.AddTask.EnterVehicle(World.GetClosestVehicle(Player.Character.Position, 10), VehicleSeat.RightRear); * tasks.Perform(target); * ReadyToProceed = true; * return; * } * } * catch (Exception ex) * { * NGame.PrintSubtitle("FATAL Error during arrest"); * logger.Log("Arrest suspect error: " + Environment.NewLine + ex.Message + ex.ToString(), "Arrest", Logger.LogLevel.Fatal); * } * } * } */ #endregion void ArrestSuspect() { Ped target = Player.GetTargetedPed(); try { logger.Log("Starting Arrest"); target = Player.GetTargetedPed(); if (!OnDuty) { return; } if (target == null) { logger.Log("Arrest Failed: Null Argument"); return; } } catch (NullReferenceException) { logger.Log("NullReferenceException during Arrest Check"); target = World.GetClosestPed(Game.LocalPlayer.Character.Position, 5.0f); } catch (Exception ex) { NGame.PrintSubtitle(NLanguage.GetLangStr("ArrestException")); logger.Log("Exception During Arrest Check - Checking Null: \n" + ex.ToString(), "Arrest", Logger.LogLevel.Error); return; } try { if (!Exists(target)) { logger.Log("Arrest Failed: Suspect does not exist, or not targetting a ped.", "Arrest", Engine.API.Logger.LogLevel.Error); return; } if (suspect != null && target == suspect.GTAPed) { logger.Log("Arrest Failed: Suspect aleardy apprehended", "Arrest", Engine.API.Logger.LogLevel.Error); NGame.PrintSubtitle("~r~This suspect is aleardy apprehended."); return; } } catch (Exception ex) { NGame.PrintSubtitle(NLanguage.GetLangStr("ArrestException")); logger.Log("Exception During Arrest Check - Checking Exists: \n" + ex.ToString(), "Arrest", Logger.LogLevel.Error); return; } try { if (OnDuty == false) { return; } } catch (Exception ex) { NGame.PrintSubtitle(NLanguage.GetLangStr("ArrestException")); logger.Log("Exception During Arrest Check - Checking Status: \n" + ex.ToString(), "Arrest", Logger.LogLevel.Error); return; } Random random = new Random(); int randomed = random.Next(0, 4); logger.Log("Arrest Check Passed, starting arrest", "Arrest"); try { if (randomed == 1) { suspect.GTAPed.Weapons.Glock.Ammo = 5000; suspect.GTAPed.Task.SwapWeapon(Weapon.Handgun_Glock); suspect.GTAPed.Task.FightAgainst(Player.Character, -1); return; } suspect = new NPed(target); OnArrest = true; if (target.isInVehicle()) { Game.LocalPlayer.Character.SayAmbientSpeech("DRAW_GUN"); target.Task.LeaveVehicle(); } } catch (Exception ex) { NGame.PrintSubtitle(NLanguage.GetLangStr("ArrestException")); logger.Log("Exception During Arrest Init: \n" + ex.ToString(), "Arrest", Logger.LogLevel.Error); return; } target = Player.GetTargetedPed(); if (Exists(Player.LastVehicle)) { try { Game.LocalPlayer.Character.SayAmbientSpeech("ARREST_PLAYER"); AnimationSet anim = new AnimationSet("busted"); AnimationSet anim2 = new AnimationSet("car_bomb"); TaskSequence tasks = new TaskSequence(); if (anim != null && anim2 != null) { tasks.AddTask.PlayAnimation(anim, "idle_2_hands_up", 1f); tasks.AddTask.PlayAnimation(anim2, "set_car_bomb", 1f); tasks.AddTask.Die(); tasks.Perform(target); PlayAnim = true; } else { tasks.AddTask.HandsUp(5000); tasks.AddTask.EnterVehicle(Programming.TransferInfo.CopCar, VehicleSeat.RightRear); tasks.AddTask.Die(); tasks.Perform(target); } Model model = Model.BasicPoliceCarModel; NGame.RequestModel(model.Hash); Vector3 vector = World.GetNextPositionOnStreet(Player.Character.Position.Around(50f)); Vehicle vehicle = World.CreateVehicle(model, vector); Ped pedInstance1 = World.CreatePed(Model.CurrentCopModel, vector.Around(5.0f)); Ped pedInstance2 = World.CreatePed(Model.CurrentCopModel, vector.Around(5.0f)); vehicle.isRequiredForMission = true; pedInstance1.isRequiredForMission = true; pedInstance2.isRequiredForMission = true; if (vehicle == null || pedInstance1 == null || pedInstance2 == null) { logger.Log("Ped will be killed because prisoner transport is not available"); return; } vehicle.SirenActive = true; Blip blip = vehicle.AttachBlip(); blip.Color = BlipColor.Cyan; blip.Friendly = true; blip.Name = "Prisoner Transport"; TaskSequence driverTasks = new TaskSequence(); driverTasks.AddTask.DriveTo(target, 30, false); driverTasks.AddTask.LeaveVehicle(); driverTasks.AddTask.AimAt(target, -1); driverTasks.Perform(pedInstance1); while (!pedInstance1.isSittingInVehicle(vehicle) && !preformed) { preformed = true; Function.Call("REVIVE_INJURED_PED", target); target.Task.EnterVehicle(vehicle, VehicleSeat.LeftRear); } while (target.isSittingInVehicle(vehicle) && settingInVehicle == false) { settingInVehicle = true; pedInstance1.Task.EnterVehicle(vehicle, VehicleSeat.Driver); } while (target.isSittingInVehicle(vehicle) && settingInVehicle && pedInstance1.isSittingInVehicle(vehicle) && !proceeded) { proceeded = true; vehicle.SirenActive = false; pedInstance1.Task.CruiseWithVehicle(vehicle, 15, true); vehicle.DoorLock = DoorLock.ImpossibleToOpen; vehicle.NoLongerNeeded(); target.NoLongerNeeded(); pedInstance1.NoLongerNeeded(); pedInstance2.NoLongerNeeded(); blip.Delete(); vehicle = null; target = null; pedInstance1 = null; pedInstance2 = null; } } catch (Exception ex) { NGame.PrintSubtitle("FATAL Error during arrest"); logger.Log("Arrest suspect error: " + Environment.NewLine + ex.Message + ex.ToString(), "Arrest", Logger.LogLevel.Fatal); } } }