Click or drag to resize

Player Class

Represents a component which provides the data and functionality of a player.
Inheritance Hierarchy

Namespace:  SampSharp.Entities.SAMP
Assembly:  SampSharp.Entities (in SampSharp.Entities.dll) Version: 0.0.0-localbuild+05637d43e9f34d872e453289d4e240c843e43b09
Syntax
C#
public sealed class Player : Component

The Player type exposes the following members.

Properties
  NameDescription
Public propertyAngle
Gets or sets the facing angle of this player.
Public propertyAnimationIndex
Gets the index of the animation this player is playing.
Public propertyArmour
Gets or sets the armor of this player.
Public propertyAspectCameraRatio
Gets the aspect ratio of this player's camera.
Public propertyBytesReceived
Get the amount of information (in bytes) that the server has sent to the player.
Public propertyBytesSent
Get the amount of information (in bytes) that the server has received from the player.
Public propertyCameraFrontVector
Gets the front Vector3 of this player's camera.
Public propertyCameraMode
Gets the mode of this player's camera.
Public propertyCameraPosition
Gets or sets the position of the camera of this player.
Public propertyCameraTargetActor
Gets the GtaPlayer the camera of this player is pointing at.
Public propertyCameraTargetEntity
Gets the entity (player, player object, object, vehicle or actor) the camera of this player is pointing at.
Public propertyCameraTargetGlobalObject
Gets the GlobalObject the camera of this player is pointing at.
Public propertyCameraTargetPlayer
Gets the GtaPlayer the camera of this player is pointing at.
Public propertyCameraTargetPlayerObject
Gets the PlayerObject the camera of this player is pointing at.
Public propertyCameraTargetVehicle
Gets the GtaVehicle the camera of this player is pointing at.
Public propertyCameraZoom
Gets the game camera zoom level for this player.
Public propertyColor
Gets or sets the Color of this player.
Public propertyConnectedTime
Gets the amount of time (in milliseconds) that a player has been connected to the server for.
Public propertyConnectionStatus
Get a player's connection status.
Public propertyDrunkLevel
Gets or sets the drunkenness level of this player.
Public propertyEndPoint
Gets the end point (IP and port) of this player.
Public propertyEntity
Gets the entity to which this component has been attached.
(Inherited from Component.)
Public propertyFightStyle
Gets or sets the FightStyle of this player.
Public propertyGpci
Gets this player's GPCI string.
Public propertyHealth
Gets or sets the health of this player.
Public propertyInAnyVehicle
Gets whether this player is currently in any vehicle.
Public propertyInCheckpoint
Gets whether this player is in his checkpoint.
Public propertyInRaceCheckpoint
Gets whether this player is in his race-checkpoint.
Public propertyInterior
Gets or sets the interior of this player.
Public propertyIp
Gets the IP of this player.
Public propertyIsAdmin
Gets whether this player is logged into RCON.
Public propertyIsAlive
Gets a value indicating whether this player is alive.
Public propertyIsComponentAlive
Gets a value indicating whether this component is alive (has not been destroyed).
(Inherited from Component.)
Public propertyIsNpc
Gets whether this player is an actual player or an NPC.
Public propertyIsSelectingTextDraw
Gets a value indicating whether this player is selecting a textdraw.
Public propertyMenu
Gets the Vehicle this player is currently in.
Public propertyMessagesReceived
Gets the number of messages the server has received from the player.
Public propertyMessagesReceivedPerSecond
Gets the number of messages the player has received in the last second.
Public propertyMessagesSent
Gets the number of messages the server has sent to the player.
Public propertyMoney
Gets or sets the money of this player.
Public propertyName
Gets or sets the name of this player.
Public propertyNetworkStats Obsolete.
Gets this player's network stats and saves them into a string.
Public propertyPacketLossPercent Obsolete.
Gets the packet loss percentage of a player. Packet loss means data the player is sending to the server is being lost (or vice-versa).
Public propertyParent
Gets the parent entity of the entity to which this component has been attached.
(Inherited from Component.)
Public propertyPing
Gets the ping of this player.
Public propertyPosition
Gets or sets the position of this player.
Public propertyRotation
Gets or sets the rotation of this player.
Public propertyScore
Gets or sets the score of this player.
Public propertySkin
Gets or sets the skin of this player.
Public propertySpecialAction
Gets or sets the SpecialAction of this player.
Public propertyState
Gets the state of this player.
Public propertySurfingEntity
Gets the entity (object or vehicle) that this player is surfing.
Public propertyTargetActor
Gets the Actor this player is aiming at.
Public propertyTargetPlayer
Gets the Player this player is aiming at.
Public propertyTeam
Gets or sets the team this player is in.
Public propertyVariables
Gets the PVar variable collection for this player.
Public propertyVehicle
Gets the Vehicle this player is currently in.
Public propertyVehicleSeat
Gets the vehicle seat this player sits on.
Public propertyVelocity
Gets or sets the velocity of this player.
Public propertyVersion
Gets this player's game version.
Public propertyVirtualWorld
Gets or sets the virtual world of this player.
Public propertyWantedLevel
Gets or sets the wanted level of this player.
Public propertyWeapon
Gets the Weapon this player is currently holding.
Public propertyWeaponAmmo
Gets the ammo of the Weapon this player is currently holding.
Public propertyWeaponState
Gets the WeaponState of the Weapon this player is currently holding.
Top
Methods
  NameDescription
Public methodAddComponentT
Adds a component of the specified type T to the entity.
(Inherited from Component.)
Public methodAddComponentT(Object)
Adds a component of the specified type T to the entity with the specified constructor args.
(Inherited from Component.)
Public methodApplyAnimation(String, String, Single, Boolean, Boolean, Boolean, Boolean, Int32)
Apply an animation to this player.
Public methodApplyAnimation(String, String, Single, Boolean, Boolean, Boolean, Boolean, Int32, Boolean)
Apply an animation to this player.
Public methodAttachCameraToObject
Attaches a player's camera to an object.
Public methodBan
Ban this player. The ban will be IP-based, and be saved in the samp.ban file in the server's root directory. Ban(String) allows you to ban with a reason, while you can ban and unban IPs using the RCON banip and unbanip commands.
Public methodBan(String)
Ban this player with a reason.
Public methodCancelEdit
Cancels object editing mode for this player.
Public methodCancelSelectTextDraw
Cancel text draw selection with the mouse for this player.
Public methodClearAnimations
Clears all animations for this player.
Public methodClearAnimations(Boolean)
Clears all animations for this player.
Public methodCreateExplosion
Creates an explosion for this player. Only this player will see explosion and feel its effects. This is useful when you want to isolate explosions from other players or to make them only appear in specific virtual worlds.
Public methodDestroy
Destroys this component.
(Inherited from Component.)
Public methodDestroyComponentsT
Destroys the components of the specified type T attached to the entity.
(Inherited from Component.)
Public methodDestroyEntity
Destroys the entity.
(Inherited from Component.)
Public methodDisableCheckpoint
Disable any initialized checkpoints for this player.
Public methodDisableRaceCheckpoint
Disable any initialized race checkpoints for this player.
Public methodDisableRemoteVehicleCollisions
Allows you to disable collisions between vehicles for a player.
Public methodDoEditAttachedObject
Enter edition mode for an attached object.
Public methodEdit
Lets this player edit the specified object.
Public methodEnablePlayerCameraTarget
Toggles camera targeting functions for a player.
Public methodEnableStuntBonus
Toggle stunt bonuses for this player.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodForceClassSelection
Forces this player to go back to class selection.
Public methodGameText
Shows 'game text' (on-screen text) for a certain length of time for this player.
Public methodGetAnimationName
Get the animation library/name this player is playing.
Public methodGetComponentT
Gets a component of the specified type T attached to the entity.
(Inherited from Component.)
Public methodGetComponentInChildrenT
Gets a component of the specified type T attached to a child entity of the entity using a depth first search.
(Inherited from Component.)
Public methodGetComponentInParentT
Gets a component of the specified type T attached to a parent entity of the entity.
(Inherited from Component.)
Public methodGetComponentsT
Gets all components of the specified type T attached to the entity.
(Inherited from Component.)
Public methodGetComponentsInChildrenT
Gets all components of the specified type T attached to a child entity of the entity.
(Inherited from Component.)
Public methodGetComponentsInParentT
Gets all components of the specified type T attached to a parent entity of the entity.
(Inherited from Component.)
Public methodGetDistanceFromPoint
Calculate the distance between this player and a map coordinate.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetKeys
Check which keys this player is pressing.
Public methodGetLastShot
Retrieves the start and end (hit) position of the last bullet a player fired.
Public methodGetTime
Get this player's current game time. Set by SetWorldTime(Int32), or by ToggleClock(Boolean).
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetWeaponData
Get the Weapon and ammo in this player's weapon slot.
Public methodGiveMoney
Give money to this player.
Public methodGiveWeapon
Give this player a Weapon with a specified amount of ammo.
Public methodInterpolateCameraLookAt
Interpolate this player's camera's 'look at' point between two coordinates with a set speed.
Public methodInterpolateCameraPosition
Move this player's camera from one position to another, within the set time.
Public methodIsAttachedObjectSlotUsed
Check if this player has an object attached in the specified index (slot).
Public methodIsInRangeOfPoint
Check if this player is in range of a point.
Public methodIsInVehicle
Checks if this player is in a specific vehicle.
Public methodIsPlayerStreamedIn
Checks if the specified player is streamed in this player's client.
Public methodKick
Kicks this player from the server. They will have to quit the game and re-connect if they wish to continue playing.
Public methodPlayAudioStream(String)
Play an 'audio stream' for this player. Normal audio files also work (e.g. MP3).
Public methodPlayAudioStream(String, Vector3, Single)
Play an 'audio stream' for this player. Normal audio files also work (e.g. MP3).
Public methodPlayCrimeReport
This function plays a crime report for this player - just like in single-player when CJ commits a crime.
Public methodPlaySound(Int32)
Plays the specified sound for this player.
Public methodPlaySound(Int32, Vector3)
Plays the specified sound for this player at a specific point.
Public methodPutCameraBehindPlayer
Restore the camera to a place behind the player, after using a function like CameraPosition.
Public methodPutInVehicle(EntityId)
Puts this player in a vehicle as driver.
Public methodPutInVehicle(EntityId, Int32)
Puts this player in a vehicle.
Public methodRemoveAttachedObject
Remove an attached object from this player.
Public methodRemoveBuilding
Removes a standard San Andreas model for this player within a specified range.
Public methodRemoveFromVehicle
Removes/ejects this player from his vehicle.
Public methodRemoveMapIcon
Removes a map icon that was set earlier for this player.
Public methodResetMoney
Reset this player's money to $0.
Public methodResetWeapons
Removes all weapons from this player.
Public methodSelect
Lets this player select an object.
Public methodSelectTextDraw
Display the cursor and allow this player to select a text draw.
Public methodSendClientMessage(String)
This function sends a message to this player in white in the chat. The whole line in the chat box will be in the set color unless color embedding is used.
Public methodSendClientMessage(String, Object)
This function sends a message to this player in white in the chat. The whole line in the chat box will be in the set color unless color embedding is used.
Public methodSendClientMessage(Color, String)
This function sends a message to this player with a chosen color in the chat. The whole line in the chat box will be in the set color unless color embedding is used.
Public methodSendClientMessage(Color, String, Object)
This function sends a message to this player with a chosen color in the chat. The whole line in the chat box will be in the set color unless color embedding is used.
Public methodSendDeathMessage
Adds a death to the kill feed on the right-hand side of the screen of this player.
Public methodSendPlayerMessageToPlayer
Sends a message in the name the specified sender to this player. The message will appear in the chat box but can only be seen by this player. The line will start with the the sender's name in their color, followed by the message in white.
Public methodSetAmmo
Set the ammo of this player's weapon.
Public methodSetArmedWeapon
Sets the armed weapon of this player.
Public methodSetAttachedObject
Attach an object to a specific bone on this player.
Public methodSetCameraLookAt(Vector3)
Set the direction this player's camera looks at. To be used in combination with CameraPosition.
Public methodSetCameraLookAt(Vector3, CameraCut)
Set the direction this player's camera looks at. To be used in combination with CameraPosition.
Public methodSetChatBubble
Creates a chat bubble above this player's name tag.
Public methodSetCheckpoint
Sets a checkpoint (red circle) for this player. Also shows a red blip on the radar.
Public methodSetMapIcon
Place an icon/marker on this player's map. Can be used to mark locations such as banks and hospitals to players.
Public methodSetPlayerMarker
Change the color of this player's name tag and radar blip for another Player.
Public methodSetPositionFindZ
This sets this player's position then adjusts the Player's z-coordinate to the nearest solid ground under the position.
Public methodSetRaceCheckpoint
Creates a race checkpoint. When this player enters it, EnterRaceCheckpoint event is called.
Public methodSetShopName
Loads or unloads an interior script for this player. (for example the Ammunation menu)
Public methodSetSkillLevel
Set the skill level of a certain weapon type for this player.
Public methodSetSpawnInfo
This function can be used to change the spawn information of a specific player. It allows you to automatically set someone's spawn weapons, their team, skin and spawn position, normally used in case of mini games or automatic-spawn systems.
Public methodSetTime
Sets the clock of this player to a specific value. This also changes the daytime. (night/day etc.)
Public methodSetWeather
Set this player's weather. If ToggleClock(Boolean) has been used to enable the clock, weather changes will interpolate (gradually change), otherwise will change instantly.
Public methodSetWorldBounds
Set the world boundaries for this player - players can not go out of the boundaries.
Public methodShowNameTagForPlayer
This functions allows you to toggle the drawing of player name tags, health bars and armor bars which display above their head. For use of a similar function like this on a global level, ShowNameTags(Boolean) function.
Public methodSpawn
(Re)Spawns a player.
Public methodSpectatePlayer(EntityId)
Makes this player spectate (watch) another player.
Public methodSpectatePlayer(EntityId, SpectateMode)
Makes this player spectate (watch) another player.
Public methodSpectateVehicle(EntityId)
Sets this player to spectate another vehicle, i.e. see what its driver sees.
Public methodSpectateVehicle(EntityId, SpectateMode)
Sets this player to spectate another vehicle, i.e. see what its driver sees.
Public methodStartRecordingPlayerData
Starts recording this player's movements to a file, which can then be reproduced by an NPC.
Public methodStopAudioStream
Stops the current audio stream for this player.
Public methodStopRecordingPlayerData
Stops all the recordings that had been started with StartRecordingPlayerData(PlayerRecordingType, String) for this player.
Public methodToggleClock
Show/Hide the in-game clock (top right corner) for this player.
Public methodToggleControllable
Toggles whether this player can control themselves, basically freezes them.
Public methodToggleSpectating
Toggle this player's spectate mode.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
See Also