Skip to content

Vehicles ​

VehicleSpec ​

Fields

  • model integer — Vehicle model id (400..611). A train engine spawns a whole train on the track nearest to x, y, z: 537 (freight, three flatcars), 538 (passenger, three coaches), 449 (a tram); carriages (569, 570, 590) cannot be spawned on their own.
  • x number
  • y number
  • z number
  • heading (optional) number — Degrees (default 0); a train faces along its track instead.
  • clockwise (optional) boolean — Whether a train faces along its track (true, the default) or against it.
  • color1 (optional) integer — Primary color index, 0 .. 127 (default 0).
  • color2 (optional) integer — Secondary color index, 0 .. 127 (default 0).
  • virtual_world (optional) integer
  • interior (optional) integer

VehicleDoorName ​

Type: "bonnet"|"boot"|"front_left"|"front_right"|"rear_left"|"rear_right"

VehicleWinch ​

A helicopter's winch: the magnet, or the small magnet (lifts only the RC Tiger).

Type: "magnet"|"small_magnet"

VehicleDamageStatus ​

Visible damage of a vehicle, one list per part type.

Fields

  • panels (optional) integer[] — 7 entries: front-left wing, front-right wing, rear-left wing, rear-right wing, windscreen, front bumper, rear bumper; 0 intact .. 3 worst.
  • doors (optional) integer[] — 6 entries: bonnet, boot, front-left, front-right, rear-left, rear-right; 0 intact, 2 bashed, 4 missing.
  • lights (optional) integer[] — 4 entries: front-left, front-right, rear-right, rear-left; 0 intact, 1 smashed.
  • wheels (optional) integer[] — 4 entries: front-left, rear-left, front-right, rear-right; 0 intact, 1 burst, 2 missing.

dlmp.vehicles ​

Returns all vehicles, from every resource.

Returns Vehicle[]

dlmp.create_vehicle ​

Creates a vehicle owned by this resource (removed when the resource stops) and streams it to players in range.

Parameters

Returns vehicle Vehicle|nil, err string|nil

dlmp.destroy_vehicle ​

Parameters

Returns ok boolean|nil, err string|nil

dlmp.put_player_in_vehicle ​

Seats a player instantly (seat 0 = driver), removing them from their current vehicle first. Fails when the vehicle is in a different virtual world or interior from the player. A train numbers its carriages' seats after the engine's: 0 is the driver, 1..5 are the engine's passengers, then five per carriage in train order (21 seats for 537 and 538).

Parameters

Returns ok boolean|nil, err string|nil

dlmp.remove_player_from_vehicle ​

Parameters

Returns ok boolean|nil, err string|nil

dlmp.attach_trailer ​

Hitches trailer to tractor: every copy of the trailer is moved to the tractor's tow bar and follows the tractor from then on. Only pairs the game itself hitches are allowed: the tow truck (525) and the farm tractor (531) tow any car that is not a trailer (531 also its farm trailer 610); the semi trucks (403, 514, 515) and the baggage trailers (606, 607) tow any trailer; the utility van (552) tows its trailer 611; the baggage tug (485) and the tug (583) tow the trailers 606..608. Both vehicles must be intact, in the same world, within 25 of each other and not frozen. The trailer must have no driver and must not be hitched to another tractor, the tractor must tow nothing else, and the chain may be at most four links long. Repeating an existing hitch does nothing.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.detach_trailer ​

Unhitches trailer from the vehicle towing it; fails when nothing is towing it.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_train_speed ​

Sets a train's speed in km/h in the direction it faces (negative = reversing; at most 720 either way) on every copy. A driver continues from that speed; a train without a driver brakes to a stop. A driven train derails if it takes a curve too fast. Fails for a train that is off its rails.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_train_direction ​

Turns a train to face along its track (clockwise) or against it; all carriages turn with it. The carriages keep their positions on the track, so a turned train pushes them.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_train_derailed ​

Derails a train (every carriage then moves freely), or puts it back at rest on the nearest point of its track. A player-driven train derails on its own when it takes a curve too fast. Players cannot enter a derailed train on their own; dlmp.put_player_in_vehicle still seats them.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_remote_vehicle ​

Gives player remote control of the RC vehicle rc (models 441, 464, 465, 501, 564, 594, which no one sits in): the player's camera and keys drive the RC while their body stays in place, and everyone sees the RC move. The player must be alive, on foot, in the RC's world and within dlmp.rc_range() of it, and no one else may be driving the RC. Any RC the player was driving before is released. The gamemode controls the engine (dlmp.set_vehicle_engine): an RC with the engine off does not move, and no one can sit in it to start it.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.remove_remote_vehicle ​

Releases the RC that player is driving; also returns true when there is none.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_rc_detonation ​

Sets whether the fire key blows up rc, and whether an RC Bandit also blows up when it crashes into something (on by default, as in the game). Kills from the explosion are credited to the driver. When off, the RC Tiger fires its minigun on the fire key instead.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_rc_range ​

Sets how far (meters, 0..180, default 150) an RC may move from its driver's body before the server takes control back (player_remote_exit "range"). Server-wide: the setting persists after the resource stops.

Parameters

  • meters number

Returns ok boolean|nil, err string|nil

dlmp.rc_range ​

Returns meters number

dlmp.set_vehicle_jacking ​

Sets whether players may take vehicles from the players driving them (on by default). Server-wide: the setting persists after the resource stops.

Parameters

  • on boolean

Returns ok boolean|nil, err string|nil

dlmp.vehicle_jacking ​

Returns boolean

dlmp.respawn_vehicle ​

Respawns a vehicle, wrecked or intact, at its spawn point with full health and removes all occupants. The respawned vehicle starts with default parameters: engine and lights off, doors closed, unlocked.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_position ​

Moves a vehicle and its occupants for everyone and stops it there (a frozen vehicle is held there). A vehicle on a tow link or a winch is released first. The position must be within the world (|x|, |y| <= 6000, -200 <= z <= 4000). Not for trains or wrecks.

Parameters

  • vehicle Vehicle
  • x number
  • y number
  • z number

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_rotation ​

Rotates a vehicle for everyone, in degrees: pitch (nose up), roll (right side down) and heading (as in dlmp.teleport), applied in the order heading, pitch, roll; the vehicle's motion is unchanged. 0, 0, vehicle:heading() rights a vehicle lying on its roof. A vehicle on a tow link or a winch is released first. Not for trains or wrecks.

Parameters

  • vehicle Vehicle
  • pitch number
  • roll number
  • heading number

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_velocity ​

Sets a vehicle's velocity for everyone, in m/s along the world axes (up to 200); the vehicle continues moving from there. Not for frozen vehicles, trains or wrecks.

Parameters

  • vehicle Vehicle
  • x number
  • y number
  • z number

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_turn_velocity ​

Sets a vehicle's turn velocity for everyone, in rad/s about the world axes (up to 25); otherwise works like dlmp.set_vehicle_velocity. A vehicle at rest on its wheels with no throttle immediately loses any spin about the vertical axis; give it some velocity as well, or lift it off the ground.

Parameters

  • vehicle Vehicle
  • x number
  • y number
  • z number

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_frozen ​

Freezes a vehicle for everyone at its server-side position, or unfreezes it. A frozen vehicle cannot be driven or pushed; dlmp.set_vehicle_position and dlmp.set_vehicle_rotation still move it. Freezing releases its tow links and winch, and a frozen vehicle cannot be hitched or picked up by a winch. A respawn keeps the frozen state. Not for trains or wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_colors ​

Paints a vehicle for everyone with two color indices (0 .. 127, as in dlmp.create_vehicle); a paintjob still covers them. A respawn keeps the colors. Not for wrecks.

Parameters

  • vehicle Vehicle
  • color1 integer
  • color2 integer

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_health ​

Sets a vehicle's health for everyone (1000 = full; below 250 it catches fire and explodes). Not for wrecks.

Parameters

  • vehicle Vehicle
  • health number — 0 .. 100000

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_damage_status ​

Sets a vehicle's visible damage for everyone; parts that become detached fly off. An omitted list means those parts are intact. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.repair_vehicle ​

Restores full health and removes all damage, for everyone. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_engine ​

Starts or stops the engine; a vehicle with its engine off cannot be driven. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_lights ​

Switches the lights on or off. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_locked ​

Locks or unlocks the doors. Players cannot enter a locked vehicle on their own (dlmp.put_player_in_vehicle still seats them); exiting always works. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_locked_for ​

Locks or unlocks the vehicle for a single player (nil reverts to the vehicle's own lock, dlmp.set_vehicle_locked); a locked-out player cannot enter on their own. Respawning the vehicle or the player leaving clears the setting: a gamemode that keeps a vehicle locked for a player this way must set it again after dlmp.respawn_vehicle (and after the vehicle explodes and respawns).

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_objective ​

Shows or hides the objective marker (an arrow above the vehicle) for a single player. Respawning the vehicle or the player leaving clears it.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_alarm ​

Turns the alarm on or off; it sounds (the horn beeps, the lights flash while the engine runs) until switched off. Audible only on cars and motorbikes. Not for wrecks; a respawn switches it off.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_siren ​

Switches the siren on or off. The driver can also toggle it with a short horn press, so this does not keep it off (to keep it off, remove the siren with dlmp.set_vehicle_has_siren). Only for a vehicle that has a siren (Vehicle:has_siren), not for wrecks; a respawn switches it off.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_has_siren ​

Gives the vehicle a siren that its driver toggles with a short horn press, or removes it (which also switches it off). By default, a vehicle has its model's own siren (Firetruck, Ambulance, Mr Whoopee, the police and FBI cars and motorbike; not the Rhino or the Predator boat); an added siren sounds without flashing lights. Only cars, bikes and the Vortex accept one: on a boat, plane, helicopter, train, trailer or RC model it would stay silent, so the call fails. A respawn keeps the setting. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.add_vehicle_component ​

Installs a part on the vehicle, replacing the installed part of the same type (a new spoiler replaces the old one); paired parts (side skirts, some bumpers) include their other side. Only parts the model accepts according to the game's own data (dlmp.vehicle_compatible_components): cars, monster trucks and quads accept the parts on their own list, and all of them accept wheels, nitro, hydraulics and the stereo. A respawn keeps the parts. Not for wrecks.

Parameters

  • vehicle Vehicle
  • component integer — part model id, 1000..1193

Returns ok boolean|nil, err string|nil

dlmp.remove_vehicle_component ​

Removes a part (and its other side) from the vehicle; fails if the vehicle does not have it. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.vehicle_component_slot ​

Returns the part type (slot) of a component (0..16: 0 hood, 1 vents, 2 spoiler, 3 side skirt, 4 front bullbar, 5 rear bullbar, 6 lamps, 7 roof, 8 nitro, 9 hydraulics, 10 stereo, 11 unused, 12 wheels, 13 exhaust, 14 front bumper, 15 rear bumper, 16 misc); a vehicle carries one part of each type. Returns nil for an id that is not a part.

Parameters

  • component integer

Returns slot integer|nil

dlmp.vehicle_compatible_components ​

Returns every part a vehicle model accepts (empty if the model accepts none).

Parameters

  • model integer

Returns components integer[]

dlmp.vehicle_paintjobs ​

Returns the number of paintjobs a vehicle model has (0 for most models).

Parameters

  • model integer

Returns count integer

dlmp.set_vehicle_paintjob ​

Applies one of the model's paintjobs (0 .. dlmp.vehicle_paintjobs(model) - 1) to the vehicle, or restores its plain colors (nil). A respawn keeps the paintjob. Not for wrecks.

Parameters

  • vehicle Vehicle
  • paintjob integer|nil

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_plate ​

Sets the vehicle's license plate: up to 8 characters from A-Z, 0-9 and space (lowercase is converted to uppercase); the plate design follows the city, as with the game's own plates. nil gives each copy a random game plate again. A respawn keeps the plate. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_dirt ​

Sets the vehicle's dirt level on every copy, 0 (clean) .. 15; afterwards it changes as each copy drives (dirt roads, rain), as in the game. nil stops overriding it. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_handling ​

Sets one handling property of the vehicle on every copy (in HANDLING.CFG units), or reverts it to the model's value (nil). A respawn keeps it. Not for wrecks. Properties and ranges: mass 1 .. 100000 (kg), turn_mass 1 .. 10000000, drag_coeff 0 .. 200, center_of_mass_x / _y / _z -10 .. 10 (m), traction_multiplier -100 .. 100, traction_loss 0 .. 100, traction_bias 0 .. 1, brake_deceleration 0 .. 1000, brake_bias 0 .. 1, abs (boolean), steering_lock 0 .. 360 (degrees), suspension_force_level 0 .. 100, suspension_damping 0 .. 100, suspension_high_speed_damping 0 .. 600, collision_damage_multiplier 0 .. 10, max_velocity 0.1 .. 1000 (km/h), engine_acceleration 0 .. 1000, engine_inertia 0.01 .. 1000, number_of_gears 1 .. 5 (integer). The drive type, suspension height and model flags cannot be set.

Parameters

  • vehicle Vehicle
  • property string
  • value number|boolean|nil

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_nitro_charges ​

Sets the remaining nitro charges of a vehicle with nitro, 0 .. 100. Installing a nitro part again refills them, and so does a respawn. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_taxi_light ​

Switches the taxi light of a taxi (420, 438) on or off. Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_winch ​

Gives a helicopter a winch, replaces it or removes it (nil); a vehicle hanging from it falls. The pilot lowers and raises the rope; the magnet picks up a vehicle it touches (winch_attach), and the pilot releases it (winch_detach). The "magnet" lifts cars, monster trucks, motorbikes without a rider, the Dinghy and the Vortex; the "small_magnet" lifts only the RC Tiger. A vehicle with a driver or on a tow link is not picked up. Only for helicopters, not for wrecks; a respawn removes the winch.

Parameters

Returns ok boolean|nil, err string|nil

dlmp.set_vehicle_door ​

Opens or closes one door once; afterwards the door moves as usual (it swings and shuts when someone gets in). Not for wrecks.

Parameters

Returns ok boolean|nil, err string|nil

Documentation licensed under CC BY 4.0. DarqlineMP is not affiliated with Rockstar Games or Take-Two Interactive. Grand Theft Auto is a trademark of Take-Two Interactive Software, Inc.