Table of Contents

Struct IActor

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

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

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

Constructors

IActor(nint)

Initializes a new instance of the IActor struct.

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

AddExtension<T>(T)

Adds the specified managed extension to this extensible.

public void AddExtension<T>(T extension) where T : Extension

Parameters

extension T

An instance of the extension to add. The extension will be disposed if the extension could not be added to this extensible.

Type Parameters

T

The type of the managed extension.

Remarks

A managed extension can only be added to one extensible.

Exceptions

ArgumentException

Throw when an instance of the extension type was already added to this extensible.

ApplyAnimation(AnimationData)

Applies an animation to the actor.

public void ApplyAnimation(AnimationData animation)

Parameters

animation AnimationData

The animation data to apply to the actor.

ClearAnimations()

Clears all animations applied to the actor.

public void ClearAnimations()

Equals(IActor)

public bool Equals(IActor other)

Parameters

other IActor

Returns

bool

Equals(object?)

public override bool Equals(object? other)

Parameters

other object

Returns

bool

GetAnimation()

Gets the animation currently applied to the actor.

public AnimationData? GetAnimation()

Returns

AnimationData

The animation data currently applied to the actor, or null if no animation is applied.

GetExtension(UID)

Gets the extension with the specified id.

public IExtension GetExtension(UID id)

Parameters

id UID

The identifier of the extension type.

Returns

IExtension

The extension or null if the extension could not be found.

GetExtension<T>()

Gets the specified managed extension from this extensible.

public T GetExtension<T>() where T : Extension

Returns

T

An instance of the extension with type T.

Type Parameters

T

The type of the managed extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

GetHashCode()

public override int GetHashCode()

Returns

int

GetHealth()

Gets the actor's current health.

public float GetHealth()

Returns

float

The current health of the actor.

GetID()

Gets the identifier of this unit.

public int GetID()

Returns

int

The identifier of the unit.

GetPosition()

Gets the position of this entity.

public Vector3 GetPosition()

Returns

Vector3

The position of this entity.

GetRotation()

Gets the rotation of this entity.

public GTAQuat GetRotation()

Returns

GTAQuat

The rotation of this entity.

GetSkin()

Gets the actor's skin ID.

public int GetSkin()

Returns

int

The ID of the actor's skin.

GetSpawnData()

Gets the spawn data of the actor.

public ref ActorSpawnData GetSpawnData()

Returns

ActorSpawnData

The spawn data of the actor, including position, facing angle, and skin.

GetVirtualWorld()

Gets the virtual world of this entity.

public int GetVirtualWorld()

Returns

int

The virtual world of this entity.

IsInvulnerable()

Checks whether the actor is invulnerable.

public bool IsInvulnerable()

Returns

bool

true if the actor is invulnerable; otherwise, false.

IsStreamedInForPlayer(IPlayer)

Checks if the actor is streamed in for a specific player.

public bool IsStreamedInForPlayer(IPlayer player)

Parameters

player IPlayer

The player to check streaming status for.

Returns

bool

true if the actor is streamed in for the player; otherwise, false.

QueryExtension<T>()

Gets the specified unmanaged extension from this extensible.

public T QueryExtension<T>() where T : unmanaged, IExtension.IManagedInterface

Returns

T

The unmanaged extension or null if the extension could not be found.

Type Parameters

T

The type of the unmanaged extension.

RemoveExtension(IExtension)

Removes the specified extension from this extensible.

public void RemoveExtension(IExtension extension)

Parameters

extension IExtension

The extension to remove.

Exceptions

ArgumentException

Thrown if the extension could not be found.

RemoveExtension(UID)

Removes the extension with the specified id from this extensible.

public void RemoveExtension(UID id)

Parameters

id UID

The identifier of the extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

RemoveExtension<T>(T)

Removes the specified managed extension from this extensible.

public void RemoveExtension<T>(T extension) where T : Extension

Parameters

extension T

The managed extension to remove.

Type Parameters

T

The type of the managed extension.

Exceptions

ArgumentException

Thrown if the extension could not be found.

SetHealth(float)

Sets the actor's health.

public void SetHealth(float health)

Parameters

health float

The health value to set for the actor.

SetInvulnerable(bool)

Sets whether the actor is invulnerable.

public void SetInvulnerable(bool invuln)

Parameters

invuln bool

true to make the actor invulnerable; otherwise, false.

SetPosition(Vector3)

Sets the position of this entity.

public void SetPosition(Vector3 position)

Parameters

position Vector3

The position to set.

SetRotation(GTAQuat)

Sets the rotation of this entity.

public void SetRotation(GTAQuat rotation)

Parameters

rotation GTAQuat

The rotation to set.

SetSkin(int)

Sets the actor's skin.

public void SetSkin(int id)

Parameters

id int

The ID of the skin to set.

SetVirtualWorld(int)

Sets the virtual world of this entity.

public void SetVirtualWorld(int vw)

Parameters

vw int

The virtual world to set.

StreamInForPlayer(IPlayer)

Streams the actor in for a specific player.

public void StreamInForPlayer(IPlayer player)

Parameters

player IPlayer

The player for whom the actor should be streamed in.

StreamOutForPlayer(IPlayer)

Streams the actor out for a specific player.

public void StreamOutForPlayer(IPlayer player)

Parameters

player IPlayer

The player for whom the actor should be streamed out.

TryGetExtension<T>()

Tries to get the specified managed extension from this extensible.

public T? TryGetExtension<T>() where T : Extension

Returns

T

An instance of the extension with type T or null if no extension with the specified type could be found.

Type Parameters

T

The type of the managed extension.

TryQueryExtension<T>(out T)

Tries to get the specified unmanaged extension from this extensible.

public bool TryQueryExtension<T>(out T extension) where T : unmanaged, IExtension.IManagedInterface

Parameters

extension T

The extension if found, otherwise null.

Returns

bool

true if the extension was found; false otherwise.

Type Parameters

T

The type of the unmanaged extension.

Operators

operator ==(IActor, object?)

Determines whether the specified values are equal.

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

Parameters

lhs IActor

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 IEntity(IActor)

Casts the IActor to a IEntity.

public static explicit operator IEntity(IActor value)

Parameters

value IActor

The IActor to cast.

Returns

IEntity

The converted IEntity.

explicit operator IExtensible(IActor)

Casts the IActor to a IExtensible.

public static explicit operator IExtensible(IActor value)

Parameters

value IActor

The IActor to cast.

Returns

IExtensible

The converted IExtensible.

explicit operator IIDProvider(IActor)

Casts the IActor to a IIDProvider.

public static explicit operator IIDProvider(IActor value)

Parameters

value IActor

The IActor to cast.

Returns

IIDProvider

The converted IIDProvider.

explicit operator IActor(IEntity)

Casts the IEntity to a IActor.

public static explicit operator IActor(IEntity value)

Parameters

value IEntity

The IEntity to cast.

Returns

IActor

The converted IActor.

explicit operator IActor(IExtensible)

Casts the IExtensible to a IActor.

public static explicit operator IActor(IExtensible value)

Parameters

value IExtensible

The IExtensible to cast.

Returns

IActor

The converted IActor.

explicit operator IActor(IIDProvider)

Casts the IIDProvider to a IActor.

public static explicit operator IActor(IIDProvider value)

Parameters

value IIDProvider

The IIDProvider to cast.

Returns

IActor

The converted IActor.

operator !=(IActor, object?)

Determines whether the specified values are not equal.

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

Parameters

lhs IActor

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.