Making AI drivers in C++ follow and pick up player

I am trying to make NPC drivers follow the player and also go to markers but when I tell them to do so they just turn their steering wheel toward me and do not drive forward.

static void DriveTo(Ped character, Vehicle car, float speed = 40.0f, int DriveMode = 786603) {
	Ped driver = DriverOf(car);
	AI::TASK_VEHICLE_TEMP_ACTION(driver, car, 9, 2000);
	WAIT(5);
	AI::_TASK_VEHICLE_FOLLOW(driver, car, character, DriveMode, speed, 10);
}

used:

DriveTo(character, vehicle, 40.0f, AIDriveStyle);

and i still need help with allowing the driver to stay in the vehicle when the player enters so they can be driven to the marker

I’m not 100% sure but i dont think fivem supports c++ scripting for neither server or client side

they support .asi plugins (visual studio compiles c++ projects to this) like lambda which are most likely also written in c++

mmm i know how too do in c# can send pm the script you can look how i did in c#

1 Like

^^ (info discord ?).

:open_mouth: ? what you mean xD

or mabye take a look on this one https://github.com/Zulfurix/FiveM-Taxi its also c# but yeah

Hi ! Did you find a solution to your problem ? I kindda have the same issue… Thanks

1 Like

Myself as well! Stuckkkk!