public void License() // LICENSE SCENARIO { Logger.LogTrivial(this.GetType().Name, "License()"); scenario = EScenario.License; GameFiber.StartNew(delegate { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterLicenseAnswers.GetRandomElement(), 2500); hunter.Tasks.PlayAnimation("mp_WildernessCallouts.Common", "givetake1_a", 2.5f, AnimationFlags.None); isPursuitRunning = false; WildernessCallouts.Common.HuntingLicense(hunter); while (true) { GameFiber.Yield(); if (breakForceEnd) { break; } Game.DisplayHelp("Press ~b~" + Controls.PrimaryAction.ToUserFriendlyName() + "~w~ to let the hunter leave~n~Press ~r~" + Controls.SecondaryAction.ToUserFriendlyName() + "~w~ if the license is invalid"); if (Controls.PrimaryAction.IsJustPressed()) { Game.DisplaySubtitle("~b~" + Settings.General.Name + ": ~w~" + policeLicenseGood.GetRandomElement(), 2500); state = EIllegalHuntingState.End; hunter.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Speech.GENERIC_THANKS : Speech.GENERIC_BYE); break; } else if (Controls.SecondaryAction.IsJustPressed()) { Game.DisplaySubtitle("~b~" + Settings.General.Name + ": ~w~" + policeLicenseBad.GetRandomElement(), 2500); licenseHasBeenGiven = true; GameFiber.Wait(2250); int rndState = Globals.Random.Next(101); if (rndState <= 8) { Shoot(); } else if (rndState >= 30 && rndState < 55) { NoLicenseFlee(); } else { NoLicenseStay(); } break; } } }); }
public override bool OnCalloutAccepted() { animal.Kill(); animalBlip = animal.AttachBlip(); animalBlip.Sprite = BlipSprite.Hunting; animalBlip.Color = Color.GreenYellow; animalBlip.EnableRoute(Color.Green); animalBlip.Scale = 1.3f; if (rndAimAtAnimal == 1) { NativeFunction.Natives.TASK_AIM_GUN_AT_ENTITY(hunter, animal, -1, true); } state = EIllegalHuntingState.EnRoute; return(base.OnCalloutAccepted()); }
// SCENARIOS public void Shoot() // SHOOT SCENARIO { Logger.LogTrivial(this.GetType().Name, "Shoot()"); scenario = EScenario.Shoot; GameFiber.StartNew(delegate { if (!licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterNoLicenseAndAttackAnswers.GetRandomElement(), 2500); } else if (licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterLicenseSuspended.GetRandomElement(), 2500); } hunter.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Speech.GENERIC_FUCK_YOU : Speech.GENERIC_INSULT_HIGH : Speech.GENERIC_INSULT_MED); Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "COP", Relationship.Hate); Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "PLAYER", Relationship.Hate); this.pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(this.pursuit, this.hunter); Functions.SetPursuitIsActiveForPlayer(pursuit, true); isPursuitRunning = true; while (true) { GameFiber.Yield(); if (breakForceEnd) { break; } if (hunter.Exists() && hunter.IsAlive && !hunter.IsInAnyVehicle(false) && !LSPD_First_Response.Mod.API.Functions.IsPedGettingArrested(hunter) && !LSPD_First_Response.Mod.API.Functions.IsPedArrested(hunter)) { hunter.AttackPed(Game.LocalPlayer.Character); } state = EIllegalHuntingState.End; } }); }
//This is where it all happens, run all of your callouts logic here public override void Process() { //Game.LogTrivial("[Wilderness Callouts | IllegalHunting] Process()"); if (state == EIllegalHuntingState.EnRoute && Vector3.Distance(Game.LocalPlayer.Character.Position, hunter.Position) < 12.0f) { state = EIllegalHuntingState.OnScene; if (rndAimAtAnimal == 1) { NativeFunction.Natives.TASK_SHOOT_AT_ENTITY(hunter, animal, 1000, (uint)Rage.FiringPattern.SingleShot); } OnScene(); } if (!hunter.Exists() || hunter.IsDead || Functions.IsPedArrested(hunter)) { } else if (state == EIllegalHuntingState.End && !isPursuitRunning) { this.End(); } base.Process(); }
public void NoLicenseFlee() // NO LICENSE AND FLEE SCENARIO { Logger.LogTrivial(this.GetType().Name, "NoLicenseFlee()"); scenario = EScenario.NoLicenseFlee; GameFiber.StartNew(delegate { Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "COP", Relationship.Dislike); Game.SetRelationshipBetweenRelationshipGroups("HUNTER", "PLAYER", Relationship.Dislike); if (!licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterNoLicenseAndFleeAnswers.GetRandomElement(), 2500); } else if (licenseHasBeenGiven) { Game.DisplaySubtitle("~b~Hunter: ~w~" + hunterLicenseSuspended.GetRandomElement(), 2500); } hunter.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Speech.GENERIC_CURSE_HIGH : Speech.GENERIC_CURSE_MED : Speech.GENERIC_FUCK_YOU : Speech.GENERIC_INSULT_HIGH : Speech.GENERIC_INSULT_MED); hunter.EnterVehicle(hunterVeh, 8000, EVehicleSeats.Driver, 2.0f, 1); while (true) { GameFiber.Yield(); if (breakForceEnd || !hunter.Exists() || hunter.IsInAnyVehicle(false) || hunter.IsDead || Functions.IsPedArrested(hunter)) { break; } } VehicleDrivingFlags driveFlags = VehicleDrivingFlags.None; switch (Globals.Random.Next(3)) { case 0: driveFlags = (VehicleDrivingFlags)20; break; case 1: driveFlags = (VehicleDrivingFlags)786468; break; case 2: if (!hunterVeh.Model.IsBike || !hunterVeh.Model.IsBicycle) { driveFlags = (VehicleDrivingFlags)1076; } else { driveFlags = (VehicleDrivingFlags)786468; } break; default: break; } if (hunter.Exists()) { if (hunter.IsInAnyVehicle(false) && hunter.IsAlive) { hunter.Tasks.CruiseWithVehicle(hunterVeh, 200.0f, driveFlags); } this.pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(this.pursuit, this.hunter); Functions.SetPursuitIsActiveForPlayer(pursuit, true); isPursuitRunning = true; } state = EIllegalHuntingState.End; }); }