Donut Team is a labor of love, built and maintained by a small group of passionate developers. We invest our own time and resources to offer our tools, mods, and web services completely free of charge.

We don't run ads, and we will never sell your data - period.

If you've enjoyed anything we've created, please consider supporting our work with a one-time or monthly donation via our Ko-fi page . Every contribution helps us continue building great experiences for the community.

Dismiss
  • Games
  • Radical Entertainment
  • The Simpsons: Hit & Run
  • Scripting
  • Console Commands
  • MFK Commands
  • Level Initialisation
  • Traffic Groups

AddTrafficModel

This command adds a vehicle to a traffic group.

Scope

This command should be called between calls to CreateTrafficGroup and CloseTrafficGroup in a level's initialisation script.

Syntax

MFK
Lua
AddTrafficModel( car, amount, [no_park] );
Game.AddTrafficModel( car, amount, [no_park] )
  • car: The name of the car to add.
  • amount: How many instances of the car can appear at once.
  • no_park: Prevent the vehicle from spawning idle on CarStart Locators with the Parked Car flag.
    • Optional, defaults to 0 (which allows it to be parked).

Examples

MFK
Lua
CreateTrafficGroup(0);
	AddTrafficModel("minivanA", 2); 	// 2 instances, can appear parked
	AddTrafficModel("glastruc", 1, 1); 	// 1 instance, cannot appear parked
	AddTrafficModel("schoolbu", 1, 1);
	AddTrafficModel("pickupA", 1);
CloseTrafficGroup();
Game.CreateTrafficGroup(0)
	Game.AddTrafficModel("minivanA", 2) 	-- 2 instances, can appear parked
	Game.AddTrafficModel("glastruc", 1, 1)	-- 1 instance, cannot appear parked
	Game.AddTrafficModel("schoolbu", 1, 1)
	Game.AddTrafficModel("pickupA", 1)
Game.CloseTrafficGroup()

Notes

By default, the combined total of all the amount values for each call to this command must amount to 5 or the game will crash.

You can have more or less using the Custom Traffic Support hack.