Jump to content
  • Create New...

I'm new to callout coding - I have a question

Recommended Posts

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()
            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)
            suspect.Task.CruiseWithVehicle(VehicleHash.Adder 60f, 0,);


Link to post
Share on other sites

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:


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.


public override void OnStart(Ped 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 🙂


Arguably the best VIP member here


GitHub Account

Link to post
Share on other sites

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.

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

Important Information

Please view the site: Terms of Use, Privacy Policy, and Guidelines. // IMPORTANT: We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.