This is a AltV resource to spawn vehicles randomly on the native parking spots of GTA 5.
- Copy the files of this repository into a new folder called "ParkedVehicleSpawner" in your resource folder
- Add "ParkedVehicleSpawner" into the resource section of your server.cfg
- Add the following dependency into the resource.cfg in which you want to use the ParkedVehicleSpawner:
deps: [
"ParkedVehicleSpawner"
]
Usage in NodeJS
- Edit the
resource.cfg
and set the type tojs
and the main toserver/server.js
- Import the package by using
import * as ParkedVehicleSpawner from "ParkedVehicleSpawner";
- Spawn your desired amount of parked vehicled by using
ParkedVehicleSpawner.spawn(amount);
Usage in C-Sharp
- Use the following code:
{
public override void OnStart()
{
Alt.Import("SetRandomParkedVehicleCount", "SetRandomParkedVehicleCount", out Action<int> SetRandomParkedVehicleCount);
SetRandomParkedVehicleCount({NumbersOfVehiclesYouWantToSpawn}) //to set an approximately count of vehicle spawns
Alt.Import("SpawnParkedVehicles", "SpawnParkedVehicles", out Action SpawnParkedVehicles);
SpawnParkedVehicles() //to spawn the vehicles
}
}
Look into the four JSONs to change spawning behaviour.
CarColorsRGBs.json
- Colors in which the cars randomly spawn, format:{r: 0, g: 0, b: 0, a: 1}
, set as empty array to let the resource select colors randomlyCarGenerators.json
- Parking spots on which vehicles can spawn (can also be used for other purposes)PopGroup.json
- Some parking spots have a "popGroup" which is a group of vehicles which can be spawned on a specific parking spot.none
is the standard popGroup if a CarGenerator spot doesn't have a specific carModel and no popGroup.ColorlessCars.json
- Vehicles which will not be colored randomly by this resource