public void PerformSequence(TaskSequence sequence) { if (!sequence.IsClosed) { sequence.Close(false); } this.ClearAll(); InputArgument[] arguments = new InputArgument[] { this._ped.Handle, sequence.Handle }; Function.Call(Hash.TASK_PERFORM_SEQUENCE, arguments); }
public void PerformSequence(TaskSequence sequence) { if (!sequence.IsClosed) { sequence.Close(false); } ClearAll(); Function.Call(Hash.TASK_PERFORM_SEQUENCE, _ped.Handle, sequence.Handle); }
public void PerformSequence(TaskSequence sequence) { if (!sequence.IsClosed) { sequence.Close(); } ClearAll(); _ped.BlockPermanentEvents = true; Function.Call(Hash.TASK_PERFORM_SEQUENCE, _ped.Handle, sequence.Handle); }
private void playerSitting() { if (isSitting) { Game.Player.Character.Task.PlayAnimation("amb@world_human_picnic@male@exit", "exit", 8f, -1, false, -1f); isSitting = false; } else { isSitting = true; Game.Player.Character.Heading = Game.Player.Character.Heading + 180; Game.Player.Character.Task.ClearAllImmediately(); TaskSequence sitDown = new TaskSequence(); sitDown.AddTask.PlayAnimation("amb@world_human_picnic@male@enter", "enter", 8f, -1, false, -1f); sitDown.AddTask.PlayAnimation("amb@world_human_picnic@male@base", "base", 8f, -1, true, -1f); sitDown.Close(); Game.Player.Character.Task.PerformSequence(sitDown); } }
public void CallMechanic( Vehicle vehicle, Engine vehicleEngine ) { if ( this._isCalled ) { UI.Notify( "Mechanic is already called!", true ); return; } if ( Math.Round( vehicle.Speed, 2 ) > 0 ) { UI.Notify( "You should stop your car before calling the mechanic!", true ); return; } if ( !this.TakeMoney() ) { UI.Notify( "Not enought money!", true ); return; } vehicle.IsDriveable = false; var vehiclePosition = vehicle.Position; var spawnPosition = World.GetNextPositionOnStreet( vehiclePosition.Around( 80f ) ); this._mechanicVehicle = World.CreateVehicle( VehicleHash.Panto, spawnPosition ); this._mechanicPed = this._mechanicVehicle.CreatePedOnSeat( VehicleSeat.Driver, PedHash.FatWhite01AFM ); this._mechanicPed.Weapons.Give( WeaponHash.FireExtinguisher, 10000, true, true ); var openHoodPosition = vehicle.GetOffsetInWorldCoords( new Vector3( 0.35f, 3.0f, 0.0f ) ); var shootPosition = vehicle.GetOffsetInWorldCoords( new Vector3( 0.35f, 5.0f, 0.0f ) ); var tasks = new TaskSequence(); tasks.AddTask.DriveTo( this._mechanicVehicle, vehiclePosition, 15f, 40, (int)DrivingStyle.Rushed ); tasks.AddTask.RunTo( openHoodPosition ); tasks.AddTask.TurnTo( vehicle, 1000 ); tasks.AddTask.Wait( 1000 ); tasks.AddTask.GoTo( shootPosition ); tasks.AddTask.ShootAt( vehiclePosition, 15500, FiringPattern.FullAuto ); tasks.AddTask.GoTo( openHoodPosition ); tasks.AddTask.TurnTo( vehicle, 1000 ); tasks.AddTask.Wait( 1000 ); tasks.AddTask.CruiseWithVehicle( this._mechanicVehicle, 30f, (int)DrivingStyle.Rushed ); tasks.Close(); this._taskSequenceEventController.Subscribe( 2, this._mechanicPed, tasks, () => { this._mechanicVehicle.LeftIndicatorLightOn = true; this._mechanicVehicle.RightIndicatorLightOn = true; } ); this._taskSequenceEventController.Subscribe( 4, this._mechanicPed, tasks, () => this.OpenVehicleHood( vehicle ) ); this._taskSequenceEventController.Subscribe( 5, this._mechanicPed, tasks, () => { vehicleEngine.Temperature -= 0.5f; vehicleEngine.Damage -= 5.5f; vehicle.EngineHealth += vehicle.EngineHealth >= 1000 ? 0 : 2f; }, true ); this._taskSequenceEventController.Subscribe( 8, this._mechanicPed, tasks, () => this.OpenVehicleHood( vehicle, false ) ); this._taskSequenceEventController.Subscribe( 9, this._mechanicPed, tasks, () => { this._mechanicPed.MarkAsNoLongerNeeded(); this._mechanicPed.Task.CruiseWithVehicle( this._mechanicVehicle, 30f, (int)DrivingStyle.AvoidTrafficExtremely ); vehicle.IsDriveable = true; this._mechanicBlip.Remove(); this._taskSequenceEventController.UnsubscribeAll( this._mechanicPed, tasks ); this._mechanicVehicle.MarkAsNoLongerNeeded(); this._mechanicVehicle.LeftIndicatorLightOn = false; this._mechanicVehicle.RightIndicatorLightOn = false; this._isCalled = false; } ); this._mechanicPed.Task.PerformSequence( tasks ); this._mechanicBlip = this._mechanicPed.AddBlip(); this._mechanicBlip.Color = BlipColor.Blue; this._mechanicBlip.Name = "Mechanic"; this._isCalled = true; }
void UnlockDriver(Ped ped) { ped.Task.ClearAll(); TaskSequence dd = new TaskSequence(); Function.Call(GTA.Native.Hash.TASK_ENTER_VEHICLE, ped, GetLastVehicle(ped), -1, -1, 2f, 3, false); dd.Close(); ped.Task.PerformSequence(dd); dd.Dispose(); GetLastVehicle(ped).FreezePosition = false; Function.Call(GTA.Native.Hash.SET_VEHICLE_BURNOUT, GetLastVehicle(ped), false); }
void Onkeyup(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F12 && Game.Player.WantedLevel > 1) { hours = 10 + Game.Player.WantedLevel *10; Game.Player.WantedLevel = 0; intial1(); } /* if (e.KeyCode == Keys.F11) { Ped[] test = World.GetNearbyPeds(Game.Player.Character, 100f); int player_group = Function.Call<int>(Hash.GET_PED_RELATIONSHIP_GROUP_HASH, test[0]); GTA.UI.ShowSubtitle(player_group + " "); } */ if (e.KeyCode == Keys.E && arrested) { if (Game.Player.Character.Position.DistanceTo(new Vector3(1691.709f, 2565.036f, 45.56487f))<2f) { // bail if (Game.Player.Money > 5000000) { bail.Remove(); roit.Remove(); Game.Player.Character.Position = new Vector3(1849.555f, 2586.085f, 45.67202f); Game.Player.Character.Heading = 258.4564f; Game.Player.Money -= 5000000; Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character); arrested = false; _headsup = null; _headsupRectangle = null; } else { } } if (Game.Player.Character.Position.DistanceTo(new Vector3(1625.474f, 2491.485f, 45.62026f)) < 4f && !escape) { Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); bail.Remove(); roit.Remove(); Game.Player.Money -= 5000000; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); // 182.3307f , -885.7198f , 31.11671f :=> 51.15437f Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); // -1083,942 : -2915,736 : 13,23366 :=> 285,5021 if (help_veh == null) help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f)); else { help_veh.Delete(); help_veh = World.CreateVehicle(VehicleHash.Maverick, new Vector3(1649.463f, 2619.634f, 45.56486f)); } Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, help_veh, true, true); help_veh.Heading = 10.83339f; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); bail = World.CreateBlip(help_veh.Position); bail.Color = BlipColor.Blue; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); GiveAllWeapons(Game.Player.Character); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Function.Call(Hash.PAUSE_CLOCK, false); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); arrested = false; _headsup = null; _headsupRectangle = null; Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "respawn_controller"); Function.Call(Hash.TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME, "re_prison"); Function.Call(Hash.SET_CLOCK_TIME, 13, 00, 0); Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); Game.Player.WantedLevel = 4; escape = true; } } if (e.KeyCode == Keys.Y && arrested) { // prisoner groupe 2124571506 // garde groupe -183807561 if (Game.Player.Character.Position.DistanceTo(escape_Ped.Position) < 4f ) { for (int i = 0; i < prisoner.Count; i++) { GiveAllWeapons1(prisoner[i]); prisoner[i].CanSwitchWeapons = true; } for (int i = 0; i < garde.Count; i++) { GiveAllWeapons2(garde[i]); garde[i].CanSwitchWeapons = true; } GiveAllWeapons1(Game.Player.Character); Game.Player.Money -= 5000000; Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506); } } if (e.KeyCode == Keys.U) { Function.Call(Hash.ENABLE_ALL_CONTROL_ACTIONS, 1); Game.Player.CanControlCharacter = true; Function.Call(Hash.SET_ENABLE_HANDCUFFS, Game.Player.Character, false); Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, Game.Player.Character, false); } if(e.KeyCode == Keys.Y) Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5); if (e.KeyCode == Keys.F6) { // PBUS // VehicleHash.PBus // 1971.267f , 2635.439f , 46.17389f :=> 120.792f // 1608.376f , 2685.54f , 45.32081f :=> 143.341f testt = true; if (test_veh == null) { test_veh = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f)); test_veh.Heading = 120.792f; } else { test_veh.Delete(); test_veh = World.CreateVehicle(VehicleHash.PBus, new Vector3(1971.267f, 2635.439f, 46.17389f)); test_veh.Heading = 120.792f; } if (driver == null) { driver = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f)); driver.Heading = 120.792f; } else { driver.Delete(); driver = World.CreatePed(PedHash.Prisguard01SMM, new Vector3(1971.267f, 2635.439f, 46.17389f).Around(5f)); driver.Heading = 120.792f; } driver.Task.WarpIntoVehicle(test_veh, VehicleSeat.Driver); // Game.Player.CanControlCharacter = false; Game.Player.Character.Position = new Vector3(1971.267f, 2635.439f, 46.17389f).Around(10f); // Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1); Game.Player.Character.Task.WarpIntoVehicle(test_veh, VehicleSeat.Passenger); Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, driver, -1533126372); Function.Call(Hash.SET_PED_AS_COP, driver, true); // 1 1858,746 : 2609,113 : 45,29342 // 2 1831,064 : 2607,884 : 45,20006 // 3 1754,864 : 2605,129 : 45,18484 while (!Game.Player.Character.IsInVehicle(test_veh)) Script.Wait(0); TaskSequence task = new TaskSequence(); // task.AddTask.DriveTo(test_veh, new Vector3(1900.457f, 2609.054f, 46.00166f), 3f, 10f, (int)DrivingStyle.Normal); // task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1855.855f, 2606.756f, 45.9304f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1831.152f, 2606.738f, 45.83254f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1754.018f, 2604.271f, 45.82404f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(50000); driver.Task.PerformSequence(task); task.Close(); // new Vector3(1858.746f, 2609.113f, 45.29342f) // new Vector3(1831.064f, 2607.884f, 45.20006f) // new Vector3(1754.864f, 2605.129f, 45.18484f) // int t = Function.Call<int>(Hash.GET_HASH_KEY,"prop_gate_prison_01"); // Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 0, 0.0f, 50.0f, 0f); // Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f); } if (e.KeyCode == Keys.O) { Function.Call(Hash.IGNORE_NEXT_RESTART, true); } /* if (e.KeyCode == Keys.O) { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 0, 0.0f, 50.0f, 0f); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 0, 0.0f, 50.0f, 0f); } if (e.KeyCode == Keys.P) { int t = Function.Call<int>(Hash.GET_HASH_KEY, "prop_gate_prison_01"); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1845.0f, 2605.0f, 45.0f, 1, 0.0f, 50.0f, 0f); Function.Call(Hash._0x9B12F9A24FABEDB0, t, 1819.27f, 2608.53f, 44.61f, 1, 0.0f, 50.0f, 0f); } */ }
void HandleAmbient() { foreach (Ped ped in crowd) { if (ped.IsOnFoot && !ped.IsInCombat && Function.Call<int>(Hash.GET_SEQUENCE_PROGRESS, ped) == -1) { //UI.Notify("Scenario applied, " +ped.Handle.ToString()); Vector3 faceto = GetStartingLine(); TaskSequence dd = new TaskSequence(); Function.Call(GTA.Native.Hash.TASK_TURN_PED_TO_FACE_COORD, 0, faceto.X, faceto.Y, faceto.Z, 2000); Function.Call(GTA.Native.Hash.TASK_START_SCENARIO_IN_PLACE, 0, GetRandomAmbientScenario(), -1, false); dd.Close(); ped.Task.PerformSequence(dd); dd.Dispose(); } } foreach (Ped ped in waitingdrivers) { Function.Call(Hash.SET_SCENARIO_PEDS_TO_BE_RETURNED_BY_NEXT_COMMAND, true); if (ped.IsOnFoot && !ped.IsInCombat && Function.Call<int>(Hash.GET_SEQUENCE_PROGRESS, ped) == -1 && Function.Call<bool>(Hash.IS_PED_USING_ANY_SCENARIO, countdownped) == false) { Vector3 faceto = GetWaitingZone(); TaskSequence dd = new TaskSequence(); Function.Call(GTA.Native.Hash.TASK_TURN_PED_TO_FACE_COORD, 0, faceto.X, faceto.Y, faceto.Z, 2000); Function.Call(GTA.Native.Hash.TASK_START_SCENARIO_IN_PLACE, 0, GetRandomAmbientDriverScenario(), 0, false); dd.Close(); ped.Task.PerformSequence(dd); dd.Dispose(); } } }
void HandleDragRace() { FixStuckDrivers(); switch (DragPhase) { case "MeetNotStarted": { SpawnCountDownPed(); SpawnCrowd(); SpawnDriversFromFile(); SpawnParkedVehicles(); DragPhase = "MeetJustStarted"; NotifiedMeets.Clear(); HandleAmbient(); finish = World.CreateProp("prop_offroad_barrel01", GetFinishLine()+ new Vector3(0, 0,3), new Vector3(0, 0, GetRaceHeading()), false, true); finish.IsPersistent = true; Function.Call(GTA.Native.Hash._0x0DC7CABAB1E9B67E, finish, true); //Load Collision return; } case "MeetJustStarted": { foreach (Vehicle veh in ambientvehicles) { if (veh.DisplayName == "MOONBEAM2" || veh.DisplayName == "FACTION2") { SetRadioLoud(veh); } } //AddNewCarsToMeet(); //Doesn't work properly for now if (drivers.Count == 2) { CountDownGuyIsInPos(); DragPhase = "RacersGoingToStartPos"; leftdriver = drivers[0]; } else { GetNextDriverPair(); } return; } case "RacersGoingToStartPos": { if (AreDriversInStartingLine() == true) { if (CountDownGuyIsInPos() == true) { DragSetupPatience = 0; DragPhase = "RaceCountDown"; if (CanWeUse(countdownped)) { Vector3 faceto = GetStartingLine(); TaskSequence dd = new TaskSequence(); Function.Call(GTA.Native.Hash.TASK_SWAP_WEAPON, 0, true); Function.Call(GTA.Native.Hash.TASK_TURN_PED_TO_FACE_COORD, 0, faceto.X, faceto.Y, faceto.Z, 2000); dd.Close(); countdownped.Task.PerformSequence(dd); dd.Dispose(); } } } else { if (IsPlayerNearStartingLine() || countdownped.IsOnScreen) { DragSetupPatience++; if (DragSetupPatience > 15) { DragSetupPatience = 0; foreach (Ped driver in drivers) { Function.Call(GTA.Native.Hash.SET_VEHICLE_FIXED, GetLastVehicle(driver)); Function.Call(GTA.Native.Hash.SET_VEHICLE_DEFORMATION_FIXED, GetLastVehicle(driver)); if (driver.Handle == drivers[0].Handle) { if (!GetLastVehicle(driver).IsInRangeOf(GetStartingPoint("Left"), 3f)) { GetLastVehicle(driver).Position = GetSequenceToStartingPos("Left")[0]; } } else { if (!GetLastVehicle(driver).IsInRangeOf(GetStartingPoint("Right"), 3f)) { GetLastVehicle(driver).Position = GetSequenceToStartingPos("Right")[0]; } } GetLastVehicle(driver).Heading = GetRaceHeading(); driver.Task.EnterVehicle(GetLastVehicle(driver), VehicleSeat.Driver, -1); } } } else { foreach (Ped driver in drivers) { Function.Call(GTA.Native.Hash.SET_VEHICLE_FIXED, GetLastVehicle(driver)); Function.Call(GTA.Native.Hash.SET_VEHICLE_DEFORMATION_FIXED, GetLastVehicle(driver)); driver.Task.ClearAll(); if (driver.CurrentVehicle == null) { driver.SetIntoVehicle(GetLastVehicle(driver), VehicleSeat.Driver); } if (driver.Handle == drivers[0].Handle) { if (!GetLastVehicle(driver).IsInRangeOf(GetStartingPoint("Left"), 3f)) { GetLastVehicle(driver).Position = GetStartingPoint("Left"); } } else { if (!GetLastVehicle(driver).IsInRangeOf(GetStartingPoint("Right"), 3f)) { GetLastVehicle(driver).Position = GetStartingPoint("Right"); } } GetLastVehicle(driver).Heading = GetRaceHeading(); driver.Task.EnterVehicle(GetLastVehicle(driver), VehicleSeat.Driver, -1); } } } return; } case "RaceCountDown": { IsBarrelWhereItShould(); if (AreDriversInStartingLine() == true && !Game.Player.Character.IsInRangeOf(GetStartingLine(), GetStartingLineRadius() / 2f)) { if (CanWeUse(countdownped)) { Vector3 aim = countdownped.Position + countdownped.ForwardVector + countdownped.UpVector * 2; Vector3 faceto = GetFinishLine(); TaskSequence dd = new TaskSequence(); Function.Call(GTA.Native.Hash.TASK_SHOOT_AT_COORD, 0, aim.X, aim.Y, aim.Z, 500, GetHash("FIRING_PATTERN_BURST_FIRE_PISTOL")); Function.Call(GTA.Native.Hash.TASK_TURN_PED_TO_FACE_COORD, 0, faceto.X, faceto.Y, faceto.Z, 2000); dd.Close(); countdownped.Task.PerformSequence(dd); dd.Dispose(); } string side; foreach (Ped driver in drivers) { if (GetLastVehicle(driver).Heading - GetRaceHeading() > 20f) { GetLastVehicle(driver).Heading = GetRaceHeading(); } if (unpredictable_races) { if (RandomInt(0,2)==3) { Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, GetLastVehicle(driver), RandomFloat(0, 1)); UI.Notify(RandomFloat(0, 1).ToString()); } else { Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, GetLastVehicle(driver), RandomInt(1, 10)); } } float speed = 80f; if (driver == drivers[0]) { side = "Left"; } else { side = "Right"; } TaskSequence RaceSequence = new TaskSequence(); foreach (Vector3 pos in GetSequenceToEnd(side)) { if (unpredictable_races) { Function.Call(Hash.TASK_PAUSE, 0, RandomInt(0, 800)); } Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), pos.X, pos.Y, pos.Z, speed, 16777236, 5f); speed = 10; } RaceSequence.Close(); driver.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } DragPhase = "RaceInProgress"; RaceInProgress = true; } return; } case "RaceInProgress": { if (HaveDriversFinished()) { Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, GetLastVehicle(drivers[0]), 0f); Function.Call(Hash._SET_VEHICLE_ENGINE_POWER_MULTIPLIER, GetLastVehicle(drivers[1]), 0f); if (IsPlayerNearFinishgLine() || IsPlayerNearStartingLine()) { UI.Notify("~g~The " + GetLastVehicle(winner).FriendlyName + " won!"); } DriveRacersToTheWaitingArea(); DragPhase = "RaceFinished"; RaceInProgress = false; Vector3 faceto = GetStartingLine(); TaskSequence countdownguysequence = new TaskSequence(); Function.Call(GTA.Native.Hash.TASK_TURN_PED_TO_FACE_COORD, 0, faceto.X, faceto.Y, faceto.Z, 2000); Function.Call(GTA.Native.Hash.TASK_RELOAD_WEAPON, 0, true); countdownguysequence.Close(); countdownped.Task.PerformSequence(countdownguysequence); countdownguysequence.Dispose(); if (CanWeUse(betondriver)) { if (winner.Handle == betondriver.Handle) { UI.Notify("~g~You won the bet!"); Game.Player.Money = Game.Player.Money + 200; PedsCongratulatePlayer(); } else { UI.Notify("~r~You lost the bet."); Game.Player.Money = Game.Player.Money - 200; } betondriver = null; } GetNextDriverPair(); AreDriversInStartingLine(); } return; } case "RaceFinished": { winner = null; DragPhase = "MeetJustStarted"; return; } } }
void DriveThisManToItsStartingPos(Ped driver) { string side; if (driver.Handle == drivers[0].Handle) { side = "Left"; } else { side = "Right"; } Vector3 waitingcenter = GetStartingLine(); TaskSequence RaceSequence = new TaskSequence(); Function.Call(GTA.Native.Hash.TASK_ENTER_VEHICLE, 0, GetLastVehicle(driver), -1, -1, 2f, 1, false); /* if (Function.Call<Vector3>(GTA.Native.Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS, GetLastVehicle(driver), waitingcenter.X, waitingcenter.Y, waitingcenter.Z).Y < 0) { RaycastResult back = RaycastDrive(GetLastVehicle(driver).Position + (GetLastVehicle(driver).ForwardVector * -3), GetLastVehicle(driver).Position + (GetLastVehicle(driver).ForwardVector * -20)); Vector3 pos = GetLastVehicle(driver).Position + (GetLastVehicle(driver).ForwardVector * -10); if (back.DitHitAnything) { pos = back.HitCoords; } Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), pos.X, pos.Y, pos.Z, 4f, 16778240, 2f); } */ foreach (Vector3 pos in GetSequenceToStartingPos(side)) { Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), pos.X, pos.Y, pos.Z, 4f, 4194357, 3f); } Vector3 startpoint = GetStartingPoint(side); Function.Call(GTA.Native.Hash.TASK_VEHICLE_PARK, 0, GetLastVehicle(driver), startpoint.X, startpoint.Y, startpoint.Z, GetRaceHeading(), 1, 10f, true); RaceSequence.Close(); driver.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); }
void DriveThisPedToTheMeetingArea(Ped ped) { if (CanWeUse(ped) && CanWeUse(GetLastVehicle(ped))) { AddToWaitingList(ped); Vector3 random = GetWaitingZone().Around(GetWaitingZoneRadius() * (RandomInt(3, 8) / 10.0f)); Vector3 waitingzone = GetWaitingZone().Around(GetWaitingZoneRadius() * (RandomInt(4,10) / 10.0f)); int how= 262199; if (ped.IsInRangeOf(GetWaitingZone(), 40f)) { how = 4194365; } TaskSequence RaceSequence = new TaskSequence(); Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, 0, GetLastVehicle(ped), waitingzone.X, waitingzone.Y, waitingzone.Z, 10f, true, GetLastVehicle(ped).GetHashCode(), how, 5f, 0f); Function.Call(Hash.TASK_LEAVE_VEHICLE, 0, GetLastVehicle(ped), 0); Function.Call(Hash.TASK_FOLLOW_NAV_MESH_TO_COORD, 0, random.X, random.Y, random.Z, 1.0f, -1, 0.0f, 0, 0.0f); RaceSequence.Close(); ped.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } }
void DriveRacersToTheWaitingArea() { string side; foreach (Ped driver in drivers) { Vector3 random = GetWaitingZone().Around(GetWaitingZoneRadius() * (RandomInt(3,8) / 10.0f)); Vector3 nearwaitingzone = GetWaitingZone().Around(GetWaitingZoneRadius() * (RandomInt(4, 10) / 10.0f)); Vector3 waitingzone = GetWaitingZone(); AddToWaitingList(driver); if (driver == drivers[0]) { side = "Left"; } else { side = "Right"; } TaskSequence RaceSequence = new TaskSequence(); foreach (Vector3 pos in GetSequenceToWaitingZone(side)) { Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), pos.X, pos.Y, pos.Z, 10f, 4194365, 4f); } Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), nearwaitingzone.X, nearwaitingzone.Y, nearwaitingzone.Z, 3f, 4194365,5f); Function.Call(Hash.TASK_LEAVE_VEHICLE, 0, GetLastVehicle(driver), 0); Function.Call(Hash.TASK_FOLLOW_NAV_MESH_TO_COORD, 0, random.X, random.Y, random.Z, 1.0f, -1, 0.0f, 0, 0.0f); RaceSequence.Close(); driver.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } drivers.Clear(); }
bool CountDownGuyIsInPos() { if (countdownped.IsInRangeOf(GetCountDownGuyPos(), 2f)) { return true; } else { if (IsPlayerNearStartingLine()) { Vector3 pos = GetCountDownGuyPos(); Vector3 faceto = GetStartingLine(); TaskSequence RaceSequence = new TaskSequence(); Function.Call(Hash.TASK_FOLLOW_NAV_MESH_TO_COORD, 0, pos.X, pos.Y, pos.Z, 1.0f, -1, 0.0f, 0, 0.0f); Function.Call(GTA.Native.Hash.TASK_TURN_PED_TO_FACE_COORD, 0, faceto.X, faceto.Y, faceto.Z, 2000); RaceSequence.Close(); countdownped.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } else { countdownped.Position = GetCountDownGuyPos(); } return false; } }
void CleanMeet() { foreach (Ped driver in drivers) { GetLastVehicle(driver).IsPersistent=false; driver.IsPersistent = false; Vector3 pos = driver.Position.Around(900f); TaskSequence RaceSequence = new TaskSequence(); Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), pos.X, pos.Y, pos.Z, 300f, 262196, 2f); RaceSequence.Close(); driver.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } foreach (Ped driver in waitingdrivers) { GetLastVehicle(driver).IsPersistent = false; driver.IsPersistent = false; Vector3 pos = driver.Position.Around(900f); TaskSequence RaceSequence = new TaskSequence(); Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), pos.X, pos.Y, pos.Z, 300f, 262196, 2f); RaceSequence.Close(); driver.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } foreach (Ped driver in crowd) { driver.MarkAsNoLongerNeeded(); if (CanWeUse(GetLastVehicle(driver))) { Vector3 pos = driver.Position.Around(900f); TaskSequence RaceSequence = new TaskSequence(); Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD_LONGRANGE, 0, GetLastVehicle(driver), pos.X, pos.Y, pos.Z, 300f, 262196, 2f); RaceSequence.Close(); driver.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } else { TaskSequence RaceSequence = new TaskSequence(); Function.Call(Hash.TASK_REACT_AND_FLEE_PED, 0, Game.Player.Character); RaceSequence.Close(); driver.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } } crowd.Clear(); drivers.Clear(); waitingdrivers.Clear(); if (CanWeUse(countdownped)) { countdownped.MarkAsNoLongerNeeded(); TaskSequence RaceSequence = new TaskSequence(); Function.Call(Hash.TASK_REACT_AND_FLEE_PED, 0, Game.Player.Character); RaceSequence.Close(); countdownped.Task.PerformSequence(RaceSequence); RaceSequence.Dispose(); } foreach (Vehicle veh in ambientvehicles) { veh.MarkAsNoLongerNeeded(); } finish.MarkAsNoLongerNeeded(); }
private void createAndAddObjectives() { #region Objectives GoToPosition goToFirstSongObjective = new GoToPosition(firstSongPosition); goToFirstSongObjective.Checkpoint = new Checkpoint(); goToFirstSongObjective.Checkpoint.addEntity(Joe.bike, bikePositionAtHome, 0); goToFirstSongObjective.Checkpoint.PlayerPosition = joeHomePosition; goToFirstSongObjective.Checkpoint.setClockHour(10); goToFirstSongObjective.Checkpoint.Health = 300; goToFirstSongObjective.Checkpoint.Armor = 100; goToFirstSongObjective.Checkpoint.Weather = Weather.ExtraSunny; goToFirstSongObjective.Checkpoint.WantedLevel = 0; goToFirstSongObjective.Checkpoint.Heading = 35; goToFirstSongObjective.OnStarted += (sender) => { Ped player = Game.Player.Character; if (!this.loadingCheckpoint) { bikeRegen = false; playerDown = true; playerWalked = false; playerMoved = false; introEnded = false; Tools.TeleportPlayer(joeStart, false); introPed = Function.Call<Ped>(Hash.CLONE_PED, player, Function.Call<int>(Hash.GET_ENTITY_HEADING, Function.Call<int>(Hash.PLAYER_PED_ID)), false, true); Tools.TeleportPlayer(joeHomePosition); player.IsVisible = false; player.Task.StandStill(-1); introPed.Task.PlayAnimation("amb@world_human_picnic@male@base", "base", 8f, -1, true, -1f); Vector3 largeShotPosition = new Vector3(2213.186f, 2510.148f, 82.73711f); Vector3 firstShotPosition = new Vector3(2361.558f, 2527.512f, 46.66772f); Vector3 secondShotPosition = new Vector3(2351.906f, 2530.494f, 48f); List<CameraShot> cameraShots = new List<CameraShot>(); float time_split = AudioManager.Instance.getLength("dialogue0") / 3; CameraShot cameraShot = new CameraShot(time_split, largeShotPosition); cameraShot.lookAt(introPed); cameraShots.Add(cameraShot); cameraShot = new CameraTraveling(time_split, firstShotPosition, secondShotPosition); cameraShot.lookAt(introPed); cameraShots.Add(cameraShot); cameraShot = new CameraTraveling(time_split, secondShotPosition, bikePositionAtHome); cameraShot.lookAt(introPed); cameraShots.Add(cameraShot); CameraShotsList.Instance.initialize(cameraShots, AudioManager.Instance.getLength("dialogue0")); AudioManager.Instance.startSound("dialogue0"); } foreach (Ped spectator in firstSongSpectatorsPeds) { spectator.Task.ClearAllImmediately(); spectator.Task.WanderAround(spectator.Position, 100); } }; AbstractObjective firstSongObjectives = new PlayInstrument(InstrumentHash.Guitar, "ronAlternates"); firstSongObjectives.Checkpoint = new Checkpoint(); firstSongObjectives.Checkpoint.Activable = true; firstSongObjectives.Checkpoint.addEntity(Joe.bike, bikePositionAtHome, 0); firstSongObjectives.Checkpoint.PlayerPosition = firstSongPosition; firstSongObjectives.Checkpoint.setClockHour(11); firstSongObjectives.Checkpoint.WantedLevel = 0; firstSongObjectives.OnStarted += (sender) => { Vector3 firstCameraPosition = new Vector3(firstSongPosition.X + 4, firstSongPosition.Y + 4, firstSongPosition.Z + 2); Vector3 secondCameraPosition = firstCameraPosition; secondCameraPosition.X -= 8; Vector3 thirdCameraPosition = new Vector3(2321, 2555.7f, firstSongPosition.Z); Vector3 fourthCameraPosition = new Vector3(2336, 2548.5f, firstSongPosition.Z); Vector3 fifthCameraPosition = new Vector3(firstSongPosition.X + 1, firstSongPosition.Y, firstSongPosition.Z - 1); Vector3 sixthCameraPosition = fifthCameraPosition; sixthCameraPosition.Z += 2; Vector3 seventhCameraPosition = new Vector3(2213, 2510, 83); Vector3 eighthCameraPosition = new Vector3(2336.9f, 2550.8f, 47); float shotTime = AudioManager.Instance.getLength("ronAlternates") / 6; List<CameraShot> cameraShots = new List<CameraShot>(); cameraShots.Add(new CameraTraveling(shotTime, firstCameraPosition, secondCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, thirdCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, fourthCameraPosition, true)); cameraShots.Add(new CameraTraveling(shotTime, fifthCameraPosition, sixthCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, seventhCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, eighthCameraPosition, true)); CameraShotsList.Instance.initialize(cameraShots); Ped player = Game.Player.Character; foreach (Ped spectator in firstSongSpectatorsPeds) { Vector3 positionsDifference = firstSongPosition - spectator.Position; positionsDifference *= 0.8f; Vector3 newPosition = spectator.Position + positionsDifference; spectator.Task.ClearAllImmediately(); TaskSequence angrySpectator = new TaskSequence(); angrySpectator.AddTask.GoTo(newPosition); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.UseMobilePhone(random.Next(5000, 30000)); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_what_hard", 8f, random.Next(5000, 30000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_nod_yes_soft", 0.1f, random.Next(5000, 30000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_you_soft", 8f, random.Next(5000, 30000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_nod_no_hard", 8f, random.Next(5000, 30000), true, -1f); angrySpectator.Close(); spectator.Task.PerformSequence(angrySpectator); } }; firstSongObjectives.OnAccomplished += (sender, elapsedTime) => { foreach (Ped spectator in firstSongSpectatorsPeds) { if (spectator.Position.DistanceTo(firstSongPosition) > 30) { Vector3 positionsDifference = firstSongPosition - spectator.Position; positionsDifference *= 0.8f; spectator.Position += positionsDifference; } spectator.Task.ClearAllImmediately(); if (random.Next(0, 2) == 0) { spectator.Task.FightAgainst(Game.Player.Character); } else { TaskSequence spectatorsCallPoliceAndFlee = new TaskSequence(); spectatorsCallPoliceAndFlee.AddTask.UseMobilePhone(random.Next(3000, 8000)); spectatorsCallPoliceAndFlee.AddTask.ReactAndFlee(Game.Player.Character); spectatorsCallPoliceAndFlee.Close(); spectator.Task.PerformSequence(spectatorsCallPoliceAndFlee); } } }; GoToPositionInVehicle goToPoliceWithBikeObjective = new GoToPositionInVehicle(roadFaceToPoliceStationPosition); goToPoliceWithBikeObjective.setVehicle(Joe.bike); goToPoliceWithBikeObjective.Checkpoint = new Checkpoint(); goToPoliceWithBikeObjective.Checkpoint.SongsNames = new string[] { "flics1", "dialogue1", "dialogue2", "dialogue3" }; goToPoliceWithBikeObjective.Checkpoint.addEntity(Joe.bike, bikePositionAtHome, 0); goToPoliceWithBikeObjective.Checkpoint.setClockHour(14); goToPoliceWithBikeObjective.Checkpoint.Health = 300; goToPoliceWithBikeObjective.Checkpoint.Armor = 100; goToPoliceWithBikeObjective.Checkpoint.Weather = Weather.Clouds; goToPoliceWithBikeObjective.Checkpoint.WantedLevel = 2; GoToPosition goToSecondSongObjective = new GoToPosition(secondSongPosition); goToSecondSongObjective.Checkpoint = new Checkpoint(); goToSecondSongObjective.Checkpoint.addEntity(Joe.bike, roadFaceToPoliceStationPosition, 0); goToSecondSongObjective.OnStarted += (sender) => { foreach (Ped spectator in firstSongSpectatorsPeds) { spectator.MarkAsNoLongerNeeded(); } List<PedHash> spectatorsHashesSecondSong = new List<PedHash> { PedHash.Cop01SFY, PedHash.Cop01SMY, PedHash.Cop01SFY, PedHash.Cop01SMY }; foreach (PedHash hash in spectatorsHashesSecondSong) { Ped ped = World.CreatePed(hash, secondSongPosition.Around(2)); if (ped != null && ped.Exists()) { ped.Task.WanderAround(secondSongPosition, 5); secondSongCopsPeds.Add(ped); } } }; AbstractObjective secondSongObjectives = new PlayInstrument(InstrumentHash.Guitar, "lesFlics", 74770); secondSongObjectives.Checkpoint = new Checkpoint(); secondSongObjectives.Checkpoint.Activable = true; secondSongObjectives.Checkpoint.addEntity(Joe.bike, roadFaceToPoliceStationPosition, 0); secondSongObjectives.Checkpoint.PlayerPosition = secondSongPosition; secondSongObjectives.Checkpoint.setClockHour(16); secondSongObjectives.Checkpoint.Weather = Weather.Clouds; secondSongObjectives.Checkpoint.WantedLevel = 0; secondSongObjectives.OnStarted += (sender) => { #region Cinematic Ped player = Game.Player.Character; player.Heading = 90; foreach (Ped spectator in World.GetNearbyPeds(player, 15)) { if (spectator != null && spectator.Exists()) { spectator.Task.ClearAllImmediately(); Function.Call(Hash.TASK_TURN_PED_TO_FACE_ENTITY, spectator.Handle, player.Handle); spectator.Task.LookAt(Game.Player.Character); } } foreach (Ped spectator in secondSongCopsPeds) { if (spectator != null && spectator.Exists()) { spectator.Task.ClearAllImmediately(); TaskSequence policeSurrounding = new TaskSequence(); policeSurrounding.AddTask.TurnTo(player); policeSurrounding.AddTask.StandStill(10000); policeSurrounding.AddTask.GoTo(player.Position.Around(2).Around(1)); policeSurrounding.AddTask.TurnTo(player); policeSurrounding.AddTask.LookAt(player); policeSurrounding.Close(); spectator.Task.PerformSequence(policeSurrounding); } } Vector3 firstCameraPosition = new Vector3(secondSongPosition.X + 4, secondSongPosition.Y, secondSongPosition.Z + 2); Vector3 secondCameraPosition = new Vector3(firstCameraPosition.X - 4, firstCameraPosition.Y + 4, firstCameraPosition.Z - 1); Vector3 thirdCameraPosition = new Vector3(firstCameraPosition.X - 4, firstCameraPosition.Y - 4, secondCameraPosition.Z); Vector3 fourthCameraPosition = new Vector3(firstCameraPosition.X + 4, firstCameraPosition.Y + 4, secondCameraPosition.Z); Vector3 fifthCameraPosition = new Vector3(441, -988, 30.5f); Vector3 sixthCameraPosition = new Vector3(441f, -981.2f, 31.5f); Vector3 seventhCameraPosition = new Vector3(435, -986, 32.5f); Vector3 eighthCameraPosition = new Vector3(440.5f, -983.7f, 30.7f); float shotTime = AudioManager.Instance.getLength("lesFlics") / 6; List<CameraShot> cameraShots = new List<CameraShot>(); cameraShots.Add(new CameraTraveling(shotTime, firstCameraPosition, secondCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, fifthCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, sixthCameraPosition)); cameraShots.Add(new CameraTraveling(shotTime, secondCameraPosition, thirdCameraPosition, true)); cameraShots.Add(new CameraTraveling(shotTime, thirdCameraPosition, fourthCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, seventhCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, eighthCameraPosition, true)); CameraShotsList.Instance.initialize(cameraShots); #endregion }; GoToPositionInVehicle goToTheaterWithBikeObjective = new GoToPositionInVehicle(thirdSongBikePosition); goToTheaterWithBikeObjective.setVehicle(Joe.bike); goToTheaterWithBikeObjective.Checkpoint = new Checkpoint(); goToTheaterWithBikeObjective.Checkpoint.SongsNames = new string[] { "laissezmoi", "flics2", "flics3", "flics4", "dialogue4", "dialogue5", "dialogue6" }; goToTheaterWithBikeObjective.Checkpoint.addEntity(Joe.bike, roadFaceToPoliceStationPosition, 0); goToTheaterWithBikeObjective.Checkpoint.PlayerPosition = secondSongPosition; goToTheaterWithBikeObjective.Checkpoint.Health = 300; goToTheaterWithBikeObjective.Checkpoint.Armor = 100; goToTheaterWithBikeObjective.Checkpoint.WantedLevel = 1; goToTheaterWithBikeObjective.Checkpoint.Weather = Weather.Clearing; goToTheaterWithBikeObjective.Checkpoint.setClockHour(18, 40000); goToTheaterWithBikeObjective.OnStarted += (sender) => { List<PedHash> spectatorsHashesThirdSong = new List<PedHash>(); spectatorsHashesThirdSong.Add(PedHash.Beach01AFM); spectatorsHashesThirdSong.Add(PedHash.MovAlien01); spectatorsHashesThirdSong.Add(PedHash.Jesus01); spectatorsHashesThirdSong.Add(PedHash.Zombie01); for (int num = 0; num < 120; num++) { Ped ped = World.CreatePed(spectatorsHashesThirdSong.ElementAt<PedHash>(random.Next(spectatorsHashesThirdSong.Count)), thirdSongPublicPosition1 + (float)random.NextDouble() * thirdSongPublicPosition2 + (float)random.NextDouble() * thirdSongPublicPosition3); if (ped != null && ped.Exists()) { if (ped.Model == PedHash.MovAlien01) { Function.Call(Hash.SET_PED_COMPONENT_VARIATION, ped.Handle, 0, 0, 0, 2); Function.Call(Hash.SET_PED_COMPONENT_VARIATION, ped.Handle, 3, 0, 0, 2); Function.Call(Hash.SET_PED_COMPONENT_VARIATION, ped.Handle, 4, 1, 0, 2); } thirdSongSpectatorsPeds.Add(ped); } } while (nadineMorano == null || !nadineMorano.Exists()) { nadineMorano = World.CreatePed(PedHash.Business02AFM, thirdSongPosition); } nadineMorano.Task.TurnTo( thirdSongSpectatorsPeds[0] ); Function.Call(Hash.SET_PED_COMPONENT_VARIATION, nadineMorano.Handle, 2, 1, 2, 2); }; goToTheaterWithBikeObjective.OnFirstTimeOnVehicle += (sender, vehicle) => { Game.Player.WantedLevel = 3; foreach (Ped ped in secondSongCopsPeds) { if (ped != null && ped.Exists()) { ped.Task.ClearAllImmediately(); ped.Task.FightAgainst(Game.Player.Character); ped.Weapons.Give(WeaponHash.Pistol, 1, true, true); ped.MarkAsNoLongerNeeded(); } } }; goToTheaterWithBikeObjective.OnAccomplished += (sender, elapsedTime) => { foreach (Ped ped in secondSongCopsPeds) { if (ped != null && ped.Exists()) { ped.MarkAsNoLongerNeeded(); } } }; GoToPosition goToThirdSongPosition = new GoToPosition(thirdSongPosition); goToThirdSongPosition.Checkpoint = new Checkpoint(); goToThirdSongPosition.Checkpoint.addEntity(Joe.bike, thirdSongBikePosition, -90); goToThirdSongPosition.Checkpoint.PlayerPosition = thirdSongBikePosition; Timer chansonHoo2 = null; AbstractObjective thirdSongObjectives = new PlayInstrument(InstrumentHash.Guitar, "degueulasse"); thirdSongObjectives.Checkpoint = new Checkpoint(); thirdSongObjectives.Checkpoint.Activable = true; thirdSongObjectives.Checkpoint.addEntity(Joe.bike, thirdSongBikePosition, -90); thirdSongObjectives.Checkpoint.PlayerPosition = thirdSongPosition; thirdSongObjectives.Checkpoint.Weather = Weather.Raining; thirdSongObjectives.Checkpoint.WantedLevel = 0; thirdSongObjectives.Checkpoint.setClockHour(20); thirdSongObjectives.Checkpoint.Heading = 180; thirdSongObjectives.OnStarted += (sender) => { Ped player = Game.Player.Character; #region Cinematic if (nadineMorano != null && nadineMorano.Position.DistanceTo(player.Position) < 10) { nadineMorano.Task.FleeFrom(player); AudioManager.Instance.startIndependantSound("nadine"); } AudioManager.Instance.startIndependantSound("degueulasseHoo"); chansonHoo2 = new Timer(AudioManager.Instance.getLength("degueulasse") - 19000); chansonHoo2.OnTimerStop += (timerSender) => { AudioManager.Instance.startIndependantSound("degueulasseHoo2"); player = Game.Player.Character; foreach (Ped spectator in thirdSongSpectatorsPeds) { spectator.Task.ClearAllImmediately(); spectator.Task.ClearLookAt(); spectator.Task.ClearAll(); TaskSequence angrySpectator = new TaskSequence(); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_what_hard", 8f, random.Next(2000, 5000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_nod_yes_soft", 0.1f, random.Next(2000, 5000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_you_soft", 8f, random.Next(2000, 5000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_nod_no_hard", 8f, random.Next(2000, 5000), true, -1f); angrySpectator.Close(); spectator.Task.PerformSequence(angrySpectator); Tools.log("spectator perform sequence"); } }; foreach (Ped spectator in thirdSongSpectatorsPeds) { spectator.Task.ClearAllImmediately(); TaskSequence angrySpectator = new TaskSequence(); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_what_hard", 8f, random.Next(5000, 30000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_nod_yes_soft", 0.1f, random.Next(5000, 30000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_you_soft", 8f, random.Next(5000, 30000), false, -1f); angrySpectator.AddTask.TurnTo(player); angrySpectator.AddTask.LookAt(player); angrySpectator.AddTask.PlayAnimation("gestures@m@standing@casual", "gesture_nod_no_hard", 8f, random.Next(5000, 30000), true, -1f); angrySpectator.Close(); spectator.Task.PerformSequence(angrySpectator); Tools.log("spectator perform sequence"); } Vector3 firstCameraPosition = new Vector3(thirdSongPosition.X + 8, thirdSongPosition.Y, thirdSongPosition.Z + 2); Vector3 secondCameraPosition = new Vector3(firstCameraPosition.X - 8, firstCameraPosition.Y + 8, firstCameraPosition.Z); Vector3 thirdCameraPosition = new Vector3(firstCameraPosition.X - 8, firstCameraPosition.Y - 8, firstCameraPosition.Z); Vector3 fourthCameraPosition = new Vector3(firstCameraPosition.X + 5, firstCameraPosition.Y + 5, firstCameraPosition.Z); Vector3 fifthCameraPosition = new Vector3(679, 554, 131); Vector3 sixthCameraPosition = new Vector3(664, 457, 145); Vector3 seventhCameraPosition = new Vector3(680, 575, 130); Vector3 eighthCameraPosition = new Vector3(689, 589, 131); float shotTime = AudioManager.Instance.getLength("degueulasse") / 6; List<CameraShot> cameraShots = new List<CameraShot>(); cameraShots.Add(new CameraTraveling(shotTime, firstCameraPosition, secondCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, fifthCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, sixthCameraPosition)); cameraShots.Add(new CameraShot(shotTime, seventhCameraPosition, true)); cameraShots.Add(new CameraTraveling(shotTime, fourthCameraPosition, thirdCameraPosition, true)); cameraShots.Add(new CameraTraveling(shotTime, thirdCameraPosition, secondCameraPosition, true)); cameraShots.Add(new CameraShot(shotTime, eighthCameraPosition, true)); CameraShotsList.Instance.initialize(cameraShots); #endregion }; thirdSongObjectives.OnEnded += (sender) => { if (chansonHoo2 != null) chansonHoo2.interrupt(); }; thirdSongObjectives.OnAccomplished += (sender, elapsedTime) => { int number = 0; foreach (Ped ped in thirdSongSpectatorsPeds) { if (ped != null && ped.Exists() && ped != Game.Player.Character) { ped.Task.ClearAllImmediately(); if (number < 10) { ped.Task.FightAgainst(Game.Player.Character); } else { if (number < 55) { ped.Task.ReactAndFlee(Game.Player.Character); } else { ped.Task.FleeFrom(Game.Player.Character); } } number++; } } }; GoToPositionInVehicle goToHome = new GoToPositionInVehicle(joeHomePosition); goToHome.setVehicle(Joe.bike); goToHome.Checkpoint = new Checkpoint(); goToHome.Checkpoint.SongsNames = new string[] { "flics5", "dialogue8", "dialogue9" }; goToHome.Checkpoint.addEntity(Joe.bike, thirdSongBikePosition, -90); goToHome.Checkpoint.PlayerPosition = thirdSongPosition; goToHome.Checkpoint.Health = 300; goToHome.Checkpoint.Armor = 100; goToHome.Checkpoint.WantedLevel = 4; goToHome.Checkpoint.Weather = Weather.ThunderStorm; goToHome.Checkpoint.setClockHour(23, 60000); goToHome.OnStarted += (sender) => { bikeRegen = true; }; goToHome.OnFirstTimeOnVehicle += (sender, vehicle) => { goToHome.AdviceText = "Evite les routes pour éviter les voitures de police"; }; /* //TODO : Necessaire ? goToHome.OnAccomplished += (sender, elapsedTime) => { AudioManager.Instance.startSound("dialogue10"); }; */ addObjective(goToFirstSongObjective); addObjective(firstSongObjectives); addObjective(goToPoliceWithBikeObjective); addObjective(goToSecondSongObjective); addObjective(secondSongObjectives); addObjective(goToTheaterWithBikeObjective); addObjective(goToThirdSongPosition); addObjective(thirdSongObjectives); addObjective(goToHome); #endregion }
void intial1() { Game.Player.WantedLevel = 0; Game.Player.Character.Weapons.RemoveAll(); Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1); Game.Player.CanControlCharacter = false; Function.Call(Hash.SET_ENABLE_HANDCUFFS, Game.Player.Character, true); Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, Game.Player.Character, true); Game.Player.Character.Task.ClearAllImmediately(); Game.Player.Character.Task.HandsUp(3000); Script.Wait(2500); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, 2124571506, -183807561); Function.Call(Hash.CLEAR_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Hate, -183807561, 2124571506); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, 2124571506, -183807561); Function.Call(Hash.SET_RELATIONSHIP_BETWEEN_GROUPS, (int)Relationship.Pedestrians, -183807561, 2124571506); escape_Ped = World.CreatePed(PedHash.Prisoner01, new Vector3(1625.474f, 2491.485f, 45.62026f)); escape_Ped.Task.StandStill(-1); escape_Ped.AlwaysKeepTask = true; escape_Ped.Heading = 320.5151f; Function.Call(Hash.SET_ENTITY_AS_MISSION_ENTITY, escape_Ped, true, true); Function.Call(Hash.SET_MAX_WANTED_LEVEL, 0); // get the closest policeman float dis = 35f; Ped[] test = World.GetNearbyPeds(Game.Player.Character, 30f); for(int i =0;i<test.Length;i++) { if (test[i].RelationshipGroup == -1533126372) { if (Game.Player.Character.Position.DistanceTo(test[i].Position)<dis) { dis = Game.Player.Character.Position.DistanceTo(test[i].Position); police = test[i]; } } } //get the closest police vehicle dis = 55f; Vehicle[] test2 = World.GetNearbyVehicles(Game.Player.Character, 50f); for (int i = 0; i < test2.Length; i++) { int mod_hash = test2[i].Model.GetHashCode(); if (mod_hash == VehicleHash.Police.GetHashCode() || mod_hash == VehicleHash.Police2.GetHashCode() || mod_hash == VehicleHash.Police3.GetHashCode() || mod_hash == VehicleHash.Police4.GetHashCode() || mod_hash == VehicleHash.Policeb.GetHashCode() || mod_hash == VehicleHash.PoliceOld1.GetHashCode() || mod_hash == VehicleHash.PoliceOld2.GetHashCode()) { if (Game.Player.Character.Position.DistanceTo(test2[i].Position) < dis) { dis = Game.Player.Character.Position.DistanceTo(test2[i].Position); policecar = test2[i]; } } } // make the player enter the vehicle Game.Player.Character.Task.ClearAllImmediately(); Game.Player.Character.Task.EnterVehicle(policecar, VehicleSeat.LeftRear); while (!Game.Player.Character.IsInVehicle(policecar)) Script.Wait(0); // disable the player control Function.Call(Hash.DISABLE_ALL_CONTROL_ACTIONS, 1); Game.Player.CanControlCharacter = false; Function.Call(Hash.SET_ENABLE_HANDCUFFS, Game.Player.Character, true); Function.Call(Hash.SET_ENABLE_BOUND_ANKLES, Game.Player.Character, true); police.Task.ClearAllImmediately(); police.RelationshipGroup = Game.Player.Character.RelationshipGroup; police.Task.ClearAllImmediately(); TaskSequence task = new TaskSequence(); task.AddTask.EnterVehicle(policecar, VehicleSeat.Driver); task.AddTask.DriveTo(test_veh, new Vector3(1855.855f, 2606.756f, 45.9304f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1831.152f, 2606.738f, 45.83254f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(5000); task.AddTask.DriveTo(test_veh, new Vector3(1754.018f, 2604.271f, 45.82404f), 3f, 10f, (int)DrivingStyle.Normal); task.AddTask.StandStill(50000); police.Task.ClearAllImmediately(); police.Task.PerformSequence(task); task.Close(); testt = true; }
void OnTick(object sender, EventArgs e) { //this._debug.Text = ; //this._debug.Draw(); BigMessage.OnTick(); Ped player = Game.Player.Character; if (_onMission) { Game.Player.WantedLevel = 0; if (_tick >= 60) { if (!_spotted) { _seconds--; _tick = 0; } } else { _tick++; } //FUTURE _headsup.Caption = "Level: ~b~" + _level; if (!_spotted) _headsup.Caption += "~w~\nStart Chase: ~b~" + ParseTime(_seconds); _headsup.Caption += "~w~\nKills: ~b~" + _kills; _headsup.Draw(); _headsupRectangle.Draw(); if (_seconds < 0) { UI.Notify("You ran out of time!\nThe ~r~criminals~w~ have escaped."); StopMissions(); } else { for (int i = 0; i < _criminals.Count; i++) { if (_criminals[i].IsDead) { _kills++; SpookCriminal(); AddCash(20 * _level); _criminals[i].MarkAsNoLongerNeeded(); _criminals.RemoveAt(i); _criminalBlips[i].Remove(); _criminalBlips.RemoveAt(i); if (_criminals.Count == 0) { _level++; SpookCriminal(); //int secsadded = _rndGet.Next(60, 200); //BigMessage.ShowMessage("~b~" + secsadded + " ~w~seconds added", 200, Color.White, 1.0f); _seconds = 180; UI.Notify("Good job officer! You've completed this level."); StartMissions(); } } else { if (_criminals[i].IsInVehicle()) { if (player.IsInVehicle()) { if ((player.Position - _criminals[i].Position).Length() < 40.0f && (player.CurrentVehicle.SirenActive || _criminals[i].IsInCombat) && !_spotted) { SpookCriminal(i); } } if ((player.Position - _criminals[i].Position).Length() < 50.0f && _criminals[i].CurrentVehicle.Speed < 1.0f && _spotted) { if (!_fighting) { _fighting = true; TaskSequence tasks = new TaskSequence(); tasks.AddTask.LeaveVehicle(); tasks.AddTask.FightAgainst(player, 100000); tasks.Close(); _criminals[i].Task.PerformSequence(tasks); } } else if (_fighting) { //this.Criminals[i].Task.ClearAll(); if (_criminals[i].IsInVehicle()) _criminals[i].Task.CruiseWithVehicle(_criminals[i].CurrentVehicle, 60.0f, 6); _fighting = false; } } else { if ((player.Position - _criminals[i].Position).Length() < 60.0f) { if (!_fighting) { _fighting = true; _criminals[i].Task.FightAgainst(player, 100000); } } else { if (_fighting) { TaskSequence tasks = new TaskSequence(); tasks.AddTask.EnterVehicle(); //tasks.AddTask.CruiseWithVehicle(this.Criminals[i].CurrentVehicle, 60.0f, 6); tasks.Close(); _criminals[i].Task.PerformSequence(tasks); //this.Fighting = false; } } } } } if (player.IsDead) { StopMissions(); } } } }
void HandleDriverShowOff() { UI.Notify("Driver showoff initiated"); foreach (Ped ped in drivers) { if (ped.IsInRangeOf(GetStartingLine(), GetStartingLineRadius())) { if (IsIdle(ped)) { if (IsInBurnout(ped)) { UI.Notify("Driver showoff UNLOCK"); UnlockDriver(ped); } else { Vector3 pos = ped.Position + ped.ForwardVector * 30; Function.Call(GTA.Native.Hash.SET_VEHICLE_BURNOUT, GetLastVehicle(ped), true); TaskSequence dd2 = new TaskSequence(); Function.Call(Hash.TASK_VEHICLE_DRIVE_TO_COORD, 0, GetLastVehicle(ped), pos.X, pos.Y, pos.Z, 100f, true, GetLastVehicle(ped).GetHashCode(), 16777216, 5f, 7f); dd2.Close(); ped.Task.PerformSequence(dd2); dd2.Dispose(); /* TaskSequence dd = new TaskSequence(); Function.Call(Hash.TASK_PAUSE, 0, 2000); dd.Close(); ped.Task.PerformSequence(dd); dd.Dispose(); */ } } } } }