Skip to main content

Vehicle Data and Documents

This document provides comprehensive documentation for the VehicleData class and all its associated public types, including enums and vehicle document types such as VehicleIdentificationNumber, VehicleRegistration, and VehicleInsurance.


Vehicle Data

The VehicleData class represents a detailed record of a Rage.Vehicle within the Common Data Framework. It stores information about the vehicle's stolen status, owner, identification number, registration, insurance, and active BOLO (Be On the LookOut) entries.

public class VehicleData;

Holder

note

This property is read-only.

The Rage.Vehicle instance to which this VehicleData record belongs.

public readonly Vehicle Holder;
  • Type: Rage.Vehicle

IsStolen

note

If the Holder vehicle no longer exists, it returns and sets the last cached stolen state.

warning

Changing this property might also influence the Owner and OwnerType.

Gets or sets a value indicating whether the vehicle is currently stolen. This property mirrors Rage.Vehicle.IsStolen when the vehicle exists.

public bool IsStolen;

PrimaryColor

The vehicle's primary color

public readonly string PrimaryColor;

SecondaryColor

The vehicle's secondary color

public readonly string SecondaryColor;

PrimaryColorSpecific

The vehicle's primary color according to GTA

public readonly string PrimaryColorSpecific;

SecondaryColorSpecific

The vehicle's secondary color according to GTA

public readonly string SecondaryColorSpecific;

Make

The vehicle's make.

public readonly string Make;

Model

The vehicle's model

public readonly string Model;

HasAnyBOLOs

note

This property is read-only.

Indicates whether this vehicle has any active VehicleBOLO entries associated with it.

public bool HasAnyBOLOs;

Owner

Gets the PedData record representing the owner of this vehicle.

Important

Before accessing the PedData.Holder property of the Owner (e.g., Owner.Holder), ensure to check Owner.HasRealPed. This is crucial because the Owner PedData might not correspond to an actual in-game Rage.Ped (e.g., for government, stolen, or random ped owners).

note

This property is read-only.

tip

If you require a visual representation like a ped mugshot (e.g., for a computer plugin), it's recommended to generate one from a random ped in the world if HasRealPed is false for the Owner.

public PedData Owner;

OwnerType

note

This property is read-only.

Gets the EVehicleOwnerType of the vehicle's owner. This indicates how the owner was determined (e.g., Driver, Government, Random Ped).

public EVehicleOwnerType OwnerType;

Vin

note

This property is read-only.

Gets the VehicleIdentificationNumber (VIN) details for this vehicle.

public readonly VehicleIdentificationNumber Vin;

Registration

note

This property is read-only.

Gets the VehicleRegistration document for this vehicle.

public readonly VehicleRegistration Registration;

Insurance

note

This property is read-only.

Gets the VehicleInsurance document for this vehicle.

public readonly VehicleInsurance Insurance;

Methods

GetVehicleData(this Vehicle vehicle)

important

This method is under VehicleDataController.

This static extension method allows you to retrieve or initialize a VehicleData record for a specified Rage.Vehicle instance.

public static VehicleData GetVehicleData(this Vehicle vehicle)

Parameters

  • vehicle
    • Type: Rage.Vehicle
    • Description: The specific vehicle for which to retrieve or create the VehicleData.

Returns

  • Type: CommonDataFramework.Modules.VehicleDatabase.VehicleData
  • Description: An instance of VehicleData containing the relevant information for the provided vehicle.
warning

This method returns null if the provided vehicle does not currently exist in the game world and no previous VehicleData was stored for it.


GetAllBOLOs()

Returns an array of all active VehicleBOLO entries currently associated with this vehicle.

public VehicleBOLO[] GetAllBOLOs();

AddBOLO(VehicleBOLO bolo)

Adds a new VehicleBOLO entry to this vehicle's record.

public void AddBOLO(VehicleBOLO bolo);
  • Parameters:
    • bolo
warning

Parameter bool must not be null.


RemoveBOLO(VehicleBOLO bolo)

Removes an existing VehicleBOLO entry from this vehicle's record.

public void RemoveBOLO(VehicleBOLO bolo)
  • Parameters:
    • bolo
      • Type: VehicleBOLO
      • See Also: VehicleBOLO class
      • Description: The BOLO entry to remove.
warning

If the parameter bolo is null or the bolo entry doesn't exist, no action is performed.


TrySetOwner(EVehicleOwnerType ownerType)

Attempts to set the vehicle's owner based on a specified EVehicleOwnerType. This method will handle the logic for assigning an appropriate PedData instance based on the chosen type (e.g., finding the driver, a passenger, or generating a random ped).

public bool TrySetOwner(EVehicleOwnerType ownerType);
  • Parameters:
    • ownerType
      • Type: EVehicleOwnerType
      • See Also EVehicleOwnerType
      • Description: The desired type of owner to set for the vehicle.
warning

If the vehicle does not exist or the owner type is incompatible with the vehicle's current state, this method will return false.


TrySetOwner(PedData pedData)

Attempts to manually set the vehicle's owner to a specific PedData record. This will set the OwnerType to EVehicleOwnerType.Manual.

public bool TrySetOwner(PedData pedData);
  • Parameters:
    • pedData
      • Type: PedData
      • See Also: PedData Class
      • Description: The PedData record representing the desired manual owner.
warning

This method returns false if pedData is null.


EVehicleOwnerType Enum

Defines the different types of drivers that a vehicle can have within the Common Data Framework.

public enum EVehicleOwnerType
{
Driver,
Passenger,
FamilyMember,
RandomPed,
Government,
Manual
}

Definitions

  • Driver
    • Description: The current driver of the vehicle is considered its owner.
  • Passenger
    • Description: A passenger in the vehicle is considered its owner.
  • FamilyMember
    • Description: The driver is a family member of the owner. A passenger might also be a family member.
  • RandomPed
    • Description: The driver is a randomly generated pedestrian. This type is also used when the vehicle is marked as stolen.
  • Government
    • Description: The vehicle is owned by a government entity (e.g., emergency vehicles).
    important

    In this case, VehicleData.Owner will not have a valid Rage.Ped (i.e., PedData.HasRealPed will be false).

  • Manual
    • Description: The vehicle's owner (PedData) has been explicitly set manually by code.

EVinStatus Enum

Specifies the possible states for a vehicle's identification number (VIN).

public enum EVinStatus
{
Valid,
Scratched
}

Definitions

  • Valid
    • Description: The VIN is clear and legible.
  • Scratched
    • Description: The VIN has been tampered with or is unreadable.

Vehicle Identification Number

Represents the Vehicle Identification Number (VIN) of a Rage.Vehicle.

public class VehicleIdentificationNumber

Number

Gets the 17-character VIN string.

note

This property is read-only.

important

Before displaying the VIN, you might want to check its Status property, as it could be EVinStatus.Scratched if your application accounts for such scenarios.

public string Number;

Status

Gets or sets the current status of the VIN.

public EVinStatus Status;

Method

ToString()

Returns the 17-character VIN string representation of this object.

public override string ToString();
  • Returns: The Number property of the VIN.

Vehicle Documents

Provides a common base for all vehicle-related documents (like registration and insurance). It defines shared properties such as Status and ExpirationDate.

warning

This class is abstract.

public abstract class VehicleDocument;

Status

note

Changing this value will automatically update the ExpirationDate based on the new status.

Gets or sets the status of the vehicle document.

public EDocumentStatus Status;

ExpirationDate

warning

This can be null if the Status is EDocumentStatus.None.

Gets or sets the expiration date of the vehicle document.

public DateTime ExpirationDate;

Vehicle Registration

Represents the registration document of a Rage.Vehicle. It inherits from VehicleDocument.

public class VehicleRegistration : VehicleDocument;

Vehicle Insurance

Represents the insurance document of a Rage.Vehicle. It inherits from VehicleDocument.

public class VehicleInsurance : VehicleDocument

note

All properties mentioned in VehicleDocument are available in VehicleRegistration and VehicleInsurance.