Vehicle::Vehicle

From RAGE Multiplayer Wiki
Jump to navigation Jump to search
Js.png JavaScript


Creates a vehicle.
Notes:
- Colors don't always work as expected if you use them inside the function. Also number plate won't work properly. Better set those after vehicle is created.
- Heading means Z Rotation.
- in 0.3.7 numberPlate property is bugged, so set the numberPlate after vehicle creation with vehicle.numberPlate = 'plate';

Syntax

mp.vehicles.new(model, position,
{
    heading: heading,
    numberPlate: numberPlate,
    alpha: alpha,
    color: color,
    locked: locked,
    engine: engine,
    dimension: dimension
});

Parameters

  • model: Hash (use mp.joaat) or String
  • position: Vector3
  • heading: Number [-180:180]
  • numberPlate: String
  • alpha: Number
  • color: [[Number, Number, Number], [Number, Number, Number]]
  • locked: Boolean
  • engine: Boolean
  • dimension: Number

Examples

An example of creating a red Turismo with the license plate ADMIN

Client-Side
mp.vehicles.new(mp.game.joaat("turismor"), new mp.Vector3(-421.88, 1136.86, 326),
    {
        numberPlate: "ADMIN",
        color: [[255, 0, 0],[255,0,0]]
    });

Same example but creating a blue Turismo and using it server-side

Server-Side
mp.vehicles.new(mp.joaat("turismor"), new mp.Vector3(-441.88, 1156.86, 326),
    {
        numberPlate: "ADMIN",
        color: [[0, 255, 0],[0, 255, 0]]
    });

See also