abdelmoez 1 Posted June 21, 2016 hi guys i wrote a script in c# for gta v i create Ped and vehicle and i give to the Ped a target so he will to but when the ped enter the car and drive he do strange thing he drive 1 cm forward the 1 cm backward !!! this is my code vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 17f), 228f); var ped = World.CreatePed(PedHash.Marine01SMM, new GTA.Math.Vector3(-1572f, 2772f, 17f)); ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f),70f, 550f);Function.Call(Hash.SET_PED_INTO_VEHICLE, ped, vehicle, -1f); by the way in the drive to task the 3rd argument is radius and i dont know what should i put for so i keep it 70 Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted June 21, 2016 vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 17f), 228f); var ped = vehicle.CreatePedOnSeat(VehicleSeat.Driver, PedHash.Marine01SMM); //create ped directly on seat instead of spawning, tasking to drive, then warping ped into vehicle ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f), 10f, 50f); //70 meters is quite far away, and I don't think 550 meters per second is even possible in GTA No idea if this will help, but they are some things that I thought could be improved. Quote Share this post Link to post Share on other sites
bhavinbhai2707 17 Posted June 21, 2016 hi guys i wrote a script in c# for gta v i create Ped and vehicle and i give to the Ped a target so he will to but when the ped enter the car and drive he do strange thing he drive 1 cm forward the 1 cm backward !!! this is my code vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 17f), 228f); var ped = World.CreatePed(PedHash.Marine01SMM, new GTA.Math.Vector3(-1572f, 2772f, 17f)); ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f),70f, 550f);Function.Call(Hash.SET_PED_INTO_VEHICLE, ped, vehicle, -1f); by the way in the drive to task the 3rd argument is radius and i dont know what should i put for so i keep it 70 heyyy i found some mistakes 1. i suggest u too use ped.setintovehicle bcause its implemented in scripthook so why to mess up with params n yess use it before driveto function because u know c# compiles line by line so it will first give command to drive n then set which is not right n check ur params i think u r doing something wrong or either upload the native over here so i can check because m in phone so its difficult to browse native db n about radius it means that upto how much distance around destination u want to drive for ex:- if u put radius 5f the ped will drive around 5f radius of desti point Quote Share this post Link to post Share on other sites
abdelmoez 1 Posted June 21, 2016 Thanks both for replying but the vehicle is still moving so slow and back and forth !! Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted June 21, 2016 check ur params i think u r doing something wrong or either upload the native over here so i can check because m in phone so its difficult to browse native db Besides him making the third parameter a float he did nothing wrong. void SET_PED_INTO_VEHICLE(Ped ped, Vehicle vehicle, int seatIndex) //correct function params -1 (int) is the driver's seat. Quote Share this post Link to post Share on other sites
abdelmoez 1 Posted June 21, 2016 this is a video showing what is happening with me http://recordit.co/UMVbHPvQpk Quote Share this post Link to post Share on other sites
abdelmoez 1 Posted June 21, 2016 (edited) check ur params i think u r doing something wrong or either upload the native over here so i can check because m in phone so its difficult to browse native db Besides him making the third parameter a float he did nothing wrong. void SET_PED_INTO_VEHICLE(Ped ped, Vehicle vehicle, int seatIndex) //correct function params -1 (int) is the driver's seat. I changed my code to this and nothing changed ' vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 20f), 228f);var ped = vehicle.CreatePedOnSeat(VehicleSeat.Driver, PedHash.Marine01SMM); //create ped directly on seat instead of spawning, tasking to drive, then warping ped into vehicleped.SetIntoVehicle(vehicle, VehicleSeat.Driver);ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f), 10f, 50f); //70 meters is quite far away, and I don't think 550 meters per second is even possible in GTA Edited June 21, 2016 by abdelmoez Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted June 21, 2016 (edited) Remove "ped.SetIntoVehicle(vehicle, VehicleSeat.Driver);", you don't need it, because vehicle.CreatePedOnSeat already does that. Edited June 21, 2016 by Jitnaught Quote Share this post Link to post Share on other sites
StAfFMaN 9 Posted June 21, 2016 Hello guys ! I have a problem with my code... The same problem than here : http://gtaforums.com/topic/817640-police-car-stuck-driveto-task-not-working/?hl=drive My police car is very slowly ... I don't know how can i fixe it, i have tried the solution in the link but it's don't work... This is my code : VoiturePoliceRenfort = World.CreateVehicle(ModelVehiculePolice, joueur.GetOffsetInWorldCoords(new Vector3(0.0f, 50.0f, 0.0f))); // joueur.Position.Around(250f); don't work too...VoiturePoliceRenfort.PlaceOnNextStreet();VoiturePoliceRenfort.PlaceOnGround();VoiturePoliceRenfort.LightsOn = true;VoiturePoliceRenfort.SirenActive = true;RenfortPoliceConducteur.DrivingStyle = DrivingStyle.Rushed;RenfortPoliceConducteur.Task.DriveTo(VoiturePoliceRenfort, joueurPosition, 20.0f, 100.0f); Please do you can help me ? [stAfF]MaN EDIT : Problem found !! Don't report in the tick() method this : Game.Player.IgnoredByPolice; OR Game.Player.IgnoredByEveryone; If you don't want police, juste set the wanted level to 0 in the tick() method !! I think it'll help you Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted June 21, 2016 (edited) @abdelmoez I tested the code I gave you and this is the result: . I do not get the problem you have. There must be another part of your mod that is causing the problem. @StAfFMaN I tested the code I gave him with IgnoredByEveryone and IgnoredByPolice set to true in a Tick, and I got the result you had in your post, but not the result he has, which is the ped driving forward and back repeatedly. Edited June 21, 2016 by Jitnaught Quote Share this post Link to post Share on other sites
StAfFMaN 9 Posted June 21, 2016 @StAfFMaN I tested the code I gave him with IgnoredByEveryone and IgnoredByPolice set to true in a Tick, and I got the result you had in your post, but not the result he has, which is the ped driving forward and back repeatedly. Oh okay sorry I thought it was the same problem But... i think there must be code in a loop that causes the problem Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted June 21, 2016 Oh okay sorry I thought it was the same problem But... i think there must be code in a loop that causes the problem If he does have that code in his Tick I still think he should try removing the code to see if it helps. Quote Share this post Link to post Share on other sites
abdelmoez 1 Posted June 21, 2016 (edited) @abdelmoez I tested the code I gave you and this is the result: . I do not get the problem you have. There must be another part of your mod that is causing the problem. @StAfFMaN I tested the code I gave him with IgnoredByEveryone and IgnoredByPolice set to true in a Tick, and I got the result you had in your post, but not the result he has, which is the ped driving forward and back repeatedly. I started new project and deleted all of the other code but the problem still there this is the code using System;using System.Collections.Generic;using System.Drawing;using System.Windows.Forms;using GTA;using GTA.Native;public class ArmyAttach : Script{ private Vehicle vehicle; public ArmyAttach() { Tick += OnTick; KeyDown += OnKeyDown; KeyUp += OnKeyUp; } void OnTick(object sender, EventArgs e) { } void OnKeyDown(object sender, KeyEventArgs e) { } void OnKeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.H) { vehicle = World.CreateVehicle(new Model("Crusader"), new GTA.Math.Vector3(-1572f, 2772f, 20f), 228f); var ped = vehicle.CreatePedOnSeat(VehicleSeat.Driver, PedHash.Marine01SMM); ped.Armor = 75; ped.Weapons.Give(WeaponHash.SMG, 900, true, true); ped.Task.DriveTo(vehicle, new GTA.Math.Vector3(443f, 2036f, 107f), 10f, 50f); UI.Notify("~b~Army~w~ Has Been Spawned"); } }} Edited June 21, 2016 by abdelmoez Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted June 21, 2016 Hm, maybe there is another mod that is conflicting? Quote Share this post Link to post Share on other sites
abdelmoez 1 Posted June 22, 2016 Hm, maybe there is another mod that is conflicting? thanks for every thing i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks Quote Share this post Link to post Share on other sites
Jitnaught 377 Posted June 22, 2016 Awesome! Glad you got it sorted out! Quote Share this post Link to post Share on other sites
bhavinbhai2707 17 Posted June 22, 2016 Hm, maybe there is another mod that is conflicting? thanks for every thing i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks just try to figure out which mod is conflicting with urs Quote Share this post Link to post Share on other sites
abdelmoez 1 Posted June 22, 2016 Hm, maybe there is another mod that is conflicting? thanks for every thing i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks just try to figure out which mod is conflicting with urs I have about 50 mods it's very hard to figure out Quote Share this post Link to post Share on other sites
StAfFMaN 9 Posted June 22, 2016 Too much of mods kills the mod lol Quote Share this post Link to post Share on other sites
bhavinbhai2707 17 Posted June 22, 2016 Hm, maybe there is another mod that is conflicting? thanks for every thing i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks just try to figure out which mod is conflicting with urs I have about 50 mods it's very hard to figure out if u will upload it somewhere then u have to find which mod is causing problem otherwise it can conflict for them too Quote Share this post Link to post Share on other sites
abdelmoez 1 Posted June 22, 2016 Hm, maybe there is another mod that is conflicting? thanks for every thing i made new copy of my GTA V folder and i deleted all the mods and it worked fin thanks just try to figure out which mod is conflicting with urs I have about 50 mods it's very hard to figure outif u will upload it somewhere then u have to find which mod is causing problem otherwise it can conflict for them too Yeah i know that , but I made this mod for myself so no need for that thanks by the way Quote Share this post Link to post Share on other sites