Struct IPlayer
This type represents a pointer to an unmanaged open.mp IPlayer interface.
[OpenMpApi(new Type[] { typeof(IExtensible), typeof(IEntity) })]
public readonly struct IPlayer : IEquatable<IPlayer>, IPlayer.IManagedInterface, IExtensible.IManagedInterface, IEntity.IManagedInterface, IIDProvider.IManagedInterface, IUnmanagedInterface
- Implements
- Inherited Members
Constructors
IPlayer(nint)
Initializes a new instance of the IPlayer struct.
public IPlayer(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.
AllowTeleport(bool)
Allows or disallows the player to teleport by clicking the map.
public void AllowTeleport(bool allow)
Parameters
AllowWeapons(bool)
Allows or disallows the player to use weapons.
public void AllowWeapons(bool allow)
Parameters
ApplyAnimation(AnimationData, PlayerAnimationSyncType)
Applies an animation to the player.
public void ApplyAnimation(AnimationData animation, PlayerAnimationSyncType syncType)
Parameters
animationAnimationDataThe animation data to apply.
syncTypePlayerAnimationSyncTypeThe synchronization type for the animation.
AreWeaponsAllowed()
Checks if the player is allowed to use weapons.
public bool AreWeaponsAllowed()
Returns
AttachCameraToObject(IObject)
Attaches the player's camera to an object.
public void AttachCameraToObject(IObject obj)
Parameters
objIObjectThe object to attach the camera to.
AttachCameraToObject(IPlayerObject)
Attaches the player's camera to a player object.
[OpenMpApiOverload("_player")]
public void AttachCameraToObject(IPlayerObject obj)
Parameters
objIPlayerObjectThe player object to attach the camera to.
Ban(string)
Bans the player from the server.
public void Ban(string reason)
Parameters
reasonstringThe reason for banning the player.
BroadcastPacketToStreamed(SpanLite<byte>, int, bool)
Broadcasts a packet to the player's streamed peers.
public void BroadcastPacketToStreamed(SpanLite<byte> data, int channel, bool skipFrom = true)
Parameters
dataSpanLite<byte>The data to broadcast.
channelintThe channel to broadcast the packet on.
skipFromboolWhether to skip broadcasting to the player.
BroadcastRPCToStreamed(int, SpanLite<byte>, int, bool)
Broadcasts an RPC to the player's streamed peers.
public void BroadcastRPCToStreamed(int id, SpanLite<byte> data, int channel, bool skipFrom = false)
Parameters
idintThe RPC ID.
dataSpanLite<byte>The data to broadcast.
channelintThe channel to broadcast the RPC on.
skipFromboolWhether to skip broadcasting to the player.
BroadcastSyncPacket(SpanLite<byte>, int)
Broadcasts a sync packet to the player's streamed peers.
public void BroadcastSyncPacket(SpanLite<byte> data, int channel)
Parameters
ClearAnimations(PlayerAnimationSyncType)
Clears all animations for the player.
public void ClearAnimations(PlayerAnimationSyncType syncType)
Parameters
syncTypePlayerAnimationSyncTypeThe synchronization type for clearing animations.
ClearTasks(PlayerAnimationSyncType)
Clears all tasks for the player.
public void ClearTasks(PlayerAnimationSyncType syncType)
Parameters
syncTypePlayerAnimationSyncTypeThe synchronization type for clearing tasks.
CreateExplosion(Vector3, int, float)
Creates an explosion at a specific position for the player.
public void CreateExplosion(Vector3 vec, int type, float radius)
Parameters
vecVector3The position of the explosion.
typeintThe type of explosion.
radiusfloatThe radius of the explosion.
Equals(IPlayer)
public bool Equals(IPlayer other)
Parameters
otherIPlayer
Returns
Equals(object?)
public override bool Equals(object? other)
Parameters
otherobject
Returns
ForceClassSelection()
Forces the player to reselect their class.
public void ForceClassSelection()
GetAction()
Gets the player's special action.
public PlayerSpecialAction GetAction()
Returns
- PlayerSpecialAction
The player's current special action.
GetAimData()
Gets the player's aim data.
public ref PlayerAimData GetAimData()
Returns
- PlayerAimData
A reference to the player's aim data.
GetAnimationData()
Gets the player's current animation data.
public PlayerAnimationData GetAnimationData()
Returns
- PlayerAnimationData
The player's current animation data.
GetArmedWeapon()
Gets the player's currently armed weapon.
public int GetArmedWeapon()
Returns
- int
The weapon ID of the currently armed weapon.
GetArmedWeaponAmmo()
Gets the ammunition count for the player's currently armed weapon.
public int GetArmedWeaponAmmo()
Returns
- int
The ammunition count for the armed weapon.
GetArmour()
Gets the player's armor value.
public float GetArmour()
Returns
- float
The player's current armor value.
GetBulletData()
Gets the player's bullet data.
public ref PlayerBulletData GetBulletData()
Returns
- PlayerBulletData
A reference to the player's bullet data.
GetCameraLookAt()
Gets the direction the player's camera looks at.
public Vector3 GetCameraLookAt()
Returns
- Vector3
The position the camera is looking at.
GetCameraPosition()
Gets the player's camera position.
public Vector3 GetCameraPosition()
Returns
- Vector3
The player's camera position.
GetCameraTargetActor()
Gets the actor the camera is targeting.
public IActor GetCameraTargetActor()
Returns
- IActor
The actor the camera is targeting, or
nullif no actor is targeted.
GetCameraTargetObject()
Gets the object the camera is targeting.
public IObject GetCameraTargetObject()
Returns
- IObject
The object the camera is targeting, or
nullif no object is targeted.
GetCameraTargetPlayer()
Gets the player the camera is targeting.
public IPlayer GetCameraTargetPlayer()
Returns
- IPlayer
The player the camera is targeting, or
nullif no player is targeted.
GetCameraTargetVehicle()
Gets the vehicle the camera is targeting.
public IVehicle GetCameraTargetVehicle()
Returns
- IVehicle
The vehicle the camera is targeting, or
nullif no vehicle is targeted.
GetClientVersion()
Gets the player's client version.
public ClientVersion GetClientVersion()
Returns
- ClientVersion
The player's client version.
GetClientVersionName()
Gets the player's client version name.
public string GetClientVersionName()
Returns
- string
The player's client version name.
GetColour()
Gets the player's color.
public ref Colour GetColour()
Returns
- Colour
A reference to the player's color.
GetControllable()
Gets whether the player is controllable.
public bool GetControllable()
Returns
GetDefaultObjectsRemoved()
Gets the number of default objects removed for the player.
public int GetDefaultObjectsRemoved()
Returns
- int
The number of default objects removed.
GetDrunkLevel()
Gets the player's drunk level.
public int GetDrunkLevel()
Returns
- int
The player's drunk level.
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.
GetFightingStyle()
Gets the player's fighting style.
public PlayerFightingStyle GetFightingStyle()
Returns
- PlayerFightingStyle
The player's current fighting style.
Remarks
See https://open.mp/docs/scripting/resources/fightingstyles for more details.
GetGameText(int, out string?, out TimeSpan, out TimeSpan)
Gets the currently displayed game text for the player, if any.
public bool GetGameText(int style, out string? message, out TimeSpan time, out TimeSpan remaining)
Parameters
styleintThe style of the game text to retrieve.
messagestringThe message of the game text.
timeTimeSpanThe duration for which the text is displayed.
remainingTimeSpanThe remaining time for the text to be displayed.
Returns
GetGravity()
Gets the player's gravity.
public float GetGravity()
Returns
- float
The player's current gravity value.
GetHashCode()
public override int GetHashCode()
Returns
GetHealth()
Gets the player's health.
public float GetHealth()
Returns
- float
The player's current health.
GetID()
Gets the identifier of this unit.
public int GetID()
Returns
- int
The identifier of the unit.
GetInterior()
Gets the player's interior.
public uint GetInterior()
Returns
- uint
The player's current interior ID.
GetKeyData()
Gets the player's key data.
public ref PlayerKeyData GetKeyData()
Returns
- PlayerKeyData
A reference to the player's key data.
GetKickStatus()
Checks if the player is about to be kicked.
public bool GetKickStatus()
Returns
GetMoney()
Gets the player's current money.
public int GetMoney()
Returns
- int
The amount of money the player has.
GetName()
Gets the player's name.
public string GetName()
Returns
- string
The player's name.
GetNetworkData()
Gets the player's network data.
public BlittableStructRef<PeerNetworkData> GetNetworkData()
Returns
- BlittableStructRef<PeerNetworkData>
A reference to the player's network data.
GetOtherColour(IPlayer, out Colour)
Gets the color of another player as seen by this player.
public bool GetOtherColour(IPlayer other, out Colour colour)
Parameters
otherIPlayerThe other player.
colourColourWhen this method returns, contains the color of the other player.
Returns
GetPing()
Gets the player's ping.
public uint GetPing()
Returns
- uint
The player's ping in milliseconds.
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.
GetScore()
Gets the player's score.
public int GetScore()
Returns
- int
The player's current score.
GetSerial()
Gets the player's serial (GPCI).
public string GetSerial()
Returns
- string
The player's serial.
GetShopName()
Gets the player's shop name.
public string GetShopName()
Returns
- string
The name of the shop.
GetSkillLevels()
Gets the player's skill levels for all weapon types.
public ref SkillsArray GetSkillLevels()
Returns
- SkillsArray
A reference to the player's skill levels.
Remarks
See https://open.mp/docs/scripting/resources/weaponskills for more details.
GetSkin()
Gets the player's skin.
public int GetSkin()
Returns
- int
The skin ID of the player.
GetSpectateData()
Gets the player's spectate data.
public ref PlayerSpectateData GetSpectateData()
Returns
- PlayerSpectateData
A reference to the player's spectate data.
GetState()
Gets the current state of the player.
public PlayerState GetState()
Returns
- PlayerState
The player's current state.
GetSurfingData()
Gets the player's surfing data.
public PlayerSurfingData GetSurfingData()
Returns
- PlayerSurfingData
The player's current surfing data.
GetTargetActor()
Gets the actor the player is targeting.
public IActor GetTargetActor()
Returns
- IActor
The actor being targeted, or
nullif no actor is targeted.
GetTargetPlayer()
Gets the player the player is targeting.
public IPlayer GetTargetPlayer()
Returns
- IPlayer
The player being targeted, or
nullif no player is targeted.
GetTeam()
Gets the player's team.
public int GetTeam()
Returns
- int
The team ID of the player.
GetTime()
Gets the in-game time for the player.
public (int hour, int minutes) GetTime()
Returns
GetVelocity()
Gets the player's velocity.
public Vector3 GetVelocity()
Returns
- Vector3
The player's current velocity.
GetVirtualWorld()
Gets the virtual world of this entity.
public int GetVirtualWorld()
Returns
- int
The virtual world of this entity.
GetWantedLevel()
Gets the player's wanted level.
public uint GetWantedLevel()
Returns
- uint
The player's wanted level.
GetWeaponSlot(int)
Gets the weapon data for a specific weapon slot.
public WeaponSlotData GetWeaponSlot(int slot)
Parameters
slotintThe weapon slot index.
Returns
- WeaponSlotData
The weapon slot data.
GetWeapons()
Gets all weapons and their associated data for the player.
public BlittableStructRef<WeaponSlots> GetWeapons()
Returns
- BlittableStructRef<WeaponSlots>
A reference to the player's weapon slots.
GetWeather()
Gets the player's current weather.
public int GetWeather()
Returns
- int
The weather ID of the player.
GetWorldBounds()
Gets the player's world bounds.
public Vector4 GetWorldBounds()
Returns
- Vector4
The coordinates defining the player's world bounds.
GiveMoney(int)
Gives the player additional money.
public void GiveMoney(int money)
Parameters
moneyintThe amount of money to give.
GiveWeapon(WeaponSlotData)
Gives a weapon to the player.
public void GiveWeapon(WeaponSlotData weapon)
Parameters
weaponWeaponSlotDataThe weapon to give.
HasCameraTargeting()
Checks if camera targeting is enabled for the player.
public bool HasCameraTargeting()
Returns
HasClock()
Checks if the in-game clock is enabled for the player.
public bool HasClock()
Returns
HasGameText(int)
Checks if game text is currently displayed for the player.
public bool HasGameText(int style)
Parameters
styleintThe style of the game text to check.
Returns
HasWidescreen()
Checks if widescreen mode is enabled for the player.
public bool HasWidescreen()
Returns
HideGameText(int)
Hides game text for the player.
public void HideGameText(int style)
Parameters
styleintThe style of the game text to hide.
InterpolateCameraLookAt(Vector3, Vector3, int, PlayerCameraCutType)
Interpolates the player's camera look-at position.
public void InterpolateCameraLookAt(Vector3 from, Vector3 to, int time, PlayerCameraCutType cutType)
Parameters
fromVector3The starting position.
toVector3The ending position.
timeintThe duration of the interpolation in milliseconds.
cutTypePlayerCameraCutTypeThe type of camera cut.
InterpolateCameraPosition(Vector3, Vector3, int, PlayerCameraCutType)
Interpolates the player's camera position.
public void InterpolateCameraPosition(Vector3 from, Vector3 to, int time, PlayerCameraCutType cutType)
Parameters
fromVector3The starting position.
toVector3The ending position.
timeintThe duration of the interpolation in milliseconds.
cutTypePlayerCameraCutTypeThe type of camera cut.
IsBot()
Checks if the player is a bot (NPC).
public bool IsBot()
Returns
IsGhostModeEnabled()
Checks if ghost mode is enabled for the player.
public bool IsGhostModeEnabled()
Returns
IsStreamedInForPlayer(IPlayer)
Checks if another player is streamed in for this player.
public bool IsStreamedInForPlayer(IPlayer other)
Parameters
otherIPlayerThe player to check.
Returns
IsTeleportAllowed()
Checks if the player is allowed to teleport by clicking the map.
public bool IsTeleportAllowed()
Returns
IsUsingOfficialClient()
Checks if the player is using an official client.
public bool IsUsingOfficialClient()
Returns
Kick()
Kicks the player from the server.
public void Kick()
LastPlayedAudio()
Gets the URL of the last played audio stream.
public string LastPlayedAudio()
Returns
- string
The URL of the last played audio stream.
LastPlayedSound()
Gets the ID of the last sound played for the player.
public int LastPlayedSound()
Returns
- int
The ID of the last played sound.
PlayAudio(string, bool, Vector3, float)
Plays an audio stream for the player.
public void PlayAudio(string url, bool usePos = false, Vector3 pos = default, float distance = 0)
Parameters
urlstringThe URL of the audio stream.
usePosbooltrue to play the audio at a specific position; otherwise, false.
posVector3The position where the audio should be played.
distancefloatThe maximum distance at which the audio can be heard.
PlaySound(int, Vector3)
Plays a sound for the player at a specific position.
public void PlaySound(int sound, Vector3 pos)
Parameters
PlayerCrimeReport(IPlayer, int)
Plays a crime report for the player with the specified suspect and crime.
public bool PlayerCrimeReport(IPlayer suspect, int crime)
Parameters
Returns
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.
RemoveDefaultObjects(uint, Vector3, float)
Removes default objects near a specific position for the player.
public void RemoveDefaultObjects(uint model, Vector3 pos, float radius)
Parameters
modeluintThe model ID of the objects to remove.
posVector3The position near which to remove objects.
radiusfloatThe radius within which to remove objects.
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.
RemoveFromVehicle(bool)
Removes the player from their vehicle.
public void RemoveFromVehicle(bool force)
Parameters
RemoveWeapon(byte)
Removes a weapon from the player.
public void RemoveWeapon(byte weapon)
Parameters
weaponbyteThe weapon to remove.
ResetMoney()
Resets the player's money to zero.
public void ResetMoney()
ResetWeapons()
Resets all weapons for the player.
public void ResetWeapons()
SendChatMessage(IPlayer, string)
Sends a chat message to the player.
public void SendChatMessage(IPlayer sender, string message)
Parameters
SendClientCheck(int, int, int, int)
Sends a client check request to the player.
public void SendClientCheck(int actionType, int address, int offset, int count)
Parameters
actionTypeintThe type of action to check.
addressintThe memory address to check.
offsetintThe offset to check.
countintThe number of bytes to check.
SendClientMessage(ref Colour, string)
Sends a client message to the player.
public void SendClientMessage(ref Colour colour, string message)
Parameters
SendCommand(string)
Sends a command to the player.
public void SendCommand(string message)
Parameters
messagestringThe command message to send.
SendDeathMessage(IPlayer, IPlayer, int)
Sends a death message to the player.
public void SendDeathMessage(IPlayer player, IPlayer killer, int weapon)
Parameters
playerIPlayerThe player who died.
killerIPlayerThe player who killed the other player.
weaponintThe weapon ID used to kill the player.
SendEmptyDeathMessage()
Sends an empty death message to the player.
public void SendEmptyDeathMessage()
SendGameText(string, TimeSpan, int)
Sends game text to the player.
public void SendGameText(string message, TimeSpan time, int style)
Parameters
messagestringThe game text to display.
timeTimeSpanThe duration for which the text will be displayed.
styleintThe style of the game text.
SendPacket(SpanLite<byte>, int, bool)
Sends a packet to the player.
public bool SendPacket(SpanLite<byte> data, int channel, bool dispatchEvents = true)
Parameters
dataSpanLite<byte>The data to send.
channelintThe channel to send the packet on.
dispatchEventsboolWhether to dispatch events for the packet.
Returns
SendRPC(int, SpanLite<byte>, int, bool)
Sends an RPC to the player.
public bool SendRPC(int id, SpanLite<byte> data, int channel, bool dispatchEvents = true)
Parameters
idintThe RPC ID.
dataSpanLite<byte>The data to send.
channelintThe channel to send the RPC on.
dispatchEventsboolWhether to dispatch events for the RPC.
Returns
SetAction(PlayerSpecialAction)
Sets the player's special action.
public void SetAction(PlayerSpecialAction action)
Parameters
actionPlayerSpecialActionThe special action to set.
SetArmedWeapon(int)
Sets the player's currently armed weapon.
public void SetArmedWeapon(int weapon)
Parameters
weaponintThe weapon ID to set as armed.
SetArmour(float)
Sets the player's armor value.
public void SetArmour(float armour)
Parameters
armourfloatThe armor value to set.
SetCameraBehind()
Sets the camera to a position behind the player.
public void SetCameraBehind()
SetCameraLookAt(Vector3, int)
Sets the direction the player's camera looks at.
public void SetCameraLookAt(Vector3 pos, int cutType)
Parameters
SetCameraPosition(Vector3)
Sets the player's camera position.
public void SetCameraPosition(Vector3 pos)
Parameters
posVector3The position to set the camera to.
SetChatBubble(string, ref Colour, float, TimeSpan)
Sets a chat bubble for the player.
public void SetChatBubble(string text, ref Colour colour, float drawDist, TimeSpan expire)
Parameters
textstringThe text to display in the chat bubble.
colourColourThe color of the chat bubble.
drawDistfloatThe draw distance for the chat bubble.
expireTimeSpanThe duration for which the chat bubble will be displayed.
SetColour(Colour)
Sets the player's color.
public void SetColour(Colour colour)
Parameters
colourColourThe color to set.
SetControllable(bool)
Sets whether the player is controllable.
public void SetControllable(bool controllable)
Parameters
SetDrunkLevel(int)
Sets the player's drunk level.
public void SetDrunkLevel(int level)
Parameters
levelintThe drunk level to set.
SetFightingStyle(PlayerFightingStyle)
Sets the player's fighting style.
public void SetFightingStyle(PlayerFightingStyle style)
Parameters
stylePlayerFightingStyleThe fighting style to set.
Remarks
See https://open.mp/docs/scripting/resources/fightingstyles for more details.
SetGravity(float)
Sets the player's gravity.
public void SetGravity(float gravity)
Parameters
gravityfloatThe gravity value to set.
SetHealth(float)
Sets the player's health.
public void SetHealth(float health)
Parameters
healthfloatThe health value to set.
SetInterior(uint)
Sets the player's interior.
public void SetInterior(uint interior)
Parameters
interioruintThe interior ID to set.
SetMapIcon(int, Vector3, int, Colour, MapIconStyle)
Sets a map icon for the player.
public void SetMapIcon(int id, Vector3 pos, int type, Colour colour, MapIconStyle style)
Parameters
idintThe ID of the map icon.
posVector3The position of the map icon.
typeintThe type of the map icon.
colourColourThe color of the map icon.
styleMapIconStyleThe style of the map icon.
SetMoney(int)
Sets the player's money.
public void SetMoney(int money)
Parameters
moneyintThe amount of money to set.
SetName(string)
Sets the player's name.
public EPlayerNameStatus SetName(string name)
Parameters
namestringThe new name for the player.
Returns
- EPlayerNameStatus
The status of the name change.
SetOtherColour(IPlayer, Colour)
Sets the color of another player as seen by this player.
public void SetOtherColour(IPlayer other, Colour colour)
Parameters
SetPosition(Vector3)
Sets the position of this entity.
public void SetPosition(Vector3 position)
Parameters
positionVector3The position to set.
SetPositionFindZ(Vector3)
Sets the player's position and finds the proper Z coordinate for the map.
public void SetPositionFindZ(Vector3 pos)
Parameters
posVector3The position to set.
SetRemoteVehicleCollisions(bool)
Sets whether the player should collide with remote vehicles.
public void SetRemoteVehicleCollisions(bool collide)
Parameters
SetRotation(GTAQuat)
Sets the rotation of this entity.
public void SetRotation(GTAQuat rotation)
Parameters
rotationGTAQuatThe rotation to set.
SetScore(int)
Sets the player's score.
public void SetScore(int score)
Parameters
scoreintThe score value to set.
SetShopName(string)
Sets the player's shop name.
public void SetShopName(string name)
Parameters
namestringThe name of the shop.
SetSkillLevel(PlayerWeaponSkill, int)
Sets the player's skill level for a specific weapon.
public void SetSkillLevel(PlayerWeaponSkill skill, int level)
Parameters
skillPlayerWeaponSkillThe weapon skill to set.
levelintThe skill level to set.
Remarks
See https://open.mp/docs/scripting/resources/weaponskills for more details.
SetSkin(int, bool)
Sets the player's skin.
public void SetSkin(int skin, bool send = true)
Parameters
SetSpectating(bool)
Sets whether the player is spectating.
public void SetSpectating(bool spectating)
Parameters
SetTeam(int)
Sets the player's team.
public void SetTeam(int team)
Parameters
teamintThe team ID to set.
SetTime(TimeSpan, TimeSpan)
Sets the in-game time for the player.
public void SetTime(TimeSpan hr, TimeSpan min)
Parameters
hrTimeSpanThe hour to set (0-23), truncated to whole hours on the native side.
minTimeSpanThe minute to set (0-59), truncated to whole minutes on the native side.
SetTransform(GTAQuat)
Sets the player's transformation matrix.
public void SetTransform(GTAQuat tm)
Parameters
tmGTAQuatThe transformation matrix to set.
SetVelocity(Vector3)
Sets the player's velocity.
public void SetVelocity(Vector3 velocity)
Parameters
velocityVector3The velocity to set.
SetVirtualWorld(int)
Sets the virtual world of this entity.
public void SetVirtualWorld(int vw)
Parameters
vwintThe virtual world to set.
SetWantedLevel(uint)
Sets the player's wanted level.
public void SetWantedLevel(uint level)
Parameters
leveluintThe wanted level to set.
SetWeaponAmmo(WeaponSlotData)
Sets the ammunition for a specific weapon slot.
public void SetWeaponAmmo(WeaponSlotData data)
Parameters
dataWeaponSlotDataThe weapon slot data containing the weapon and ammunition information.
SetWeather(int)
Sets the player's weather.
public void SetWeather(int weatherId)
Parameters
weatherIdintThe weather ID to set.
SetWorldBounds(Vector4)
Sets the player's world bounds.
public void SetWorldBounds(Vector4 coords)
Parameters
coordsVector4The coordinates defining the world bounds.
SetWorldTime(TimeSpan)
Sets the in-game world time for the player.
public void SetWorldTime(TimeSpan time)
Parameters
timeTimeSpanThe world time to set, truncated to whole hours on the native side.
Spawn()
Spawns the player.
public void Spawn()
SpectatePlayer(IPlayer, PlayerSpectateMode)
Makes the player spectate another player.
public void SpectatePlayer(IPlayer target, PlayerSpectateMode mode)
Parameters
targetIPlayerThe player to spectate.
modePlayerSpectateModeThe spectate mode.
SpectateVehicle(IVehicle, PlayerSpectateMode)
Makes the player spectate a vehicle.
public void SpectateVehicle(IVehicle target, PlayerSpectateMode mode)
Parameters
targetIVehicleThe vehicle to spectate.
modePlayerSpectateModeThe spectate mode.
StopAudio()
Stops the currently playing audio for the player.
public void StopAudio()
StreamInForPlayer(IPlayer)
Streams this player in for another player.
public void StreamInForPlayer(IPlayer other)
Parameters
otherIPlayerThe player for whom this player will be streamed in.
StreamOutForPlayer(IPlayer)
Streams another player out for this player.
public void StreamOutForPlayer(IPlayer other)
Parameters
otherIPlayerThe player to stream out.
StreamedForPlayers()
Gets the set of players for whom this player is currently streamed in.
public FlatPtrHashSet<IPlayer> StreamedForPlayers()
Returns
- FlatPtrHashSet<IPlayer>
A set of players for whom this player is streamed in.
ToggleGhostMode(bool)
Toggles ghost mode for the player.
public void ToggleGhostMode(bool toggle)
Parameters
ToggleOtherNameTag(IPlayer, bool)
Toggles the visibility of another player's name tag for this player.
public void ToggleOtherNameTag(IPlayer other, bool toggle)
Parameters
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.
UnsetMapIcon(int)
Removes a map icon for the player.
public void UnsetMapIcon(int id)
Parameters
idintThe ID of the map icon to remove.
UseCameraTargeting(bool)
Enables or disables camera targeting for the player.
public void UseCameraTargeting(bool enable)
Parameters
UseClock(bool)
Enables or disables the in-game clock for the player.
public void UseClock(bool enable)
Parameters
UseStuntBonuses(bool)
Enables or disables stunt bonuses for the player.
public void UseStuntBonuses(bool enable)
Parameters
UseWidescreen(bool)
Enables or disables widescreen mode for the player.
public void UseWidescreen(bool enable)
Parameters
Operators
operator ==(IPlayer, object?)
Determines whether the specified values are equal.
public static bool operator ==(IPlayer lhs, object? rhs)
Parameters
lhsIPlayerThe 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 IPlayer(IEntity)
public static explicit operator IPlayer(IEntity value)
Parameters
Returns
explicit operator IPlayer(IExtensible)
Casts the IExtensible to a IPlayer.
public static explicit operator IPlayer(IExtensible value)
Parameters
valueIExtensibleThe IExtensible to cast.
Returns
explicit operator IPlayer(IIDProvider)
Casts the IIDProvider to a IPlayer.
public static explicit operator IPlayer(IIDProvider value)
Parameters
valueIIDProviderThe IIDProvider to cast.
Returns
explicit operator IEntity(IPlayer)
public static explicit operator IEntity(IPlayer value)
Parameters
Returns
explicit operator IExtensible(IPlayer)
Casts the IPlayer to a IExtensible.
public static explicit operator IExtensible(IPlayer value)
Parameters
Returns
- IExtensible
The converted IExtensible.
explicit operator IIDProvider(IPlayer)
Casts the IPlayer to a IIDProvider.
public static explicit operator IIDProvider(IPlayer value)
Parameters
Returns
- IIDProvider
The converted IIDProvider.
operator !=(IPlayer, object?)
Determines whether the specified values are not equal.
public static bool operator !=(IPlayer lhs, object? rhs)
Parameters
lhsIPlayerThe 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.