Table of Contents

Struct IVehiclesComponent

Namespace
SampSharp.OpenMp.Core.Api
Assembly
SampSharp.OpenMp.Core.dll

This type represents a pointer to an unmanaged open.mp IVehiclesComponent interface.

[OpenMpApi(new Type[] { typeof(IPoolComponent<IVehicle>) })]
public readonly struct IVehiclesComponent : IEquatable<IVehiclesComponent>, IVehiclesComponent.IManagedInterface, IPoolComponent<IVehicle>.IManagedInterface, IComponent.IManagedInterface, IUnmanagedInterface
Implements
Inherited Members

Constructors

IVehiclesComponent(nint)

Initializes a new instance of the IVehiclesComponent struct.

public IVehiclesComponent(nint handle)

Parameters

handle nint

A pointer to the unmanaged interface.

Properties

Handle

Gets the handle to the unmanaged interface instance.

public nint Handle { get; }

Property Value

nint

HasValue

Gets a value indicating whether the pointer has a value.

public bool HasValue { get; }

Property Value

bool

Methods

AsPool()

Converts this component to a pool.

public IPool<IVehicle> AsPool()

Returns

IPool<IVehicle>

A pool.

ComponentName()

Gets the name of the component.

public string ComponentName()

Returns

string

The component name.

ComponentVersion()

Gets the version of the component.

public SemanticVersion ComponentVersion()

Returns

SemanticVersion

The component version.

Create(bool, int, Vector3, float, int, int, TimeSpan, bool)

Creates a new vehicle.

public IVehicle Create(bool isStatic, int modelID, Vector3 position, float Z = 0, int colour1 = -1, int colour2 = -1, TimeSpan respawnDelay = default, bool addSiren = false)

Parameters

isStatic bool

true if the vehicle is static; otherwise, false.

modelID int

The model ID of the vehicle.

position Vector3

The position where the vehicle will be created.

Z float

The Z angle (rotation) of the vehicle. Default is 0.0f.

colour1 int

The primary color of the vehicle. Default is -1.

colour2 int

The secondary color of the vehicle. Default is -1.

respawnDelay TimeSpan

The respawn delay of the vehicle. Use Zero or a negative value to disable respawn.

addSiren bool

true if the vehicle should have a siren; otherwise, false. Default is false.

Returns

IVehicle

The created vehicle.

Equals(IVehiclesComponent)

public bool Equals(IVehiclesComponent other)

Parameters

other IVehiclesComponent

Returns

bool

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetComponentType()

Gets the type of the component.

public ComponentType GetComponentType()

Returns

ComponentType

The component type.

GetEventDispatcher()

Gets the event dispatcher for vehicle events.

public IEventDispatcher<IVehicleEventHandler> GetEventDispatcher()

Returns

IEventDispatcher<IVehicleEventHandler>

The event dispatcher for vehicle events.

GetHashCode()

public override int GetHashCode()

Returns

int

Models()

Retrieves the array of vehicle models.

public ref VehicleModelsArray Models()

Returns

VehicleModelsArray

A reference to the array of vehicle models.

SupportedVersion()

Gets the supported version of the component.

public int SupportedVersion()

Returns

int

The supported version of the component.

Remarks

The idea is for the SDK to be totally forward compatible, so code built at any time will always work, thanks to ABI compatibility. This method is an emergency trap door, just in case that's ever not the problem. Check which major version this component was built for, if it isn't the current major version, fail to load it. Always just returns a constant, recompiling will often be enough to upgrade. virtual and final to be the vtable, but it can't be overridden because it is a constant.

Operators

operator ==(IVehiclesComponent, object?)

Determines whether the specified values are equal.

public static bool operator ==(IVehiclesComponent lhs, object? rhs)

Parameters

lhs IVehiclesComponent

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are equal; otherwise, false.

explicit operator IVehiclesComponent(IComponent)

public static explicit operator IVehiclesComponent(IComponent value)

Parameters

value IComponent

The IComponent to cast.

Returns

IVehiclesComponent

The converted IVehiclesComponent.

explicit operator IVehiclesComponent(IPoolComponent<IVehicle>)

public static explicit operator IVehiclesComponent(IPoolComponent<IVehicle> value)

Parameters

value IPoolComponent<IVehicle>

The IPoolComponent<T> to cast.

Returns

IVehiclesComponent

The converted IVehiclesComponent.

explicit operator IComponent(IVehiclesComponent)

public static explicit operator IComponent(IVehiclesComponent value)

Parameters

value IVehiclesComponent

The IVehiclesComponent to cast.

Returns

IComponent

The converted IComponent.

explicit operator IPoolComponent<IVehicle>(IVehiclesComponent)

public static explicit operator IPoolComponent<IVehicle>(IVehiclesComponent value)

Parameters

value IVehiclesComponent

The IVehiclesComponent to cast.

Returns

IPoolComponent<IVehicle>

The converted IPoolComponent<T>.

operator !=(IVehiclesComponent, object?)

Determines whether the specified values are not equal.

public static bool operator !=(IVehiclesComponent lhs, object? rhs)

Parameters

lhs IVehiclesComponent

The value on the left side of the operator.

rhs object

The value on the right side of the operator.

Returns

bool

true if the values are not equal; otherwise, false.

Explicit Interface Implementations

ComponentId

Gets the identifier of the component type.

static UID ComponentId { get; }

Returns

UID

FromComponentHandle(nint)

Casts a handle from a IComponent handle to a handle of this type.

static nint FromComponentHandle(nint handle)

Parameters

handle nint

The IComponent handle.

Returns

nint

The handle of this type.