M MY Multiplayer: Wiki
Side
Kind

createVehicle

Client

Creates a vehicle that exists on this client only.

Also exists on the server, with its own implementation: createVehicle

vehicle|false createVehicle(string model, float x, y, z [, float rx, ry, rz = 0, 0, 0])

Parameters

NameTypeDescription
modelstringThe vehicle model's name, such as infernus. Case does not matter.
x, y, zfloatPosition in the world, or a vec3.
rx, ry, rzfloatRotation in degrees, or a vec3.default 0, 0, 0

Returns

The created vehicle, or false if the name is not a vehicle model's.

The vehicle starts with 1000 health and its doors in the model's initial state. Only peds created on this client can get into it.

Example

local pos = getElementPosition(localPlayer)
local vehicle = createVehicle("infernus", pos.x + 4, pos.y, pos.z, 0, 0, 90)
Coming from MTAThe model is given by name, not by MTA's number. There are no number plate or variant arguments.

See also