SpawnVehicle
The SpawnVehicle
export allows you to spawn a vehicle programmatically with persistence while ensuring it matches the server's vehicle data. This is useful for scenarios where vehicles need to be spawned externally but still retain their database-linked attributes.
How to Use
To spawn a vehicle with persistence, use the following code:
Explanation of Parameters
id
: Unique ID of the vehicle from the database (e.g.,player_vehicle > column id
).owner
: The player's identifier (Steam, Discord, etc.).vType
: Type of vehicle, such asvehicle
,boat
, orplane
.coords
: Coordinates and heading where the vehicle will spawn.props
: Vehicle modifications or properties retrieved from the database.source
: Player's server source ID.warp
: Boolean to decide if the player spawns directly inside the vehicle.
This export ensures that the spawned vehicle integrates seamlessly with the persistence system and retains all database-defined characteristics.
Last updated