Class Player
Represents a player within the game.
public class Player : IEntity, IHealth
- Inheritance
-
Player
- Implements
- Inherited Members
- Extension Methods
Fields
All
All players currently in the game.
public static readonly List<Player> All
Field Value
Properties
CrimeData
The player's crime data, including wanted level, crimes committed, and pursuit state.
public PlayerCrimeData CrimeData { get; }
Property Value
Crouched
Is player crouching
public bool Crouched { get; }
Property Value
CurrentAvatarSettings
The player's current avatar settings (appearance configuration).
public object CurrentAvatarSettings { get; }
Property Value
CurrentHealth
The current health of the player.
public float CurrentHealth { get; }
Property Value
CurrentProperty
Property this player is currently in
public PropertyWrapper? CurrentProperty { get; }
Property Value
CurrentRegion
Region this player is currently in
public Region CurrentRegion { get; }
Property Value
IsArrested
If player is currently under arrest
public bool IsArrested { get; }
Property Value
IsDead
Whether the player is dead or not.
public bool IsDead { get; }
Property Value
IsInVehicle
If player is currently in a vehicle
public bool IsInVehicle { get; }
Property Value
IsInvincible
Whether the player is invincible or not.
public bool IsInvincible { get; set; }
Property Value
IsLocal
Whether this player is the client player or a networked player.
public bool IsLocal { get; }
Property Value
IsRagdolled
Is Player currently ragdolled
public bool IsRagdolled { get; }
Property Value
IsReadyToSleep
If player is ready for sleep
public bool IsReadyToSleep { get; }
Property Value
IsSkating
If player is currently using a skateboard
public bool IsSkating { get; }
Property Value
IsSleeping
If player is currently sleeping
public bool IsSleeping { get; }
Property Value
IsTased
Is player currently under tased effect
public bool IsTased { get; }
Property Value
IsUnconscious
If player is unconscious
public bool IsUnconscious { get; }
Property Value
LastDrivenVehicle
The Last vehicle this player has driven
public LandVehicle? LastDrivenVehicle { get; }
Property Value
LastVisitedProperty
Last Property this player visted (May only be owned properties)
public PropertyWrapper? LastVisitedProperty { get; }
Property Value
Local
The current client player (player executing your code).
public static Player Local { get; }
Property Value
MaxHealth
The maximum health of the player. Note: In the base game this is a constant (100). Changing it at runtime is unsupported. Setting this will clamp the player's current health to the specified value.
public float MaxHealth { get; set; }
Property Value
Name
The name of the player.
For single player, this appears to always return Player.
public string Name { get; }
Property Value
Position
The world position of the player.
public Vector3 Position { get; set; }
Property Value
- Vector3
Scale
The scale of the player.
public float Scale { get; set; }
Property Value
TimeSinceVehicleExit
Time since player has exited a vehicle
public float TimeSinceVehicleExit { get; }
Property Value
Transform
The transform of the player. Please do not set the properties of the Transform.
public Transform Transform { get; }
Property Value
- Transform
Methods
Damage(int)
Deals damage to the player.
public void Damage(int amount)
Parameters
amountintThe amount of damage to deal.
EquipClothing(ClothingItemDefinition)
Creates clothing with the definition's default color and inserts it into the matching player clothing slot.
public ClothingItemInstance EquipClothing(ClothingItemDefinition definition)
Parameters
definitionClothingItemDefinitionThe clothing item definition to equip.
Returns
- ClothingItemInstance
The clothing instance that was inserted.
GetCurrentBasicAvatarSettings()
Retrieves the player's current avatar settings as an S1API BasicAvatarSettings wrapper. Returns a new BasicAvatarSettings instance on each call when S1Player.CurrentAvatarSettings is available.
public BasicAvatarSettings? GetCurrentBasicAvatarSettings()
Returns
Heal(int)
Heals the player.
public void Heal(int amount)
Parameters
amountintThe amount of healing to apply to the player.
InsertClothing(ClothingItemInstance)
Inserts clothing into the matching player clothing slot.
public void InsertClothing(ClothingItemInstance clothing)
Parameters
clothingClothingItemInstance
Kill()
Kills the player.
public void Kill()
RefreshClothingAppearance()
Refreshes the player's avatar from the current clothing slots.
public void RefreshClothingAppearance()
Revive()
Revives the player.
public void Revive()
SendAppearance(BasicAvatarSettings)
Sends updated appearance settings through the game's native appearance flow.
public void SendAppearance(BasicAvatarSettings settings)
Parameters
settingsBasicAvatarSettings
Events
LocalPlayerSpawned
Fired when the local (client-owned) player finishes client startup.
public static event Action<Player>? LocalPlayerSpawned
Event Type
OnDeath
Called when the player dies.
public event Action OnDeath
Event Type
OnRevive
Called when the player revives.
public event Action OnRevive
Event Type
PlayerDespawned
Fired when a player is destroyed/removed.
public static event Action<Player>? PlayerDespawned
Event Type
PlayerSpawned
Fired when any player finishes client startup.
public static event Action<Player>? PlayerSpawned