Table of Contents

Struct IClassesComponent

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

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

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

Constructors

IClassesComponent(nint)

Initializes a new instance of the IClassesComponent struct.

public IClassesComponent(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<IClass> AsPool()

Returns

IPool<IClass>

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(int, int, Vector3, float, ref WeaponSlots)

Creates a new player class with the specified properties.

public IClass Create(int skin, int team, Vector3 spawn, float angle, ref WeaponSlots weapons)

Parameters

skin int

The skin model ID for the class.

team int

The team ID for the class.

spawn Vector3

The spawn position for the class.

angle float

The spawn angle (rotation) for the class.

weapons WeaponSlots

The weapons assigned to the class.

Returns

IClass

The newly created class object.

Equals(IClassesComponent)

public bool Equals(IClassesComponent other)

Parameters

other IClassesComponent

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 class-related events.

public IEventDispatcher<IClassEventHandler> GetEventDispatcher()

Returns

IEventDispatcher<IClassEventHandler>

The event dispatcher instance.

GetHashCode()

public override int GetHashCode()

Returns

int

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

Determines whether the specified values are equal.

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

Parameters

lhs IClassesComponent

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

Casts the IClassesComponent to a IComponent.

public static explicit operator IComponent(IClassesComponent value)

Parameters

value IClassesComponent

The IClassesComponent to cast.

Returns

IComponent

The converted IComponent.

explicit operator IPoolComponent<IClass>(IClassesComponent)

public static explicit operator IPoolComponent<IClass>(IClassesComponent value)

Parameters

value IClassesComponent

The IClassesComponent to cast.

Returns

IPoolComponent<IClass>

The converted IPoolComponent<T>.

explicit operator IClassesComponent(IComponent)

Casts the IComponent to a IClassesComponent.

public static explicit operator IClassesComponent(IComponent value)

Parameters

value IComponent

The IComponent to cast.

Returns

IClassesComponent

The converted IClassesComponent.

explicit operator IClassesComponent(IPoolComponent<IClass>)

public static explicit operator IClassesComponent(IPoolComponent<IClass> value)

Parameters

value IPoolComponent<IClass>

The IPoolComponent<T> to cast.

Returns

IClassesComponent

The converted IClassesComponent.

operator !=(IClassesComponent, object?)

Determines whether the specified values are not equal.

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

Parameters

lhs IClassesComponent

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.