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


#1

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


#2

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


#3

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


#6

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


#7

^^ (info discord ?).


#8

:open_mouth: ? what you mean xD


#9

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