Scripting/Server/Classes/Vehicle

PropertyTypeAccessDescription
IDintegerrVehicle id.
ModelintegerrModel id (VEH_*).
PosVectorrwPosition. Writing teleports it.
AnglefloatrwHeading in degrees.
RotationVectorr(0, 0, Angle).
VelocityVectorrwVelocity. Writing launches the vehicle.
Healthfloatrw1000 = full. 0 destroys it.
Colour1 / Col1integerrwPrimary colour index.
Colour2 / Col2integerrwSecondary colour index.
RGBColour1 / RGBColour2Vector|ColourrwExact RGB paint. Reads give a Vector(r,g,b); you can assign a Colour(r,g,b).
DriverPlayer|nullrPlayer in seat 0.
PassengerCountintegerrPlayers in the other seats.
Lockedboolean / integerrwDoors locked. Vehicles spawn unlocked (police cars included, since 0.1.9) unless you set this. v0.3.1+: also accepts 0 = open, 1 = locked for outsiders, 2 = locked for everybody including the people inside (they cannot leave the car, e.g. race cars). LockMode reads / writes the same number.
Alphaintegerrw0-255 transparency of the car body (255 = opaque). Wheels and occupants stay opaque. New in 0.3-r4.
Immunebooleanrwv0.3-r2+: while true nothing can damage the vehicle (bullets, explosions, collisions, fire): its health stays at 1000 on every client. Immunity is an alias.
AirControlbooleanrwv0.4-beta+: the driver can steer the car while all four wheels are off the ground, like in San Andreas. PC: the controls the player bound to "Turret left / right" (roll) and "Dodo up / down" (pitch) in Options > Controls; the normal steering keys do nothing in the air. Android: left stick = roll, gas / brake = pitch, L2 / R2 = turn. Cars only.
NoFlipBurnbooleanrwv0.4-beta+: an upside-down car takes no flip damage, so it cannot smoke, burn or blow up from lying on its roof: its health cannot go down while it is upside down (and for 1.5 s after). Cars only.
RadiointegerrwRadio station id of the vehicle.
SpawnPos / SpawnAngleVector / floatrwWhere it respawns.
RespawnTimeintegerrwSeconds until a wrecked vehicle respawns (0 = use vehicle_respawn_time).
IdleRespawnTimeintegerrwSeconds an empty vehicle may stay away from home before respawning (0 = never).
VirtualWorldintegerrwSee Player.VirtualWorld.
TaxiLightbooleanrwStored value; there is no visible effect yet.
LightState / LightsStateintegerrwThe headlights: LIGHTSTATE_AUTO (0, the game turns them on at night and in fog or rain), LIGHTSTATE_OFF (1) or LIGHTSTATE_ON (2). Synced to every player; the lights only draw while the engine is on. Also vehicle.SetLightState(state) / GetLightState() and the same with LightsState.
MarkerintegerrwA BLIPTYPE_* value (0-3). Only stored: it has no visible effect yet.
Alarmbooleanrwtrue = a car alarm: the horn sounds and the lights flash for about 15 seconds when somebody gets into the car.
HydraulicsbooleanrwThe car's hydraulic suspension (the lift of the Yardie Lobo, synced to every client). Only the Lobo (model 135) has it by default; true gives it to any car, false takes it away.

Vehicle methods

Methods and functions

Categories: Server classes