Struct IPlayerPickup
This type represents a pointer to an unmanaged open.mp IPlayerPickup interface.
[OpenMpApi(new Type[] { typeof(IBasePickup) })]
public readonly struct IPlayerPickup : IEquatable<IPlayerPickup>, IPlayerPickup.IManagedInterface, IBasePickup.IManagedInterface, IExtensible.IManagedInterface, IEntity.IManagedInterface, IIDProvider.IManagedInterface, IUnmanagedInterface
- Implements
- Inherited Members
Constructors
IPlayerPickup(nint)
Initializes a new instance of the IPlayerPickup struct.
public IPlayerPickup(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.
Equals(IPlayerPickup)
public bool Equals(IPlayerPickup other)
Parameters
otherIPlayerPickup
Returns
Equals(object?)
public override bool Equals(object? other)
Parameters
otherobject
Returns
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
GetID()
Gets the identifier of this unit.
public int GetID()
Returns
- int
The identifier of the unit.
GetLegacyPlayer()
Gets the legacy player associated with this pickup, used for ID mapping in per-player pickups.
public IPlayer GetLegacyPlayer()
Returns
- IPlayer
The associated legacy player, or
nullif not set.
GetModel()
Gets the model ID of the pickup.
public int GetModel()
Returns
- int
The model ID of the pickup.
GetPickupType()
Gets the type of the pickup.
public byte GetPickupType()
Returns
- byte
The type ID of the pickup.
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.
GetVirtualWorld()
Gets the virtual world of this entity.
public int GetVirtualWorld()
Returns
- int
The virtual world of this entity.
IsPickupHiddenForPlayer(IPlayer)
Checks if the pickup is hidden for the specified player.
public bool IsPickupHiddenForPlayer(IPlayer player)
Parameters
playerIPlayerThe player to check for.
Returns
- bool
trueif the pickup is hidden for the player; otherwise,false.
IsStreamedInForPlayer(IPlayer)
Checks if the pickup is streamed in for the specified player.
public bool IsStreamedInForPlayer(IPlayer player)
Parameters
playerIPlayerThe player to check for.
Returns
- bool
trueif the pickup 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.
SetLegacyPlayer(IPlayer)
Sets the legacy player for this pickup, used for ID mapping in per-player pickups.
public void SetLegacyPlayer(IPlayer player)
Parameters
playerIPlayerThe player to associate with this pickup, or
null.
SetModel(int, bool)
Sets the model ID of the pickup.
public void SetModel(int id, bool update)
Parameters
idintThe model ID to set.
updateboolWhether to update the pickup visually for all players; defaults to
true.
SetPickupHiddenForPlayer(IPlayer, bool)
Sets whether the pickup is hidden for the specified player.
public void SetPickupHiddenForPlayer(IPlayer player, bool hidden)
Parameters
playerIPlayerThe player to hide or show the pickup for.
hiddenbooltrueto hide the pickup;falseto show it.
SetPosition(Vector3)
Sets the position of this entity.
public void SetPosition(Vector3 position)
Parameters
positionVector3The position to set.
SetPositionNoUpdate(Vector3)
Sets the position of the pickup without updating the visual representation.
public void SetPositionNoUpdate(Vector3 position)
Parameters
positionVector3The new position for the pickup.
SetRotation(GTAQuat)
Sets the rotation of this entity.
public void SetRotation(GTAQuat rotation)
Parameters
rotationGTAQuatThe rotation to set.
SetType(byte, bool)
Sets the type of the pickup.
public void SetType(byte type, bool update)
Parameters
typebyteThe type ID of the pickup.
updateboolWhether to update the pickup visually for all players; defaults to
true.
SetVirtualWorld(int)
Sets the virtual world of this entity.
public void SetVirtualWorld(int vw)
Parameters
vwintThe virtual world to set.
StreamInForPlayer(IPlayer)
Streams the pickup in for the specified player.
public void StreamInForPlayer(IPlayer player)
Parameters
playerIPlayerThe player to stream the pickup in for.
StreamOutForPlayer(IPlayer)
Streams the pickup out for the specified player.
public void StreamOutForPlayer(IPlayer player)
Parameters
playerIPlayerThe player to stream the pickup out for.
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 ==(IPlayerPickup, object?)
Determines whether the specified values are equal.
public static bool operator ==(IPlayerPickup lhs, object? rhs)
Parameters
lhsIPlayerPickupThe 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 IPlayerPickup(IBasePickup)
Casts the IBasePickup to a IPlayerPickup.
public static explicit operator IPlayerPickup(IBasePickup value)
Parameters
valueIBasePickupThe IBasePickup to cast.
Returns
- IPlayerPickup
The converted IPlayerPickup.
explicit operator IPlayerPickup(IEntity)
Casts the IEntity to a IPlayerPickup.
public static explicit operator IPlayerPickup(IEntity value)
Parameters
Returns
- IPlayerPickup
The converted IPlayerPickup.
explicit operator IPlayerPickup(IExtensible)
Casts the IExtensible to a IPlayerPickup.
public static explicit operator IPlayerPickup(IExtensible value)
Parameters
valueIExtensibleThe IExtensible to cast.
Returns
- IPlayerPickup
The converted IPlayerPickup.
explicit operator IPlayerPickup(IIDProvider)
Casts the IIDProvider to a IPlayerPickup.
public static explicit operator IPlayerPickup(IIDProvider value)
Parameters
valueIIDProviderThe IIDProvider to cast.
Returns
- IPlayerPickup
The converted IPlayerPickup.
explicit operator IBasePickup(IPlayerPickup)
Casts the IPlayerPickup to a IBasePickup.
public static explicit operator IBasePickup(IPlayerPickup value)
Parameters
valueIPlayerPickupThe IPlayerPickup to cast.
Returns
- IBasePickup
The converted IBasePickup.
explicit operator IEntity(IPlayerPickup)
Casts the IPlayerPickup to a IEntity.
public static explicit operator IEntity(IPlayerPickup value)
Parameters
valueIPlayerPickupThe IPlayerPickup to cast.
Returns
explicit operator IExtensible(IPlayerPickup)
Casts the IPlayerPickup to a IExtensible.
public static explicit operator IExtensible(IPlayerPickup value)
Parameters
valueIPlayerPickupThe IPlayerPickup to cast.
Returns
- IExtensible
The converted IExtensible.
explicit operator IIDProvider(IPlayerPickup)
Casts the IPlayerPickup to a IIDProvider.
public static explicit operator IIDProvider(IPlayerPickup value)
Parameters
valueIPlayerPickupThe IPlayerPickup to cast.
Returns
- IIDProvider
The converted IIDProvider.
operator !=(IPlayerPickup, object?)
Determines whether the specified values are not equal.
public static bool operator !=(IPlayerPickup lhs, object? rhs)
Parameters
lhsIPlayerPickupThe 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.