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
This property is read-only.
The Rage.Vehicle instance to which this VehicleData record belongs.
public readonly Vehicle Holder;
- Type:
Rage.Vehicle
IsStolen
If the Holder vehicle no longer exists, it returns and sets the last cached stolen state.
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
This property is read-only.
Indicates whether this vehicle has any active VehicleBOLO entries associated with it.
public bool HasAnyBOLOs;
- See Also: GetAllBOLOs()
Owner
Gets the PedData record representing the owner of this vehicle.
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).
This property is read-only.
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;
- Type:
PedData - See Also: PedData class
OwnerType
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;
- Type:
EVehicleOwnerType - See Also: EVehicleOwnerType enumeration
Vin
This property is read-only.
Gets the VehicleIdentificationNumber (VIN) details for this vehicle.
public readonly VehicleIdentificationNumber Vin;
- Type:
VehicleIdentificationNumber - See Also: VehicleIdentificationNumber class
Registration
This property is read-only.
Gets the VehicleRegistration document for this vehicle.
public readonly VehicleRegistration Registration;
- Type:
VehicleRegistration - See Also: VehicleRegistration class
Insurance
This property is read-only.
Gets the VehicleInsurance document for this vehicle.
public readonly VehicleInsurance Insurance;
- Type:
VehicleInsurance - See Also: VehicleInsurance class
Methods
GetVehicleData(this Vehicle vehicle)
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.
- Type:
Returns
- Type:
CommonDataFramework.Modules.VehicleDatabase.VehicleData - Description: An instance of
VehicleDatacontaining the relevant information for the providedvehicle.
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();
- Returns: An array of
VehicleBOLOobjects. - See Also: VehicleBOLO class
AddBOLO(VehicleBOLO bolo)
Adds a new VehicleBOLO entry to this vehicle's record.
public void AddBOLO(VehicleBOLO bolo);
- Parameters:
bolo- Type:
VehicleBOLO - See Also: VehicleBOLO class
- Description: The BOLO entry to add.
- Type:
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.
- Type:
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.
- Type:
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
PedDatarecord representing the desired manual owner.
- Type:
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).
importantIn this case,
VehicleData.Ownerwill not have a validRage.Ped(i.e.,PedData.HasRealPedwill befalse).Manual- Description: The vehicle's owner (
PedData) has been explicitly set manually by code.
- Description: The vehicle's owner (
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.
This property is read-only.
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;
- Type:
EVinStatus - See Also: EVinStatus
Method
ToString()
Returns the 17-character VIN string representation of this object.
public override string ToString();
- Returns: The
Numberproperty 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.
This class is abstract.
public abstract class VehicleDocument;
Status
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;
- Type:
EDocumentStatus - See Also: EDocumentStatus enum
ExpirationDate
This can be null if the Status is EDocumentStatus.None.
Gets or sets the expiration date of the vehicle document.
public DateTime ExpirationDate;
- See Also: EDocumentStatus enum
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
All properties mentioned in VehicleDocument are available in VehicleRegistration and VehicleInsurance.