Interface IPlayer.IManagedInterface
Represents the managed interface implemented by its unmanaged counterpart.
public interface IPlayer.IManagedInterface : IUnmanagedInterface
- Inherited Members
Methods
AllowTeleport(bool)
Allows or disallows the player to teleport by clicking the map.
void AllowTeleport(bool allow)
Parameters
AllowWeapons(bool)
Allows or disallows the player to use weapons.
void AllowWeapons(bool allow)
Parameters
ApplyAnimation(AnimationData, PlayerAnimationSyncType)
Applies an animation to the player.
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.
bool AreWeaponsAllowed()
Returns
AttachCameraToObject(IObject)
Attaches the player's camera to an object.
void AttachCameraToObject(IObject obj)
Parameters
objIObjectThe object to attach the camera to.
AttachCameraToObject(IPlayerObject)
Attaches the player's camera to a player object.
void AttachCameraToObject(IPlayerObject obj)
Parameters
objIPlayerObjectThe player object to attach the camera to.
Ban(string)
Bans the player from the server.
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.
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.
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.
void BroadcastSyncPacket(SpanLite<byte> data, int channel)
Parameters
ClearAnimations(PlayerAnimationSyncType)
Clears all animations for the player.
void ClearAnimations(PlayerAnimationSyncType syncType)
Parameters
syncTypePlayerAnimationSyncTypeThe synchronization type for clearing animations.
ClearTasks(PlayerAnimationSyncType)
Clears all tasks for the player.
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.
void CreateExplosion(Vector3 vec, int type, float radius)
Parameters
vecVector3The position of the explosion.
typeintThe type of explosion.
radiusfloatThe radius of the explosion.
ForceClassSelection()
Forces the player to reselect their class.
void ForceClassSelection()
GetAction()
Gets the player's special action.
PlayerSpecialAction GetAction()
Returns
- PlayerSpecialAction
The player's current special action.
GetAimData()
Gets the player's aim data.
ref PlayerAimData GetAimData()
Returns
- PlayerAimData
A reference to the player's aim data.
GetAnimationData()
Gets the player's current animation data.
PlayerAnimationData GetAnimationData()
Returns
- PlayerAnimationData
The player's current animation data.
GetArmedWeapon()
Gets the player's currently armed weapon.
int GetArmedWeapon()
Returns
- int
The weapon ID of the currently armed weapon.
GetArmedWeaponAmmo()
Gets the ammunition count for the player's currently armed weapon.
int GetArmedWeaponAmmo()
Returns
- int
The ammunition count for the armed weapon.
GetArmour()
Gets the player's armor value.
float GetArmour()
Returns
- float
The player's current armor value.
GetBulletData()
Gets the player's bullet data.
ref PlayerBulletData GetBulletData()
Returns
- PlayerBulletData
A reference to the player's bullet data.
GetCameraLookAt()
Gets the direction the player's camera looks at.
Vector3 GetCameraLookAt()
Returns
- Vector3
The position the camera is looking at.
GetCameraPosition()
Gets the player's camera position.
Vector3 GetCameraPosition()
Returns
- Vector3
The player's camera position.
GetCameraTargetActor()
Gets the actor the camera is targeting.
IActor GetCameraTargetActor()
Returns
- IActor
The actor the camera is targeting, or
nullif no actor is targeted.
GetCameraTargetObject()
Gets the object the camera is targeting.
IObject GetCameraTargetObject()
Returns
- IObject
The object the camera is targeting, or
nullif no object is targeted.
GetCameraTargetPlayer()
Gets the player the camera is targeting.
IPlayer GetCameraTargetPlayer()
Returns
- IPlayer
The player the camera is targeting, or
nullif no player is targeted.
GetCameraTargetVehicle()
Gets the vehicle the camera is targeting.
IVehicle GetCameraTargetVehicle()
Returns
- IVehicle
The vehicle the camera is targeting, or
nullif no vehicle is targeted.
GetClientVersion()
Gets the player's client version.
ClientVersion GetClientVersion()
Returns
- ClientVersion
The player's client version.
GetClientVersionName()
Gets the player's client version name.
string GetClientVersionName()
Returns
- string
The player's client version name.
GetColour()
Gets the player's color.
ref Colour GetColour()
Returns
- Colour
A reference to the player's color.
GetControllable()
Gets whether the player is controllable.
bool GetControllable()
Returns
GetDefaultObjectsRemoved()
Gets the number of default objects removed for the player.
int GetDefaultObjectsRemoved()
Returns
- int
The number of default objects removed.
GetDrunkLevel()
Gets the player's drunk level.
int GetDrunkLevel()
Returns
- int
The player's drunk level.
GetFightingStyle()
Gets the player's fighting style.
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.
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.
float GetGravity()
Returns
- float
The player's current gravity value.
GetHealth()
Gets the player's health.
float GetHealth()
Returns
- float
The player's current health.
GetInterior()
Gets the player's interior.
uint GetInterior()
Returns
- uint
The player's current interior ID.
GetKeyData()
Gets the player's key data.
ref PlayerKeyData GetKeyData()
Returns
- PlayerKeyData
A reference to the player's key data.
GetKickStatus()
Checks if the player is about to be kicked.
bool GetKickStatus()
Returns
GetMoney()
Gets the player's current money.
int GetMoney()
Returns
- int
The amount of money the player has.
GetName()
Gets the player's name.
string GetName()
Returns
- string
The player's name.
GetNetworkData()
Gets the player's network data.
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.
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.
uint GetPing()
Returns
- uint
The player's ping in milliseconds.
GetScore()
Gets the player's score.
int GetScore()
Returns
- int
The player's current score.
GetSerial()
Gets the player's serial (GPCI).
string GetSerial()
Returns
- string
The player's serial.
GetShopName()
Gets the player's shop name.
string GetShopName()
Returns
- string
The name of the shop.
GetSkillLevels()
Gets the player's skill levels for all weapon types.
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.
int GetSkin()
Returns
- int
The skin ID of the player.
GetSpectateData()
Gets the player's spectate data.
ref PlayerSpectateData GetSpectateData()
Returns
- PlayerSpectateData
A reference to the player's spectate data.
GetState()
Gets the current state of the player.
PlayerState GetState()
Returns
- PlayerState
The player's current state.
GetSurfingData()
Gets the player's surfing data.
PlayerSurfingData GetSurfingData()
Returns
- PlayerSurfingData
The player's current surfing data.
GetTargetActor()
Gets the actor the player is targeting.
IActor GetTargetActor()
Returns
- IActor
The actor being targeted, or
nullif no actor is targeted.
GetTargetPlayer()
Gets the player the player is targeting.
IPlayer GetTargetPlayer()
Returns
- IPlayer
The player being targeted, or
nullif no player is targeted.
GetTeam()
Gets the player's team.
int GetTeam()
Returns
- int
The team ID of the player.
GetTime()
Gets the in-game time for the player.
(int hour, int minutes) GetTime()
Returns
GetVelocity()
Gets the player's velocity.
Vector3 GetVelocity()
Returns
- Vector3
The player's current velocity.
GetWantedLevel()
Gets the player's wanted level.
uint GetWantedLevel()
Returns
- uint
The player's wanted level.
GetWeaponSlot(int)
Gets the weapon data for a specific weapon slot.
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.
BlittableStructRef<WeaponSlots> GetWeapons()
Returns
- BlittableStructRef<WeaponSlots>
A reference to the player's weapon slots.
GetWeather()
Gets the player's current weather.
int GetWeather()
Returns
- int
The weather ID of the player.
GetWorldBounds()
Gets the player's world bounds.
Vector4 GetWorldBounds()
Returns
- Vector4
The coordinates defining the player's world bounds.
GiveMoney(int)
Gives the player additional money.
void GiveMoney(int money)
Parameters
moneyintThe amount of money to give.
GiveWeapon(WeaponSlotData)
Gives a weapon to the player.
void GiveWeapon(WeaponSlotData weapon)
Parameters
weaponWeaponSlotDataThe weapon to give.
HasCameraTargeting()
Checks if camera targeting is enabled for the player.
bool HasCameraTargeting()
Returns
HasClock()
Checks if the in-game clock is enabled for the player.
bool HasClock()
Returns
HasGameText(int)
Checks if game text is currently displayed for the player.
bool HasGameText(int style)
Parameters
styleintThe style of the game text to check.
Returns
HasWidescreen()
Checks if widescreen mode is enabled for the player.
bool HasWidescreen()
Returns
HideGameText(int)
Hides game text for the player.
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.
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.
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).
bool IsBot()
Returns
IsGhostModeEnabled()
Checks if ghost mode is enabled for the player.
bool IsGhostModeEnabled()
Returns
IsStreamedInForPlayer(IPlayer)
Checks if another player is streamed in for this player.
bool IsStreamedInForPlayer(IPlayer other)
Parameters
otherIPlayerThe player to check.
Returns
IsTeleportAllowed()
Checks if the player is allowed to teleport by clicking the map.
bool IsTeleportAllowed()
Returns
IsUsingOfficialClient()
Checks if the player is using an official client.
bool IsUsingOfficialClient()
Returns
Kick()
Kicks the player from the server.
void Kick()
LastPlayedAudio()
Gets the URL of the last played audio stream.
string LastPlayedAudio()
Returns
- string
The URL of the last played audio stream.
LastPlayedSound()
Gets the ID of the last sound played for the player.
int LastPlayedSound()
Returns
- int
The ID of the last played sound.
PlayAudio(string, bool, Vector3, float)
Plays an audio stream for the player.
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.
void PlaySound(int sound, Vector3 pos)
Parameters
PlayerCrimeReport(IPlayer, int)
Plays a crime report for the player with the specified suspect and crime.
bool PlayerCrimeReport(IPlayer suspect, int crime)
Parameters
Returns
RemoveDefaultObjects(uint, Vector3, float)
Removes default objects near a specific position for the player.
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.
RemoveFromVehicle(bool)
Removes the player from their vehicle.
void RemoveFromVehicle(bool force)
Parameters
RemoveWeapon(byte)
Removes a weapon from the player.
void RemoveWeapon(byte weapon)
Parameters
weaponbyteThe weapon to remove.
ResetMoney()
Resets the player's money to zero.
void ResetMoney()
ResetWeapons()
Resets all weapons for the player.
void ResetWeapons()
SendChatMessage(IPlayer, string)
Sends a chat message to the player.
void SendChatMessage(IPlayer sender, string message)
Parameters
SendClientCheck(int, int, int, int)
Sends a client check request to the player.
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.
void SendClientMessage(ref Colour colour, string message)
Parameters
SendCommand(string)
Sends a command to the player.
void SendCommand(string message)
Parameters
messagestringThe command message to send.
SendDeathMessage(IPlayer, IPlayer, int)
Sends a death message to the player.
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.
void SendEmptyDeathMessage()
SendGameText(string, TimeSpan, int)
Sends game text to the player.
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.
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.
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.
void SetAction(PlayerSpecialAction action)
Parameters
actionPlayerSpecialActionThe special action to set.
SetArmedWeapon(int)
Sets the player's currently armed weapon.
void SetArmedWeapon(int weapon)
Parameters
weaponintThe weapon ID to set as armed.
SetArmour(float)
Sets the player's armor value.
void SetArmour(float armour)
Parameters
armourfloatThe armor value to set.
SetCameraBehind()
Sets the camera to a position behind the player.
void SetCameraBehind()
SetCameraLookAt(Vector3, int)
Sets the direction the player's camera looks at.
void SetCameraLookAt(Vector3 pos, int cutType)
Parameters
SetCameraPosition(Vector3)
Sets the player's camera position.
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.
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.
void SetColour(Colour colour)
Parameters
colourColourThe color to set.
SetControllable(bool)
Sets whether the player is controllable.
void SetControllable(bool controllable)
Parameters
SetDrunkLevel(int)
Sets the player's drunk level.
void SetDrunkLevel(int level)
Parameters
levelintThe drunk level to set.
SetFightingStyle(PlayerFightingStyle)
Sets the player's fighting style.
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.
void SetGravity(float gravity)
Parameters
gravityfloatThe gravity value to set.
SetHealth(float)
Sets the player's health.
void SetHealth(float health)
Parameters
healthfloatThe health value to set.
SetInterior(uint)
Sets the player's interior.
void SetInterior(uint interior)
Parameters
interioruintThe interior ID to set.
SetMapIcon(int, Vector3, int, Colour, MapIconStyle)
Sets a map icon for the player.
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.
void SetMoney(int money)
Parameters
moneyintThe amount of money to set.
SetName(string)
Sets the player's name.
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.
void SetOtherColour(IPlayer other, Colour colour)
Parameters
SetPositionFindZ(Vector3)
Sets the player's position and finds the proper Z coordinate for the map.
void SetPositionFindZ(Vector3 pos)
Parameters
posVector3The position to set.
SetRemoteVehicleCollisions(bool)
Sets whether the player should collide with remote vehicles.
void SetRemoteVehicleCollisions(bool collide)
Parameters
SetScore(int)
Sets the player's score.
void SetScore(int score)
Parameters
scoreintThe score value to set.
SetShopName(string)
Sets the player's shop name.
void SetShopName(string name)
Parameters
namestringThe name of the shop.
SetSkillLevel(PlayerWeaponSkill, int)
Sets the player's skill level for a specific weapon.
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.
void SetSkin(int skin, bool send = true)
Parameters
SetSpectating(bool)
Sets whether the player is spectating.
void SetSpectating(bool spectating)
Parameters
SetTeam(int)
Sets the player's team.
void SetTeam(int team)
Parameters
teamintThe team ID to set.
SetTime(TimeSpan, TimeSpan)
Sets the in-game time for the player.
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.
void SetTransform(GTAQuat tm)
Parameters
tmGTAQuatThe transformation matrix to set.
SetVelocity(Vector3)
Sets the player's velocity.
void SetVelocity(Vector3 velocity)
Parameters
velocityVector3The velocity to set.
SetWantedLevel(uint)
Sets the player's wanted level.
void SetWantedLevel(uint level)
Parameters
leveluintThe wanted level to set.
SetWeaponAmmo(WeaponSlotData)
Sets the ammunition for a specific weapon slot.
void SetWeaponAmmo(WeaponSlotData data)
Parameters
dataWeaponSlotDataThe weapon slot data containing the weapon and ammunition information.
SetWeather(int)
Sets the player's weather.
void SetWeather(int weatherId)
Parameters
weatherIdintThe weather ID to set.
SetWorldBounds(Vector4)
Sets the player's world bounds.
void SetWorldBounds(Vector4 coords)
Parameters
coordsVector4The coordinates defining the world bounds.
SetWorldTime(TimeSpan)
Sets the in-game world time for the player.
void SetWorldTime(TimeSpan time)
Parameters
timeTimeSpanThe world time to set, truncated to whole hours on the native side.
Spawn()
Spawns the player.
void Spawn()
SpectatePlayer(IPlayer, PlayerSpectateMode)
Makes the player spectate another player.
void SpectatePlayer(IPlayer target, PlayerSpectateMode mode)
Parameters
targetIPlayerThe player to spectate.
modePlayerSpectateModeThe spectate mode.
SpectateVehicle(IVehicle, PlayerSpectateMode)
Makes the player spectate a vehicle.
void SpectateVehicle(IVehicle target, PlayerSpectateMode mode)
Parameters
targetIVehicleThe vehicle to spectate.
modePlayerSpectateModeThe spectate mode.
StopAudio()
Stops the currently playing audio for the player.
void StopAudio()
StreamInForPlayer(IPlayer)
Streams this player in for another player.
void StreamInForPlayer(IPlayer other)
Parameters
otherIPlayerThe player for whom this player will be streamed in.
StreamOutForPlayer(IPlayer)
Streams another player out for this player.
void StreamOutForPlayer(IPlayer other)
Parameters
otherIPlayerThe player to stream out.
StreamedForPlayers()
Gets the set of players for whom this player is currently streamed in.
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.
void ToggleGhostMode(bool toggle)
Parameters
ToggleOtherNameTag(IPlayer, bool)
Toggles the visibility of another player's name tag for this player.
void ToggleOtherNameTag(IPlayer other, bool toggle)
Parameters
UnsetMapIcon(int)
Removes a map icon for the player.
void UnsetMapIcon(int id)
Parameters
idintThe ID of the map icon to remove.
UseCameraTargeting(bool)
Enables or disables camera targeting for the player.
void UseCameraTargeting(bool enable)
Parameters
UseClock(bool)
Enables or disables the in-game clock for the player.
void UseClock(bool enable)
Parameters
UseStuntBonuses(bool)
Enables or disables stunt bonuses for the player.
void UseStuntBonuses(bool enable)
Parameters
UseWidescreen(bool)
Enables or disables widescreen mode for the player.
void UseWidescreen(bool enable)