Extras are additional vehicle components that can be turned on or off. They are often: police lights, luggage racks, ladders, spoilers, bullbars, different versions of body parts. This allows for greater customization of vehicles without the need for multiple models.

 

How do extras work in practice?
In the vehicle model files, the author defines so-called extra components, which have their own numbers (e.g. extra_1-9, extra_ten, extra_11, extra_12).
The player can activate/deactivate them using the appropriate script (Mechanic Job, vMenu, Tuning Menu).

How do extras work in our vehicles?
In our vehicles, extras function as police lights. We do not force police lights when spawning a vehicle, as not everyone may like it, although we will describe how to force them later in the documentation.

How to force extras every time a vehicle is spawned?
There are two best options for this - Forcing by using a script, forcing by configuring the vehicles.meta file (recommended).

➡️First Option:
Forcing extras through a script:

Example code:

RegisterCommand("spawnbuffalo", function()
	local playerPed = PlayerPedId() -- Get the player's ped (character)
	local coords = GetEntityCoords(playerPed) -- Get the player's current coordinates

	local model = `nkbuffalos` -- Set the vehicle model name

	RequestModel(model) -- Request the model to be loaded
	while not HasModelLoaded(model) do -- Wait until the model is fully loaded
    	Wait(100)
	end

	local vehicle = CreateVehicle(model, coords.x + 2, coords.y, coords.z, GetEntityHeading(playerPed), true, false) -- Create the 	vehicle 2 units away from the player
	SetPedIntoVehicle(playerPed, vehicle, -1) -- Put the player into the driver seat

	-- Forcing extras
	SetVehicleModKit(vehicle, 0) -- Required before modifying vehicle extras

	-- false = enabled, true = disabled
	SetVehicleExtra(vehicle, 1, false) -- enabled
	SetVehicleExtra(vehicle, 2, true) -- disabled
	SetVehicleExtra(vehicle, 3, false) -- enabled

	-- You can also disable all extras first, then enable selected ones
	-- for i = 0, 12 do
	--     if DoesExtraExist(vehicle, i) then
	--         SetVehicleExtra(vehicle, i, false)
	--     end
	-- end

	-- Optional cleanup
	SetEntityAsNoLongerNeeded(vehicle)
	SetModelAsNoLongerNeeded(model)
end)

 

➡️Second Option: - Recommended

Forcing extras through configuring the vehicles.meta file:

Step One:

Find the “requiredExtras” category in the vehicles.meta file. This is the category that interests you the most.

Step Two:
In the game, choose extras that interest you and you want them to activate every time. In my case it will be EXTRA_1, EXTRA_2, EXTRA_4 and EXTRA_5.

Step Three:

Add your extras to the category:

Step Four:
Restart your server and check if everything works - Everything should work.