Skip to main content

VehicleCreateXYZ

Description

Creates a vehicle at a specific 3D position in the world using the provided vehicle ID. Check here for more info about the vehicle ID and such.

function VehicleCreateXYZ(vehicleid, x, y, z) --[[ ... ]] end

Parameters

  • vehicleid: integer - The ID of the vehicle to spawn.
  • x: number - The X coordinate where the vehicle will appear.
  • y: number - The Y coordinate where the vehicle will appear.
  • z: number - The Z coordinate where the vehicle will appear.

Return Values

None.

Example

-- Get player's current position
local x, y, z = PedGetPosXYZ(gPlayer)

-- Create a vehicle next to the player
local car = VehicleCreateXYZ(295, x, y + 3, z) -- 295 = Police Car

print("Vehicle created!")

See Also