Table of Contents

Struct ICustomModelsComponent

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

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

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

Constructors

ICustomModelsComponent(nint)

Initializes a new instance of the ICustomModelsComponent struct.

public ICustomModelsComponent(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

AddCustomModel(ModelType, int, int, string, string, int, byte, byte)

Adds a custom model to the server.

public bool AddCustomModel(ModelType type, int id, int baseId, string dffName, string txdName, int virtualWorld = -1, byte timeOn = 0, byte timeOff = 0)

Parameters

type ModelType

The type of model being added.

id int

The custom model ID to assign.

baseId int

The base model ID to replace.

dffName string

The name of the DFF file.

txdName string

The name of the TXD file.

virtualWorld int

The virtual world for the model (-1 for all).

timeOn byte

Time when the model is active (hour).

timeOff byte

Time when the model is inactive (hour).

Returns

bool

true if the model was added successfully; otherwise, false.

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.

Equals(ICustomModelsComponent)

public bool Equals(ICustomModelsComponent other)

Parameters

other ICustomModelsComponent

Returns

bool

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetBaseModel(ref uint, ref uint)

Gets the relationship between a base model and custom model.

public bool GetBaseModel(ref uint baseModelIdOrInput, ref uint customModel)

Parameters

baseModelIdOrInput uint

Input/output parameter for model IDs.

customModel uint

The custom model ID.

Returns

bool

true if the mapping exists; otherwise, false.

GetComponentType()

Gets the type of the component.

public ComponentType GetComponentType()

Returns

ComponentType

The component type.

GetCustomModelPath(int, out string?, out string?)

Gets the file paths for a custom model.

public bool GetCustomModelPath(int modelId, out string? dffPath, out string? txdPath)

Parameters

modelId int

The custom model ID.

dffPath string

When the method returns, contains the DFF file path.

txdPath string

When the method returns, contains the TXD file path.

Returns

bool

true if the paths were retrieved successfully; otherwise, false.

GetEventDispatcher()

Gets the event dispatcher for custom model events.

public IEventDispatcher<IPlayerModelsEventHandler> GetEventDispatcher()

Returns

IEventDispatcher<IPlayerModelsEventHandler>

The event dispatcher instance.

GetHashCode()

public override int GetHashCode()

Returns

int

GetModelNameFromChecksum(uint)

Gets the model name from its checksum.

public string? GetModelNameFromChecksum(uint checksum)

Parameters

checksum uint

The model checksum.

Returns

string

The model name, or null if not found.

IsValidCustomModel(int)

Checks whether a model ID is a valid custom model.

public bool IsValidCustomModel(int modelId)

Parameters

modelId int

The model ID to check.

Returns

bool

true if the model is a valid custom model; otherwise, false.

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 ==(ICustomModelsComponent, object?)

Determines whether the specified values are equal.

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

Parameters

lhs ICustomModelsComponent

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 ICustomModelsComponent(IComponent)

public static explicit operator ICustomModelsComponent(IComponent value)

Parameters

value IComponent

The IComponent to cast.

Returns

ICustomModelsComponent

The converted ICustomModelsComponent.

explicit operator IComponent(ICustomModelsComponent)

public static explicit operator IComponent(ICustomModelsComponent value)

Parameters

value ICustomModelsComponent

The ICustomModelsComponent to cast.

Returns

IComponent

The converted IComponent.

operator !=(ICustomModelsComponent, object?)

Determines whether the specified values are not equal.

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

Parameters

lhs ICustomModelsComponent

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.