Skip to content

Vehicle ​

A server vehicle owned by the creating resource and removed when that resource stops. Reads return the server's state of the vehicle; on a removed vehicle they return nil, err.

Vehicle:id ​

Returns id integer

Vehicle:model ​

Returns model integer|nil, err string|nil

Vehicle:position ​

Current position, as reported by the driver or, for a driverless vehicle that is pushed or rolling, as nearby players see it.

Returns x number|nil, y number|string|nil, z number|nil

Vehicle:heading ​

Heading in degrees, updated like the position.

Returns heading number|nil, err string|nil

Vehicle:rotation ​

Rotation in degrees, in the form dlmp.set_vehicle_rotation accepts: pitch (nose up, -90 .. 90), roll (right side down) and heading. Updated like the position.

Returns pitch number|nil, roll number|string|nil, heading number|nil

Vehicle:velocity ​

Velocity in m/s on the world axes, as last reported by the player driving (or syncing) it, or as last set.

Returns x number|nil, y number|string|nil, z number|nil

Vehicle:turn_velocity ​

Turn velocity in rad/s about the world axes, sourced like velocity.

Returns x number|nil, y number|string|nil, z number|nil

Vehicle:is_frozen ​

Whether the vehicle is held still (dlmp.set_vehicle_frozen or a frozen driver).

Returns frozen boolean|nil, err string|nil

Vehicle:last_driver ​

The last player who drove it, even if they have since exited; nil once that player has left the server.

Returns player Player|nil, err string|nil

Vehicle:occupant_count ​

The number of players in the vehicle.

Returns count integer|nil, err string|nil

Vehicle:colors ​

Returns color1 integer|nil, color2 integer|string|nil

Vehicle:occupant ​

The player in seat (0 = driver); nil for an empty seat.

Parameters

  • seat integer

Returns player Player|nil, err string|nil

Vehicle:health ​

Health as reported by the player driving it (or syncing it without a driver); 0 once it has exploded.

Returns health number|nil, err string|nil

Vehicle:is_wrecked ​

True once the vehicle has exploded, until dlmp.respawn_vehicle.

Returns wrecked boolean|nil, err string|nil

Vehicle:engine ​

Whether the engine is on (server state; the core never starts it on its own).

Returns on boolean|nil, err string|nil

Vehicle:lights ​

Whether the lights are on; they only shine while the engine is running.

Returns on boolean|nil, err string|nil

Vehicle:is_locked ​

Whether the doors are locked, so players cannot enter on their own.

Returns locked boolean|nil, err string|nil

Vehicle:door ​

Whether the last command opened this door.

Parameters

Returns open boolean|nil, err string|nil

Vehicle:alarm ​

Whether its alarm is sounding (dlmp.set_vehicle_alarm).

Returns on boolean|nil, err string|nil

Vehicle:has_siren ​

Whether it has a siren that the driver toggles with the horn (built into its model, or added with dlmp.set_vehicle_has_siren).

Returns has boolean|nil, err string|nil

Vehicle:siren ​

Whether its siren is on (toggled by the driver or by dlmp.set_vehicle_siren).

Returns on boolean|nil, err string|nil

Vehicle:components ​

The installed components, one per kind (see dlmp.vehicle_component_slot).

Returns components integer[]|nil, err string|nil

Vehicle:paintjob ​

Its paintjob (dlmp.set_vehicle_paintjob), or nil for plain colors.

Returns paintjob integer|nil, err string|nil

Vehicle:plate ​

Its number plate (dlmp.set_vehicle_plate), or nil when each client shows a random plate generated by the game.

Returns plate string|nil, err string|nil

Vehicle:dirt ​

The dirt level last set with dlmp.set_vehicle_dirt, or nil if it was never set.

Returns level integer|nil, err string|nil

Vehicle:taxi_light ​

Whether its taxi light is on (dlmp.set_vehicle_taxi_light).

Returns on boolean|nil, err string|nil

Vehicle:handling ​

Its handling: every property dlmp.set_vehicle_handling sets, keyed by name (HANDLING.CFG units), with the gamemode's value where set and the model's default otherwise. abs is a boolean, number_of_gears an integer.

Returns handling table<string, number|boolean>|nil, err string|nil

Vehicle:nitro_charges ​

The nitro charges left (0 without nitro): a nitro component comes with 2, 5 or 10, the driver uses one at a time, and the component is removed when the last one burns out (dlmp.set_vehicle_nitro_charges).

Returns charges integer|nil, err string|nil

Vehicle:is_locked_for ​

Whether it is locked for this player: the per-player lock (dlmp.set_vehicle_locked_for) if set, otherwise the vehicle's lock.

Parameters

Returns locked boolean|nil, err string|nil

Vehicle:objective ​

Whether this player sees the objective marker above it (dlmp.set_vehicle_objective).

Parameters

Returns on boolean|nil, err string|nil

Vehicle:remote_controller ​

The player remotely driving this RC vehicle; nil if none.

Returns player Player|nil, err string|nil

Vehicle:rc_detonation ​

Whether the fire key and crashes detonate this RC vehicle (dlmp.set_vehicle_rc_detonation).

Returns on boolean|nil, err string|nil

Vehicle:trailer ​

The vehicle it tows; nil if none.

Returns trailer Vehicle|nil, err string|nil

Vehicle:tractor ​

The vehicle towing it; nil if it is not hitched.

Returns tractor Vehicle|nil, err string|nil

Vehicle:winch ​

A helicopter's winch (dlmp.set_vehicle_winch); nil if none.

Returns winch VehicleWinch|nil, err string|nil

Vehicle:cargo ​

The vehicle its winch carries; nil if none.

Returns cargo Vehicle|nil, err string|nil

Vehicle:lifter ​

The helicopter whose winch carries it; nil if none.

Returns heli Vehicle|nil, err string|nil

Vehicle:train_speed ​

A train's speed in km/h in the direction it faces (negative = reversing), as last reported by its driver (or the player syncing it without a driver) or as set by the gamemode.

Returns kmh number|nil, err string|nil

Vehicle:train_clockwise ​

Whether a train faces clockwise along its track.

Returns clockwise boolean|nil, err string|nil

Vehicle:is_derailed ​

Whether a train has derailed.

Returns derailed boolean|nil, err string|nil

Vehicle:damage_status ​

Visible damage as reported by the player driving it (or syncing it without a driver). Bikes, boats and aircraft are always intact.

Returns status VehicleDamageStatus|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.