Change/Add AI vehicles



Hi !
I searched on the forums but I didn’t see anything that helped me.
Is there a way to add AI spawning vehicles ? For exemple, I want to make the HVY Cutter spawn in the streets of LS ? Is it possible ?
And, is it possible to do the same with emergency services ? For exemple, make the Police Buffalo can spawn at 3 stars ?
Thanks :slight_smile:


I mean you’d have to add a large amount more to this but is this what you mean?

	while true do 
		if GetPlayerWantedLevel(GetPlayerPed(-1)) > 2 then 
			local vehicle_name = "Buffalo or Whatever vehicle name goes here"
			local vehicle_hash = GetHashKey(model)
			CreateVehicle(vehicle_hash, x, y, z, heading, 1, 0) -- Insert the x,y,z and heading

There also might be something in the FiveM source code that does this automatically. But I don’t have time to search through it all, but maybe you do.


Thats not what he is talking about.

He is talking about changing the default AI traffic.

Pretty sure its in the popgroups.yml or .ymtm

Ask @Marcel-R


Thanks @Knight_Marshal but it’s not what I want to do, for sure I can do like this but I think this isn’t the best way to do this.
@J.Manlet Tht’s right, popgroups.yml should work. But I don’t think this is the same file for the emergency services.


FiveM has issues with streaming .ymt files correctly
(at least thats what i found out when we had a custom popgroups.ymt on our server a while back. Haven’t tried since then tho)


… except popgroups.#mt isn’t a streaming meta file, so it doesn’t go in stream/.

Additionally, the data_file entry for popgroups needs to not specify any file extension. If you do it right, it works fine, and always has.


When you say “Do it properly” what do you mean? Is this possible to achieve on a fivem server, or only locally?


Never mind, it appears a similar topic was posted here: