Appearance and modifications
Set a shared vehicle’s appearance through the server API. Revo retains these settings across stream-out and ownership changes, and sends them to players who connect later. You can apply them immediately after creating the vehicle.
Configure a vehicle
Section titled “Configure a vehicle”This example gives a Sultan custom paint, a spoiler, engine and wheel upgrades, tinted windows and lighting:
// @ts-check/// <reference types="@revomp/types-server" />import * as revo from 'revo-server';
const vehicle = new revo.Vehicle( 'sultan', { x: -1220, y: -1765, z: 3.9 }, Math.PI / 2,);
vehicle.primaryColor = { r: 30, g: 90, b: 160 };vehicle.secondaryColor = 0;vehicle.numberPlate = 'REVO';
vehicle.modKit = 0;vehicle.setMod(revo.VehicleModType.Spoiler, 0);vehicle.setMod(revo.VehicleModType.Engine, 2);vehicle.setToggleMod(revo.VehicleToggleModType.Turbo, true);
vehicle.wheelType = revo.VehicleWheelType.Sport;vehicle.setMod(revo.VehicleModType.FrontWheels, 2, true);vehicle.windowTint = revo.VehicleWindowTint.DarkSmoke;
vehicle.setToggleMod(revo.VehicleToggleModType.Xenon, true);vehicle.xenonColor = 0;vehicle.neonColor = { r: 30, g: 90, b: 255 };vehicle.setNeonEnabled(revo.VehicleNeonSide.Left, true);vehicle.setNeonEnabled(revo.VehicleNeonSide.Right, true);
vehicle.setToggleMod(revo.VehicleToggleModType.TyreSmoke, true);vehicle.tyreSmokeColor = { r: 30, g: 90, b: 255 };Paint and plates
Section titled “Paint and plates”primaryColor and secondaryColor each accept a GTA color ID from 0 to 160,
or an RGB object with integer channels from 0 to 255. Assigning a color ID
clears the custom RGB color for that paint slot.
The getter returns the selected ID or an RGB object. To change an RGB value, assign the property again. Editing a field on the returned object has no effect.
numberPlate sets the plate text, with up to eight ASCII letters, digits or
spaces. Letters become uppercase. Assign '' to blank the plate.
Parts and mod kits
Section titled “Parts and mod kits”modKit selects a model’s modification kit and defaults to 0. Part indices
depend on the model, selected kit and mod type. The same index can refer to
different parts on different vehicles.
Use setMod(type, index) for parts such as spoilers, bumpers, engines and
suspension. VehicleModType provides the categories. Part indices start at 0,
with a supported API range of 0 to 254. Pass -1 to restore the stock part,
for example vehicle.setMod(revo.VehicleModType.Spoiler, -1).
Use setToggleMod(type, enabled) for on/off upgrades such as turbo, xenon lights
and tyre smoke. These categories come from VehicleToggleModType.
setMod() returns false for an invalid category, an out-of-range index or
invalid use of custom tyres. Wrong argument types throw an error. Use
model-specific options in a tuning menu, and validate submitted choices on the
server before applying them.
Wheels
Section titled “Wheels”Choose a VehicleWheelType through wheelType, then select a wheel with
VehicleModType.FrontWheels or VehicleModType.RearWheels, where supported by
the model. Wheel indices depend on the chosen family.
The optional third argument of setMod() enables custom tyres. true is only
accepted for an installed wheel mod. Omit it when restoring stock wheels with
index -1. getModVariation(type) reads this setting.
Extras
Section titled “Extras”Extras are optional model parts, addressed by IDs from 1 to 16.
Use vehicle.setExtra(1, true) to enable extra 1, or false to disable it.
Only extras present on the model have a visible effect.
getExtra(id) returns null until the server sets that extra. GTA uses the
model default in that state. After an assignment, it returns the stored boolean.
Lighting and tint
Section titled “Lighting and tint”| Setting | How to apply it |
|---|---|
| Window tint | Assign a VehicleWindowTint value to windowTint. |
| Xenon headlights | Enable VehicleToggleModType.Xenon, then set xenonColor to an index from 0 to 12, or -1 for the default color. |
| Neon | Assign neonColor as RGB, then enable each desired VehicleNeonSide with setNeonEnabled(side, true). |
| Tyre smoke | Enable VehicleToggleModType.TyreSmoke, then assign tyreSmokeColor as RGB. |
Neon and tyre smoke colors use integer channels from 0 to 255. Their getters
return null until a color is set. Assigning a color alone does not enable the
effect. These features also depend on support in the vehicle model.
To switch the headlights on, use vehicle.setLights(true). Pass a second true
argument for high beams. Setting a xenon color does not turn the headlights on.
Liveries
Section titled “Liveries”GTA exposes liveries through two separate systems. Use the one supported by the model:
vehicle.setLivery(index)selects a native livery. The API accepts0to255, and variations absent from the model are ignored. Read the server’s selected value throughvehicle.livery.vehicle.setMod(revo.VehicleModType.Livery, index)selects a livery from the mod kit. It follows the normal mod index rules, including-1for stock.
Local previews and available options
Section titled “Local previews and available options”For a LocalVehicle, apply customization through GTA natives after stream-in.
This example selects mod kit 0, checks whether a spoiler is available and applies
the first one:
// @ts-check/// <reference types="@revomp/types-client" />/// <reference types="@revomp/types-natives" />import * as revo from 'revo-client';import { getNumVehicleMods, setVehicleMod, setVehicleModKit } from 'natives';
const preview = new revo.LocalVehicle( 'sultan', { x: -1212, y: -1765, z: 3.9 }, Math.PI / 2,);
revo.on('entityStreamIn', (entity) => { if (entity !== preview) return;
const handle = preview.scriptId; const type = revo.VehicleModType.Spoiler; setVehicleModKit(handle, 0);
if (getNumVehicleMods(handle, type) > 0) { setVehicleMod(handle, type, 0, false); }});The handler repeats the setup when the local vehicle streams in again. See Streaming and readiness for work on an existing vehicle.
For a loaded vehicle, getNumVehicleMods() returns the number of parts in a
category for its current kit. Select the wheel family before querying wheel mods.
Use doesExtraExist() for extras and getVehicleLiveryCount() for native liveries.
These queries are available through the client natives module.
Native changes to a shared vehicle’s appearance are not stored by the server and can be replaced by synchronized state. Apply shared customization through the server API.