- Documentation
- Vehicles
Category
Vehicles
All Lua functions and events in the Vehicles category, on the server and the client.

Server functions 130
addStores a set of custom siren lights for the vehicle: number of points, type and flags. After it,Vehicle Sirens setVehicleSirenssets the position and colour of each point.areReturns the value set withVehicle Doors Undamageable setVehicleDoorsUndamageable(falseby default).attachAttaches a trailer or semi-trailer to a towing vehicle (truck, tractor, tow truck) for every player. Fires theTrailer To Vehicle onTrailerAttachevent on the trailer; if a script cancels it (cancelEvent), the trailer is not attached. Players can also attach trailers normally in the game by reversing a truck onto them.blowDestroys a vehicle: health drops to 0, the engine stops, the vehicle becomes a wreck (Vehicle isVehicleBlown=true) and theonVehicleExplodeevent fires. By default every player also sees an explosion. If respawning is enabled for the vehicle (toggleVehicleRespawn, off by default), the wreck returns to its spawn point after the time set withsetVehicleRespawnDelay(10 s by default); without respawning the wreck disappears after the time fromsetVehicleWreckDelay(20 s by default). Blowing up an already destroyed vehicle does nothing.detachDetaches a trailer from the towing vehicle for every player and firesTrailer From Vehicle onTrailerDetachon the trailer. A specific trailer can be given; then the function only works if that trailer is the one attached.getReturns the names of all handling fields accepted byHandling Field Names setVehicleHandlingandsetModelHandling:mass,turnMass,dragCoeff,centerOfMass,percentSubmerged,tractionMultiplier,tractionLoss,tractionBias,numberOfGears,maxVelocity,engineAcceleration,engineInertia,driveType,engineType,brakeDeceleration,brakeBias,ABS,steeringLock, thesuspension*fields,seatOffsetDistance,collisionDamageMultiplier,monetary,modelFlags,handlingFlags,headLight,tailLight,animGroup.getReturns the value stored withHeli Blade Collisions Enabled setHeliBladeCollisionsEnabled(trueby default).getReturns the handling changes set for a model withModel Handling setModelHandling(without factory values).getReturns a model's number of passenger seats after applying the limit fromModel Max Passengers setModelMaxPassengers.getReturns the direction stored withTrain Direction setTrainDirection(trueby default).getReturns the track position stored withTrain Position setTrainPosition(0 by default).getReturns the speed stored withTrain Speed setTrainSpeed(0 by default).getReturns the track number stored withTrain Track setTrainTrack(0 by default).getReturns the movable part setting stored withVehicle Adjustable Property setVehicleAdjustableProperty(0 by default).getReturns the two palette numbers set withVehicle Color Id setVehicleColorId. When the vehicle has RGB colours fromsetVehicleColor(or none yet), it returnsfalse; usegetVehicleColorthen.getReturns the part offset stored withVehicle Component Position setVehicleComponentPosition(0, 0, 0 when not set).getReturns the part rotation stored withVehicle Component Rotation setVehicleComponentRotation(0, 0, 0 when not set).getReturns the part scale stored withVehicle Component Scale setVehicleComponentScale(1, 1, 1 when not set).getReturns the vehicle helper point position stored withVehicle Dummy Position setVehicleDummyPosition.getReturns a vehicle's entry points: those set withVehicle Entry Points setVehicleEntryPoints, or four approximate points at the sides of the vehicle (for seats 0-3) at its current position.getReturns the vehicle's gravity direction stored withVehicle Gravity setVehicleGravity(0, 0, -1 by default).getReturns after how many milliseconds an abandoned vehicle returns to its respawn point (60000 by default, 0 = off).Vehicle Idle Respawn Delay getReturns the value stored withVehicle Landing Gear Down setVehicleLandingGearDown(trueby default).getReturns the factory position of a model helper point. ForVehicle Model Dummy Default Position seat_frontandseat_rearit gives the game's factory front and rear seat position.getReturns a model helper point position set withVehicle Model Dummy Position setVehicleModelDummyPosition.getReturns a model's exhaust outlet position set withVehicle Model Exhaust Fumes Position setVehicleModelExhaustFumesPosition.getReturns the plate design set withVehicle Plate Design setVehiclePlateDesign(-1 = the game decides).getReturns how many milliseconds after destruction this vehicle's wreck respawns (10000 by default).Vehicle Respawn Delay getReturns the coordinates of the place where the vehicle appears when it respawns.Vehicle Respawn Position getReturns the rotation the vehicle will have when it respawns.Vehicle Respawn Rotation getReturns the rotor speed stored withVehicle Rotor Speed setVehicleRotorSpeed(0 by default).getReturns the value stored withVehicle Rotor State setVehicleRotorState(trueby default).getReturns the siren settings fromVehicle Siren Params addVehicleSirensas a table:SirenCount,SirenTypeandFlags(["360"],DoLOSCheck,UseRandomiser,Silent).getReturns the list of siren points stored withVehicle Sirens addVehicleSirensandsetVehicleSirens. Each point is a table with the fieldsx,y,z,Red,Green,Blue,Alpha,Min_Alpha.getReturns every existing vehicle of a model, e.g. all taxis on the map.Vehicles Of Type getReturns the trailer the given vehicle is towing.Vehicle Towed By Vehicle getReturns the vehicle that is towing the given trailer.Vehicle Towing Vehicle getReturns a vehicle's rotation speed around the x, y, z axes. This is the same function asVehicle Turn Velocity getElementAngularVelocity.getReturns the turret rotation stored withVehicle Turret Position setVehicleTurretPosition(horizontal, vertical in radians; 0, 0 by default).getReturns a wheel's grip: 0 = full, 1 = slipping, 2 = none.Vehicle Wheel Friction State getReturns the wheel size multiplier stored withVehicle Wheel Scale setVehicleWheelScale(1 by default).getReturns the wheel rotations stored withVehicle Wheels Rotation setVehicleWheelsRotation.getReturns how many milliseconds after the explosion this vehicle's wreck disappears (forVehicle Wreck Delay root: the default, initially 20000).isChecks whether a carriage is the locomotive leading the train.Train Chain Engine isReturns the value stored withTrain Derailable setTrainDerailable(trueby default).isReturns the value stored withTrain Derailed setTrainDerailed(falseby default).isChecks whether the vehicle is damage proof (Vehicle Damage Proof setVehicleDamageProof).isReturns the value set withVehicle Fuel Tank Explodable setVehicleFuelTankExplodable(falseby default).isChecks whether a vehicle has automatic respawning enabled (Vehicle Respawnable toggleVehicleRespawn).falseby default: the wreck of such a vehicle does not come back but disappears after the time fromsetVehicleWreckDelay.isReturns the value stored withVehicle Smoke Trail Enabled setVehicleSmokeTrailEnabled(falseby default).isReturns whether a window was marked as rolled down withVehicle Window Open setVehicleWindowOpen.removeRemoves the custom sirens added to the vehicle withVehicle Sirens addVehicleSirens.resetRestores the factory (or inherited from the base model) position of one seat of a model or, without a seat number, of all its seats.Model Seat Position resetClears the part offset stored withVehicle Component Position setVehicleComponentPosition.resetClears the part rotation stored withVehicle Component Rotation setVehicleComponentRotation.resetClears the part scale stored withVehicle Component Scale setVehicleComponentScale.resetClears every vehicle helper point stored withVehicle Dummy Positions setVehicleDummyPosition.resetRestarts the countdown to a wreck respawn: the wreck respawns after the full time fromVehicle Explosion Time setVehicleRespawnDelay, counted from now. When the vehicle is not a wreck waiting to respawn, the function changes nothing.resetResets the vehicle's idle counter, as if someone had just got out. The countdown to returning an abandoned vehicle (Vehicle Idle Time setVehicleIdleRespawnDelay) starts again. Useful e.g. when a player has parked the car in a garage and you want to give them more time.resetReturns all of a vehicle's lamps toVehicle Lamp States 'auto', i.e. working as in the game. Clears everything set withsetVehicleLampState.respawnImmediately respawns a vehicle at its respawn point (where it was created, or the point fromVehicle setVehicleRespawnPosition). All occupants are removed from the vehicle, its speed is zeroed, health goes back to 1000 and door, panel, lamp and wheel damage disappears. Fires theonVehicleRespawnevent. Also works for a vehicle that is not a wreck.setStores whether a helicopter's rotor blades should cut whatever they hit (peds, other vehicles).Heli Blade Collisions Enabled setStores your own list of parts that fit a vehicle model, e.g. for a new model fromModel Compatible Upgrades engineRequestModel.setChanges the handling of every vehicle of a model at once, for every player, including vehicles created later. A single car's changes fromModel Handling setVehicleHandlingtake priority over the model setting.setLimits a model's passenger seats: players cannot get into seats with a higher number (the server cancels entering). Also works for new models fromModel Max Passengers engineRequestModel. You cannot add seats the base model does not have.nilorfalseremoves the limit.setMoves a seat position in a vehicle for the whole model, for every player: where the ped sits and which way it faces. Most often used to place seats in new vehicles fromModel Seat Position engineRequestModelandengineReplaceModel, which by default have the base car's seats. The number of seats does not change.setCopies seat positions from another model to the given model, e.g. a new vehicle fromModel Seats From engineRequestModelshould seat people like a Sultan. Without a seat number it copies every seat the source has.setStores whether a train can derail (e.g. when taking a bend too fast).Train Derailable setStores whether a train is derailed.Train Derailed setStores the direction in which a train travels along the track.Train Direction setStores a train's position on the track as the distance from the start of the track.Train Position setStores a train's speed along the track.Train Speed setStores the number of the track the train runs on.Train Track setStores the setting of a vehicle's movable part: dozer blade, forklift forks, crane arm, Hydra nozzles.Vehicle Adjustable Property setSets a vehicle's colours using numbers from the San Andreas vehicle palette (0-127), as in the classic game and the carcols files. Number 0 is black, 1 white, 3 red, 6 yellow… (Vehicle Color Id getVehiclePaletteColorgives names and colours). Passing one number sets both main colours to it.setStores an offset for a named part of a vehicle model (e.g. the bonnet) relative to its position in the model.Vehicle Component Position setStores a rotation for a named part of a vehicle model in degrees (x, y, z).Vehicle Component Rotation setStores a scale for a named part of a vehicle model on three axes (1 = original size).Vehicle Component Scale setStores the position, rotation and scale of a model part in one call. Each of the three arguments is a vector or aVehicle Component Transform { x, y, z }table; an omitted one (nil) stays unchanged.setStores a vehicle's gear number.Vehicle Current Gear setMakes a vehicle damage proof for every player: collisions, shots and explosions do not take its health or break the body. Useful for showroom vehicles, city buses or vehicles in a safe zone.Vehicle Damage Proof setSets how dirty the body looks for every player: 0 = spotless, 1 = very dusty. Useful for car washes and for cars abandoned in the desert. A new vehicle fromVehicle Dirt Level createVehicleis clean.setOpens a door, the bonnet or the boot of a vehicle to the given degree for every player: 0 = shut, 1 = wide open, 0.5 = halfway. Useful e.g. in a workshop (open bonnet) or when searching the boot. Door numbering as inVehicle Door Open Ratio setVehicleDoorState.setSets the state of one door (or the bonnet or boot) of a vehicle for every player: shut, ajar, dented or missing. Door numbers: 0 bonnet, 1 boot, 2 front left, 3 front right, 4 rear left, 5 rear right. A vehicle without that door simply will not show it.Vehicle Door State setStores whether the vehicle's doors should be impossible to break off.Vehicle Doors Undamageable setStores the position of a helper point (dummy) for one vehicle, e.g. the exhaust or lights.Vehicle Dummy Position setFits a vehicle with an engine described by real-car parameters (power, torque, displacement, fuel, mass, gears) and calculates the handling fields from them: mass, top speed, acceleration, engine inertia, fuel type, number of gears and grip. An engine much stronger than the factory one reduces grip (wheelspin). Wear lowers power by up to 30%.Vehicle Engine nilrestores the factory engine. Good for tuning and engine-swap systems on RP servers.setStores custom entry points for a vehicle (a table ofVehicle Entry Points { x, y, z, seat }points).setStores whether the vehicle's fuel tank should explode when shot (shooting the tank blows the car up).Vehicle Fuel Tank Explodable setStores a custom gravity direction for a vehicle as a vector (0, 0, -1 by default, i.e. down). This allows e.g. driving on walls.Vehicle Gravity setChanges the colour of a vehicle's headlights for every player, e.g. xenon blue or yellow. It affects the glowing lenses and the light patch in front of the car.Vehicle Head Light Color setNewSets a vehicle health floor: bullets, fire, explosions and collisions will not take the health below this value. A floor of 250 or more stops the car from catching fire or exploding from damage. A script can still go lower with setElementHealth or blowVehicle. 0 turns the floor off.Vehicle Health Floor setSets after how many milliseconds an abandoned vehicle returns to its respawn point by itself. "Abandoned" means nobody is inside and it stands more than 0.5 m from the respawn point. The counter resets when someone gets in. The default is 60000 ms; 0 turns returning of abandoned vehicles off. The countdown runs for vehicles whose respawning was configured with any function from this group (e.g. this one) or which have been a wreck; a freshly created, unconfigured vehicle does not return by itself.Vehicle Idle Respawn Delay setTurns on a vehicle's indicators, which blink for every player. On vehicles with their own model (Vehicle Indicators engineReplaceModel) the lamps marked in the model with SA indicator colours blink. Game cars have no separate indicators, so the front blinks orange and the rear uses the red lens. A single lamp is set withsetVehicleLampState.setTurns one lamp (or a group of lamps) of a vehicle on, off or back to game control, for every player. This lets a script e.g. light the brake lamps when braking, the reverse lamps, or leave a single headlight working. TheVehicle Lamp State 'auto'state means the lamp works as usual in the game. An indicator set to'on'shines steadily; blinking comes fromsetVehicleIndicators. Game cars have no reverse lamps or separate indicators (the front shines orange, the rear uses the red lens); custom models fromengineReplaceModelhave all lamps.setLowers or raises a plane's landing gear. The change reaches the game of every player who has the plane loaded, also after it is loaded again. The pilot can then change the gear with the key, as usual in the game.Vehicle Landing Gear Down setBreaks or repairs one lamp of a vehicle for every player. Numbers: 0 front left, 1 front right, 2 rear left, 3 rear right. A broken lamp does not light up, even with the lights on.Vehicle Light State setStores a model's number of passenger seats on the server. The game client usually does this automatically; a script can provide it earlier soVehicle Max Passengers getVehicleMaxPassengersknows it from the start.setStores the position of a helper point (dummy) for a whole vehicle model. TheVehicle Model Dummy Position seat_frontandseat_rearpoints move the seats (front and rear) in the game for every player; other points are stored for scripts.setStores the exhaust outlet position for a whole vehicle model (vehicle space, metres).Vehicle Model Exhaust Fumes Position setStores nitro being switched on or off. Switching on uses one charge fromVehicle Nitro Activated setVehicleNitroCount(with -1 charges never run out); without charges the function returnsfalse.setStores the vehicle's number of nitro charges, used up byVehicle Nitro Count setVehicleNitroActivated.setStores the nitro charge level (like the nitro bar in the game).Vehicle Nitro Level setApplies one of the factory paintjobs from the Loco Low Co. and Wheel Arch Angels garages to a vehicle, visible to every player. Only some models have paintjobs (e.g. Elegy, Jester, Savanna, Blade); nothing changes on others. The paintjob covers the main colour.Vehicle Paintjob setSets the damage level of one body part for every player. Numbers: 0 front left wing, 1 front right wing, 2 rear left, 3 rear right, 4 windscreen, 5 front bumper, 6 rear bumper. State 0 = intact, 3 = badly damaged (a bumper may fall off).Vehicle Panel State setChooses the graphic design of the licence plate (background and state colours) for every player. Normally the game picks the design by the city where the vehicle was created; this function sets it permanently.Vehicle Plate Design setNewSets what a vehicle is immune to: bullets, fire, explosions, collisions and melee. Works for every player. AllVehicle Proofs falserestores normal behaviour. setVehicleDamageProof also makes it immune to everything at once.setSets how many milliseconds after destruction a vehicle's wreck respawns at its respawn point. The default is 10000 ms (10 s). Only works with respawning enabled (Vehicle Respawn Delay toggleVehicleRespawn). The new time applies to later explosions; for a wreck already waiting useresetVehicleExplosionTime.setSets the place (and optionally the rotation) where the vehicle appears when it respawns: after destruction, after being abandoned and onVehicle Respawn Position respawnVehicle. By default it is where the vehicle was created. The vehicle is not moved right away.setSets the rotation the vehicle will have when it respawns (the respawn position stays the same).Vehicle Respawn Rotation setStores the rotation speed of a helicopter rotor or a plane propeller.Vehicle Rotor Speed setStores whether a helicopter's rotor should spin.Vehicle Rotor State setSets the position and colour of one siren point added withVehicle Sirens addVehicleSirens.setTurns the siren and light bar of an emergency vehicle (police, ambulance, fire truck) on or off for every player, just like a player does with the horn key in the game. Nothing is visible on vehicles without a siren.Vehicle Sirens On setStores whether a smoke trail should follow a plane (e.g. Stuntplane, Cropduster).Vehicle Smoke Trail Enabled setChanges the colour of a vehicle's tail lights for every player (red by default).Vehicle Tail Light Color setTurns the "TAXI" roof light of a taxi on or off for every player (models with the light: Taxi 420, Cabbie 438). A lit sign usually means the taxi is free.Vehicle Taxi Light On setSets a vehicle's rotation speed around the x, y, z axes, e.g. to make a car spin. This is the same function asVehicle Turn Velocity setElementAngularVelocity.setStores the turret rotation of a vehicle (Rhino tank, SWAT van, fire truck): horizontal and vertical, in radians.Vehicle Turret Position setChooses the appearance variants of a vehicle model, i.e. the game's factory extras: roof rack, a different pickup bed, cargo, covers. Every model has its own number of variants (many have none). Without arguments a variant is picked at random. The change is visible to every player.Vehicle Variant setNewChanges a vehicle's wheel grip with a multiplier (1 = normal, 0.5 = half, 1.5 = half again as much). Each resource has its own multiplier and the car gets their product. 1 removes the resource's multiplier, and stopping a resource removes its multipliers by itself.Vehicle Wheel Grip setStores a multiplier for the vehicle's wheel size (1 = normal).Vehicle Wheel Scale setStores the rotation of each of a vehicle's four wheels in degrees.Vehicle Wheels Rotation setSets the state of a vehicle's wheels for every player: inflated, flat or fallen off. Argument order: front left, rear left, front right, rear right. For a bike the first two count (front, rear). Pass -1 orVehicle Wheel States nilto leave a wheel unchanged.setStores whether a vehicle window is rolled down. Window numbers 0-3.Vehicle Window Open setNewTints a vehicle's windows for every player and can give them a light colour. The darkest is 80% - a higher value also gives 80%, because the glass should still look like glass: reflections stay and you can still see a bit of the interior. The colour only tints the glass, the darkening does most of the work. Darkness 0 without a colour restores the normal windows.Vehicle Window Tint setSets how many milliseconds after the explosion a vehicle wreck disappears from the map (the element is destroyed, withVehicle Wreck Delay onElementDestroycalled; players inside fall out). The default is 20000 ms (20 s); 0 = the wreck stays forever. Passingrootchanges the default for all vehicles without their own setting. Does not apply to vehicles with respawning enabled (toggleVehicleRespawn) — those come back repaired at their respawn point.fixVehiclebefore the time runs out stops the removal. A change for a wreck already waiting restarts the countdown.spawnRespawns a vehicle once at the given spot, likeVehicle respawnVehicle: removes occupants, repairs the vehicle and zeroes its speed. The stored respawn point does not change, so later automatic respawns still go back to the old place.spawnCreates an object element at the vehicle's position and gives it the vehicle's speed with a slight random spread, as if a part had fallen off. The object disappears after the given time. The part number is stored in the element dataVehicle Flying Component flyingComponent.toggleEnables or disables automatic respawning of a vehicle. Off by default: a scripted vehicle does not come back by itself. When enabled, a wreck returns repaired to the respawn point after the time fromVehicle Respawn setVehicleRespawnDelay, and an abandoned vehicle after the time fromsetVehicleIdleRespawnDelay. Disabling it cancels a wreck respawn already waiting in the queue; a wreck without respawning disappears after the time fromsetVehicleWreckDelay(20 s by default).
Client functions 1
Shared functions 80
addFits a tuning part to a vehicle (spoiler, wheels, exhaust, nitro, hydraulics, bumpers…), visible and working for every player. The part must fit the model (Vehicle Upgrade getVehicleCompatibleUpgradeslists them). If the same slot already had a part, it is replaced; fitting the same part again changes nothing. New parts added withengineRequestModelwork too.areChecks whether the vehicle's headlights are on, i.e. whetherVehicle Lights On setVehicleOverrideLights(vehicle, 2)was set. Works on both sides.calculateCalculates which handling fields an engine would give in a model, without fitting it. It returns whatEngine Handling setVehicleEnginewould write into the vehicle, so it suits a preview in an engine shop.createCreates a vehicle in the world: model, position, rotation and number plate text.Vehicle fixRepairs a vehicle to factory condition: 1000 health, and every door, body panel, lamp and wheel returns to undamaged; a wreck stops being a wreck. It also cancels a scheduled wreck respawn. For one second after the repair the server ignores damage reports from the game so the old damage does not come back. Colour, tuning and plate stay as they were.Vehicle getReturns the name of the handling.cfg entry a model uses, e.g. 411 →Handling Line Name INFERNUS, 596 →POLICE_LA. New models fromengineRequestModeluse their base model's entry.getLikeModel Compatible Upgrades getVehicleCompatibleUpgrades, but for a model number, without creating a vehicle. Useful in a shop that shows parts before buying the car.getReturns the game's factory seat position for a model (for new models, of the base model), without script changes.Model Default Seat Position getReturns a model's current seat position and the source of the data:Model Seat Position script(set by script),dummy(from the model's helper point) ordefault(factory, from the game).getFinds the colour in the game's vehicle palette (0-127) most similar to the given RGB colour. Useful when a player picks a colour with a free colour picker and the script wants to store it as a palette number.Nearest Vehicle Palette Color getReturns a model's factory handling straight from the game files (Definitive Edition handling.cfg), without any script changes. Works on both sides.Original Handling getReturns a vehicle's colours. Without the second argument it gives four game palette numbers (when the car has RGB colours, the numbers are the nearest palette colours). WithVehicle Color rgb = trueit returns twelve numbers: r, g, b for colours 1-4 in turn, exactly as seen in the game.getReturns the tuning parts that fit this vehicle, based on the game's data (the carmods list plus wheels for regular cars). The result can be narrowed to one slot. Ideal for building a workshop menu.Vehicle Compatible Upgrades getReturns a vehicle model's parts as a table of name → visible. On the client, for a model from a file (Vehicle Components engineReplaceModel) it is the full list of .dff frames (body, doors, bonnet, bumpers,wheel_*_dummywheels, the author's variants); for game cars only parts changed by script. On the server only parts changed by script.getChecks whether a named part of a vehicle model is visible. On the client it also takes this player's local settings into account.Vehicle Component Visible getReturns the vehicle's driver (the occupant of seat 0), orVehicle Controller falsewhen nobody is driving.getOn the server: the gear number stored withVehicle Current Gear setVehicleCurrentGear(0 by default). On the client: the current gear computed like the SA gearbox from speed and handling (0 = reverse/neutral, 1-5).getReturns how dirty the vehicle's body is (0 clean - 1 dirty).Vehicle Dirt Level getReturns the door opening degree set withVehicle Door Open Ratio setVehicleDoorOpenRatio(0 = shut, 1 = open).getReturns the state of one door of a vehicle (0 shut, 1 ajar, 2 shut and damaged, 3 ajar and damaged, 4 missing). Door numbering as inVehicle Door State setVehicleDoorState.getReturns the vehicle's engine: the one fitted withVehicle Engine setVehicleEngineor, when none was fitted, the factory engine calculated from game data (withfactory = true). The second value is wear 0..1. Works on both sides.getChecks whether the vehicle's engine is running (set withVehicle Engine State setVehicleEngineState; destroying the vehicle also turns the engine off).getReturns a model's factory engine. Power is calculated from the game's handling, and the other data (torque, displacement, cylinders, mass) are a realistic estimate, marked withVehicle Factory Engine estimated = true. It gives a reference point for tuning systems.getReturns a vehicle's full handling as the game uses it: factory values from handling.cfg, overridden by model settings (Vehicle Handling setModelHandling), and finally by this vehicle's changes (setVehicleHandling,setVehicleEngine). Works on both sides.getReturns only the handling fields changed for this particular vehicle (Vehicle Handling Overrides setVehicleHandlingandsetVehicleEngine), without factory values. Useful for saving a car's tuning in a database.getReturns the headlight colour (white 255, 255, 255 by default).Vehicle Head Light Color getNewReturns the vehicle health floor set by setVehicleHealthFloor (0 = no floor).Vehicle Health Floor getReturns the indicator state: 0 off, 1 left, 2 right, 3 hazard. Works on both sides.Vehicle Indicators getReturns the names of all twelve lamps accepted byVehicle Lamp Names setVehicleLampState, in the order of numbers 0-11 (fromfront_lefttoindicator_rear_right). Groups (front,all…) are not in the list.getReturns the state of a lamp or lamp group set withVehicle Lamp State setVehicleLampState:'auto','on'or'off'. When the lamps in a group differ, it returns'mixed'.getReturns the state of all twelve lamps of a vehicle as a table of name →Vehicle Lamp States 'auto'/'on'/'off'.getReturns whether a vehicle lamp is working (0) or broken (1). Numbering as inVehicle Light State setVehicleLightState.getReturns the number of passenger seats of a vehicle or model (not counting the driver): e.g. 1 for a two-seater, 3 for a saloon. The data comes from the game, so the server only knows it once a client reports it (usually after the model first appears for a player); before that it returnsVehicle Max Passengers false.getTurns a vehicle name into a model number, ignoring letter case and surrounding spaces, e.g.Vehicle Model From Name "infernus"→ 411. It also recognises the names of new models fromengineRequestModel. Ideal for commands like/v infernus.getReturns the numbers of all models of a kind, e.g. all boats or helicopters. Useful for picking a random vehicle of a specific type.Vehicle Models Of Type getReturns a model's wheel diameter set withVehicle Model Wheel Size setVehicleModelWheelSize. On the client without a group name it returns a{ front_axle, rear_axle }table.getReturns a vehicle's name based on its model, e.g.Vehicle Name "Infernus","Landstalker". For a new model fromengineRequestModelit returns the name given at registration or the base model's name. Works on both sides.getReturns a vehicle name for a model number, e.g. 411 →Vehicle Name From Model "Infernus", without creating a vehicle. For a number outside 400-611 that is not a new vehicle it returnsfalse.getReturns the number of nitro charges stored withVehicle Nitro Count setVehicleNitroCount(0 by default, -1 = unlimited).getReturns the nitro level stored withVehicle Nitro Level setVehicleNitroLevel(1 by default).getReturns the player or ped sitting in the given seat of a vehicle. Seat 0 is the driver, 1 the front passenger, 2 and 3 the rear seats.Vehicle Occupant getReturns everyone (players and peds) sitting in the vehicle as a table of seat number → occupant. Empty seats are not in the table, so loop over it withVehicle Occupants pairs, notipairs(seat 0 is not an array index).getReturns the forced light state: 0 no override, 1 off, 2 on.Vehicle Override Lights getReturns the vehicle's paintjob number: 0-2, or 3 when it has none. Works on both sides.Vehicle Paintjob getReturns the colour with the given number from the game's vehicle palette (0-127) and its name. The RGB values are exactly what the Definitive Edition draws, so they suit e.g. a colour preview in a paint shop.Vehicle Palette Color getReturns the damage level of a body part (0 intact - 3 badly damaged). Numbering as inVehicle Panel State setVehiclePanelState.getReturns a vehicle's performance in a player-friendly form: power in kW and HP, torque, mass, 0-100 km/h time and top speed. You can pass a vehicle (its engine and wear are used) or a model number, optionally with an engine to compare.Vehicle Performance getReturns the vehicle's licence plate text.Vehicle Plate Text getNewReturns the vehicle immunity table set by setVehicleProofs.Vehicle Proofs getChecks whether the vehicle's siren is switched on withVehicle Sirens On setVehicleSirensOn. Works on both sides.getReturns the tail light colour (255, 0, 0 by default).Vehicle Tail Light Color getReturns the kind of vehicle (English name):Vehicle Type Automobile,Bike,BMX,Quad,Monster Truck,Boat,Helicopter,Plane,Train,Trailer. Accepts a vehicle or a model number.getReturns the vehicle kind for a model number (likeVehicle Type From Model getVehicleType). A new model fromengineRequestModelhas its base model's type.getReturns the names of all vehicle kinds, sorted alphabetically.Vehicle Type Names getReturns the ID of the part fitted in the given tuning slot, or 0 when the slot is empty. Slot numbers 0-16 are described byVehicle Upgrade On Slot getVehicleUpgradeSlotName.getReturns the IDs of all tuning parts fitted to a vehicle. Works on both sides.Vehicle Upgrades getReturns the tuning slot number (0-16) a part belongs to.Vehicle Upgrade Slot getReturns the English name of a tuning slot, given a slot number or a part ID. Slots: 0 Hood, 1 Vent, 2 Spoiler, 3 Sideskirt, 4 Front Bullbars, 5 Rear Bullbars, 6 Headlights, 7 Roof, 8 Nitro, 9 Hydraulics, 10 Stereo, 11 Unknown, 12 Wheels, 13 Exhaust, 14 Front Bumper, 15 Rear Bumper, 16 Misc.Vehicle Upgrade Slot Name getReturns the names of all 17 tuning slots in number order (the first element = slot 0).Vehicle Upgrade Slot Names getReturns the vehicle's two appearance variants (255 = none). Works on both sides.Vehicle Variant getNewReturns the vehicle's wheel grip multiplier (the product of every resource's multiplier, 1 = normal).Vehicle Wheel Grip getReturns the state of a vehicle's four wheels in order: front left, rear left, front right, rear right (0 inflated, 1 flat, 2 fallen off).Vehicle Wheel States getNewReturns the vehicle's window darkness in percent (0 = normal windows) and, if a colour is set, also its r, g, b components.Vehicle Window Tint isChecks whether a number is a vehicle model: 400-611 from the game or a new vehicle registered withValid Vehicle Model engineRequestModel.isChecks whether a vehicle is a wreck, i.e. it was destroyed (Vehicle Blown blowVehicleor an explosion in the game) and has not been repaired or respawned yet. A wreck cannot be driven.isChecks whether the vehicle's doors are locked withVehicle Locked setVehicleLocked.isReturns whether nitro was switched on withVehicle Nitro Activated setVehicleNitroActivated.isReturns whether nitro is recharging.Vehicle Nitro Recharging isReturns whether the vehicle stands on its wheels on the ground.Vehicle On Ground isChecks whether the vehicle's "TAXI" light is on. Works on both sides.Vehicle Taxi Light On isReturns whether a wheel touches the ground.Vehicle Wheel On Ground removeRemoves a fitted tuning part from a vehicle. Removing nitro also clears the stored nitro charges.Vehicle Upgrade setSets a vehicle's paint colours as any RGB colours, visible to every player. A vehicle has up to four colours: 1 = main paint, 2 = second colour (stripes, roof, rims depending on the model), 3 and 4 = extra parts of some models. Pass only the first three numbers and the second colour will match the first. Colours not in the game palette are drawn exactly, without rounding to the palette.Vehicle Color setShows or hides a named part of a vehicle model. On the server the change applies to every player ; on the client it applies to the local player only and takes priority over the server's setting. It works on the frames of a model from a file (Vehicle Component Visible engineReplaceModel): the author's variants (spoiler_1,extra1…), doors, bonnet, bumpers. The client-sidegetVehicleComponentslists the names for a given vehicle.setTurns a vehicle's engine on or off for every player. With the engine off the vehicle does not drive even when the driver presses the throttle (it can only roll). By default the engine starts by itself when a driver gets in; afterVehicle Engine State setWorldSpecialPropertyEnabled("vehicle_engine_autostart", false)it does not, and an RP server can build its own ignition on a key or command.setChanges the driving parameters (handling) of one vehicle for every player: mass, top speed, acceleration, grip, brakes, steering, suspension and other handling.cfg fields. The game gets its own copy of the handling entry for this car, so other vehicles of the model do not change. You can pass one field with a value, a whole table of fields, orVehicle Handling nilto go back to the factory handling (includingsetModelHandling). Field names; the list:getHandlingFieldNames.setLocks or unlocks a vehicle's doors for every player. Players cannot get into a locked vehicle (the game will not start entering). People already inside can still get out normally.Vehicle Locked setChanges the wheel diameter of a vehicle model. On the client it changes the wheels of vehicles with a custom model (Vehicle Model Wheel Size engineReplaceModel) for this player; game cars' wheels stay as they are. On the server it only stores the value for scripts.setForces the state of a vehicle's lights for every player. In Trilogy Hub the game does not switch the lights on at dusk by itself, so the headlights only shine after setting 2. Single lamps (brake, reverse, indicators) are set withVehicle Override Lights setVehicleLampState.setChanges the vehicle's licence plate text, visible to every player. A plate holds at most 8 characters; longer text is cut. Use letters, digits and spaces, as the game's plate font has only those.Vehicle Plate Text
Server events 13
onAnother name forPlayer Enter Vehicle onPlayerVehicleEnter: a player got into a vehicle.onAnother name forPlayer Exit Vehicle onPlayerVehicleExit: a player got out of a vehicle.onA player got into a vehicle.Player Vehicle Enter onA player got out of a vehicle (by themselves, jacked or by a script).Player Vehicle Exit onA trailer was attached to a vehicle.Trailer Attach onA trailer was detached.Trailer Detach onA vehicle lost health (reported by its driver's or owner's game).Vehicle Damage onSomeone got into a vehicle (the version seen from the vehicle side).Vehicle Enter onSomeone got out of a vehicle (the version seen from the vehicle side).Vehicle Exit onA vehicle exploded.Vehicle Explode onA vehicle respawned (Vehicle Respawn respawnVehicleor automatically).onA player starts getting into a vehicle (walks to the door). You can stop them, e.g. at a locked faction car.Vehicle Start Enter onA player starts getting out (about 2 seconds beforeVehicle Start Exit onVehicleExit); when jacked,jackeris the one pulling them out. You can keep them in the car.
Client events 2
onA vehicle lost health in your game: from a crash, gunfire, an explosion, fire or a health change from a script. It covers every vehicle your game knows, including other players' cars. The game checks vehicle health 10 times per second and only while some script listens to this event; several quick hits in that time arrive as one loss.Client Vehicle Damage onA vehicle exploded (Client Vehicle Explode blowVehicleor an explosion reported by its owner). It arrives at the same moment for everyone, right beforeonClientExplosion.