Struct IActor
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
handlenintA pointer to the unmanaged interface.
Properties
Handle
Gets the handle to the unmanaged interface instance.
public nint Handle { get; }
Property Value
HasValue
Gets a value indicating whether the pointer has a value.
public bool HasValue { get; }
Property Value
Methods
AddExtension<T>(T)
Adds the specified managed extension to this extensible.
public void AddExtension<T>(T extension) where T : Extension
Parameters
extensionTAn instance of the extension to add. The extension will be disposed if the extension could not be added to this extensible.
Type Parameters
TThe 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
animationAnimationDataThe 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
otherIActor
Returns
Equals(object?)
public override bool Equals(object? other)
Parameters
otherobject
Returns
GetAnimation()
Gets the animation currently applied to the actor.
public AnimationData? GetAnimation()
Returns
- AnimationData
The animation data currently applied to the actor, or
nullif no animation is applied.
GetExtension(UID)
Gets the extension with the specified id.
public IExtension GetExtension(UID id)
Parameters
idUIDThe 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
TThe type of the managed extension.
Exceptions
- ArgumentException
Thrown if the extension could not be found.
GetHashCode()
public override int GetHashCode()
Returns
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
trueif 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
playerIPlayerThe player to check streaming status for.
Returns
- bool
trueif 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
TThe type of the unmanaged extension.
RemoveExtension(IExtension)
Removes the specified extension from this extensible.
public void RemoveExtension(IExtension extension)
Parameters
extensionIExtensionThe 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
idUIDThe 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
extensionTThe managed extension to remove.
Type Parameters
TThe 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
healthfloatThe health value to set for the actor.
SetInvulnerable(bool)
Sets whether the actor is invulnerable.
public void SetInvulnerable(bool invuln)
Parameters
invulnbooltrueto make the actor invulnerable; otherwise,false.
SetPosition(Vector3)
Sets the position of this entity.
public void SetPosition(Vector3 position)
Parameters
positionVector3The position to set.
SetRotation(GTAQuat)
Sets the rotation of this entity.
public void SetRotation(GTAQuat rotation)
Parameters
rotationGTAQuatThe rotation to set.
SetSkin(int)
Sets the actor's skin.
public void SetSkin(int id)
Parameters
idintThe ID of the skin to set.
SetVirtualWorld(int)
Sets the virtual world of this entity.
public void SetVirtualWorld(int vw)
Parameters
vwintThe virtual world to set.
StreamInForPlayer(IPlayer)
Streams the actor in for a specific player.
public void StreamInForPlayer(IPlayer player)
Parameters
playerIPlayerThe 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
playerIPlayerThe 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
Tor null if no extension with the specified type could be found.
Type Parameters
TThe 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
extensionTThe extension if found, otherwise null.
Returns
Type Parameters
TThe 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
lhsIActorThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are equal; otherwise,false.
explicit operator IEntity(IActor)
public static explicit operator IEntity(IActor value)
Parameters
Returns
explicit operator IExtensible(IActor)
Casts the IActor to a IExtensible.
public static explicit operator IExtensible(IActor value)
Parameters
Returns
- IExtensible
The converted IExtensible.
explicit operator IIDProvider(IActor)
Casts the IActor to a IIDProvider.
public static explicit operator IIDProvider(IActor value)
Parameters
Returns
- IIDProvider
The converted IIDProvider.
explicit operator IActor(IEntity)
public static explicit operator IActor(IEntity value)
Parameters
Returns
explicit operator IActor(IExtensible)
Casts the IExtensible to a IActor.
public static explicit operator IActor(IExtensible value)
Parameters
valueIExtensibleThe IExtensible to cast.
Returns
explicit operator IActor(IIDProvider)
Casts the IIDProvider to a IActor.
public static explicit operator IActor(IIDProvider value)
Parameters
valueIIDProviderThe IIDProvider to cast.
Returns
operator !=(IActor, object?)
Determines whether the specified values are not equal.
public static bool operator !=(IActor lhs, object? rhs)
Parameters
lhsIActorThe value on the left side of the operator.
rhsobjectThe value on the right side of the operator.
Returns
- bool
trueif the values are not equal; otherwise,false.