JC_YYZ 6 Posted February 16 Share Posted February 16 So I am slowly trying my hand at coding some basic callouts. I have some coding experience (not a lot in C# though) and I am trying to wrap my head around this and use available resources. I want to spawn a car, and then put the suspect in the car and have them drive away when the player arrives. Here's my issue: I can't seem to track down the proper coding to have them hop into the vehicle that I have spawned. Is what I have below correct? Do I need to use the VehicleHash.Adder each time for the same vehicle? How do I tell the suspect to enter the vehicle that was spawned OnAccept? public async override Task OnAccept() { InitBlip(); UpdateData(); suspect = await SpawnPed(RandomUtils.GetRandomPed(), Location); await SpawnVehicle(VehicleHash.Adder, Location); suspect.SetIntoVehicle(VehicleHash.Adder, VehicleSeat.Driver); victim = await SpawnPed(RandomUtils.GetRandomPed(), Location + 1); } public override void OnStart(Ped player) { base.OnStart(player); suspect.Task.CruiseWithVehicle(VehicleHash.Adder 60f, 0,); Quote Link to post Share on other sites
Management Team NorthCam18 310 Posted February 17 Management Team Share Posted February 17 The issue with what you have executed is that you are spawning a vehicle, but not assigning it to anything. Therefore, when you try to set the suspect into the vehicle, it's not executing properly as you are trying to spawn it into a VehicleHash, when I believe it needs to take a Vehicle. Try this: Quote vehicle = await SpawnVehicle(VehicleHash.Adder, Location); suspect.SetIntoVehicle(vehicle, VehicleSeat.Driver); You would also want to assign the vehicle object that was just created in the OnStart, rather than another VehicleHash. Remember to add a comma to seperate each param as well. Quote public override void OnStart(Ped player) { base.OnStart(player); suspect.Task.CruiseWithVehicle(vehicle, 60f, 0,); Sorry for using quote blocks rather than code blocks, code blocks aren't working for me at the moment. Hope this helped Quote NorthCam18 OPERATIONS DIRECTOR GitHub Account | northcam@gtapolicemods.com Link to post Share on other sites
JC_YYZ 6 Posted February 17 Author Share Posted February 17 This is awesome help! I was running into issues also because I forgot to define the vehicle at the beginning. Did I do this correctly? I love learning this stuff. The video series from @BGHDDevelopmentis what got me interested in trying my hand at coding these. It's a departure from the CSS and HTML that I am used to working with for my job, but it's welcome and I hope to keep growing in my knowledge. Any resources are welcome and this community has been great and so helpful. I hope to be able to contribute some callouts once I am done nailing down some of the basics. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.