# createVehicle (Server)

> Creates a vehicle on the server, seen by every player.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Vehicles
- **URL**: https://wiki.mymp.gg/en/createVehicle-server
- **Counterpart**: Also exists on the client, with its own implementation: [createVehicle (Client)](https://wiki.mymp.gg/en/createVehicle-client.md)

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `model` | `string` | The vehicle model's name, such as `infernus`. Case does not matter. |
| `x, y, z` | `float` | Position in the world, or a vec3. |
| `rx, ry, rz` | `float` | Rotation 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 goes under the dynamic element of the resource that created it.

## Example

```lua
addCommandHandler("carro", function(player, command, model)
    local pos = getElementPosition(player)
    local vehicle = createVehicle(model or "infernus", pos.x + 3, pos.y, pos.z)
    if vehicle then
        warpPedIntoVehicle(player, vehicle)
    end
end)
```

### Coming from MTA

The model is given by name, not by MTA's number. There are no number plate or variant arguments.

## See also

- [createVehicle (Client)](https://wiki.mymp.gg/en/createVehicle-client.md): Creates a vehicle that exists on this client only.
- [warpPedIntoVehicle (Shared)](https://wiki.mymp.gg/en/warpPedIntoVehicle.md): Puts a ped or player straight into a vehicle seat, with no animation.
- [getVehicleMaxPassengers (Server)](https://wiki.mymp.gg/en/getVehicleMaxPassengers-server.md): Tells how many passengers fit in a vehicle, not counting the driver.
