Resources
Modules
Server

Server Lib

spawnVehicle

Creates a vehicle on the server-side and returns its net ID.

qbx.spawnVehicle(params)
  • params: table
    • model: integer
      • A vehicle modle hash.
    • spawnSource: integer | vector3 | vector4
      • The handle of an entity or coords to spawn the vehicle at.
    • warp?: boolean | integer
      • An optional ped ID to warp into the vehicle after it spawns.
      • If spawnSource is a ped ID, you can pass true to warp the ped specified there instead.
    • props?: table

Returns:

  • netId: integer
  • entity: integer
-- spawns the vehicle at `myVectorCoords` and warps `myPed` inside
qbx.spawnVehicle({
  model = `asbo`,
  spawnSource = myVectorCoords,
  warp = myPed,
})
 
-- spawns the vehicle at `myPed` and warps the same ped inside
qbx.spawnVehicle({
  model = `asbo`,
  spawnSource = myPed,
  warp = true, -- causes `myPed` to be warped into the vehicle
})