marhex 17 Posted August 7, 2015 Share Posted August 7, 2015 what i need to do is when the player is being arrested 1- get the closest police vehicle 2- get the closest policeman 3- make the player go to the vehicle (with hands up) 4- meke the policeman drive the vehicle to the prison and thenks Link to post Share on other sites
Michael Wojtanis 23 Posted August 7, 2015 Share Posted August 7, 2015 Lol, all script. You want request. Just do something and people will put brick into Your work, but nobody will build house for You without Your work... Link to post Share on other sites
marhex 17 Posted August 8, 2015 Author Share Posted August 8, 2015 (edited) Lol, all script. You want request. Just do something and people will put brick into Your work, but nobody will build house for You without Your work... that is my code // 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(); Edited August 8, 2015 by marhex Link to post Share on other sites
Michael Wojtanis 23 Posted August 8, 2015 Share Posted August 8, 2015 You done, so where is problem? Link to post Share on other sites
marhex 17 Posted August 8, 2015 Author Share Posted August 8, 2015 You done, so where is problem? some time the policeman enter the vehicle but never drive and somtime he never enter the vehicle Link to post Share on other sites
bilago 25 Posted August 10, 2015 Share Posted August 10, 2015 You done, so where is problem? some time the policeman enter the vehicle but never drive and somtime he never enter the vehicle task.AddTask.DriveTo(test_veh... Where is "test_veh" defined? shouldn't it be policecar? Link to post Share on other sites