Vehicle::Vehicle

From RAGE Multiplayer Wiki

Shared
Function

 JavaScript


Creates a vehicle in given position.

JavaScript Syntax

Syntax

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

Parameters

Note: Question marked parameters are optional.

  • 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

Client Side

Server Side