Class Player
Represents the in-game player, by encapsulating a ReferenceHub.
public class Player : TypeCastObject<Player>, IEntity, IWorldSpace, IPosition, IRotation
- Inheritance
-
Player
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Player(ReferenceHub)
Initializes a new instance of the Player class.
public Player(ReferenceHub referenceHub)
Parameters
referenceHub
ReferenceHubThe ReferenceHub of the player to be encapsulated.
Player(GameObject)
Initializes a new instance of the Player class.
public Player(GameObject gameObject)
Parameters
gameObject
GameObjectThe UnityEngine.GameObject of the player.
Properties
ActiveArtificialHealthProcesses
Gets a IEnumerable<T> of all active Artificial Health processes on the player.
public IEnumerable<AhpStat.AhpProcess> ActiveArtificialHealthProcesses { get; }
Property Value
- IEnumerable<AhpStat.AhpProcess>
ActiveDangers
Gets a list of active CustomPlayerEffects.Danger.DangerStackBase the player has.
public IEnumerable<DangerStackBase> ActiveDangers { get; }
Property Value
- IEnumerable<DangerStackBase>
ActiveEffects
Gets all currently active effects.
public IEnumerable<StatusEffectBase> ActiveEffects { get; }
Property Value
- IEnumerable<StatusEffectBase>
- See Also
AdminChatAccess
Gets a value indicating whether the player has Admin Chat access.
public bool AdminChatAccess { get; }
Property Value
AgreedToRecording
Gets a value indicating whether the player has agreed to microphone recording.
public bool AgreedToRecording { get; }
Property Value
Ammo
Gets the player's ammo.
public Dictionary<ItemType, ushort> Ammo { get; }
Property Value
- Dictionary<ItemType, ushort>
ArtificialHealth
Gets or sets the player's artificial health. If the health is greater than the MaxArtificialHealth, it will also be changed to match the artificial health.
public float ArtificialHealth { get; set; }
Property Value
AuthenticationToken
Gets the player's authentication token.
public string AuthenticationToken { get; }
Property Value
AuthenticationType
Gets the player's authentication type.
public AuthenticationType AuthenticationType { get; }
Property Value
BadgeHidden
Gets or sets a value indicating whether the player's badge is hidden.
public bool BadgeHidden { get; set; }
Property Value
CameraTransform
Gets the encapsulated ReferenceHub's PlayerCameraReference.
public Transform CameraTransform { get; }
Property Value
- Transform
ComponentsInChildren
Gets a IReadOnlyCollection<T> of EActor containing all the components in children.
public IReadOnlyCollection<EActor> ComponentsInChildren { get; }
Property Value
Connection
Gets player's Mirror.NetworkConnection.
public NetworkConnection Connection { get; }
Property Value
- NetworkConnection
Cuffer
Gets or sets a value indicating the Player that currently has the player cuffed.
This value will be null if the player is not cuffed. Setting this value to null will uncuff the player if they are cuffed.
public Player Cuffer { get; set; }
Property Value
CurrentArmor
Gets the armor that the player is currently wearing. Value will be null if the player is not wearing any armor.
public Armor CurrentArmor { get; }
Property Value
CurrentHint
Gets the hint currently watched by the player.
public Hint CurrentHint { get; }
Property Value
CurrentItem
Gets or sets the item in the player's hand. Value will be null if the player is not holding anything.
public Item CurrentItem { get; set; }
Property Value
- See Also
CurrentRoom
Gets the current Room the player is in.
public Room CurrentRoom { get; }
Property Value
CurrentSpectatingPlayers
Gets a Player IEnumerable<T> of spectators that are currently spectating this Player.
public IEnumerable<Player> CurrentSpectatingPlayers { get; }
Property Value
CustomInfo
Gets or sets the player's custom player info string. This string is displayed along with the player's InfoArea.
public string CustomInfo { get; set; }
Property Value
CustomName
Gets or sets the player's nickname, if null it sets the original nickname.
public string CustomName { get; set; }
Property Value
CustomRoleFriendlyFireMultiplier
Gets or sets a Dictionary<TKey, TValue> containing cached string and their Dictionary<TKey, TValue> which is cached Role with FF multiplier. This is for unique custom roles.
public Dictionary<string, Dictionary<RoleTypeId, float>> CustomRoleFriendlyFireMultiplier { get; set; }
Property Value
- Dictionary<string, Dictionary<RoleTypeId, float>>
Remarks
Consider adding this as object, Dict so that CustomRoles, and Strings can be parsed.
Dangers
Gets an array of CustomPlayerEffects.Danger.DangerStackBase if the Scp1853 effect is enabled or an empty array if it is not enabled.
public DangerStackBase[] Dangers { get; }
Property Value
- DangerStackBase[]
Dictionary
Gets a Dictionary<TKey, TValue> containing all Player's on the server.
public static Dictionary<GameObject, Player> Dictionary { get; }
Property Value
- Dictionary<GameObject, Player>
DisplayNickname
Gets or sets the player's nickname displayed to other player.
public string DisplayNickname { get; set; }
Property Value
DoNotTrack
Gets a value indicating whether the player has Do Not Track (DNT) enabled. If this value is true, data about the player unrelated to server security shouldn't be stored.
public bool DoNotTrack { get; }
Property Value
Emotion
Gets or sets the player's emotion.
public EmotionPresetType Emotion { get; set; }
Property Value
- EmotionPresetType
Footprint
Gets the player's Footprinting.Footprint.
public Footprint Footprint { get; }
Property Value
- Footprint
FriendlyFireMultiplier
Gets or sets a Dictionary<TKey, TValue> containing cached PlayerRoles.RoleTypeId and their FF multiplier. This is for non-unique roles.
public Dictionary<RoleTypeId, float> FriendlyFireMultiplier { get; set; }
Property Value
- Dictionary<RoleTypeId, float>
GameObject
Gets the encapsulated UnityEngine.GameObject.
public GameObject GameObject { get; }
Property Value
- GameObject
GlobalBadge
Gets the global badge of the player. Value will be null if the player does not have a global badge.
public Badge? GlobalBadge { get; }
Property Value
Group
Gets or sets the player's group.
public UserGroup Group { get; set; }
Property Value
- UserGroup
GroupName
Gets or sets the player's group name.
public string GroupName { get; set; }
Property Value
HasCustomName
Gets a value indicating whether the player has an active CustomName.
public bool HasCustomName { get; }
Property Value
HasFlashlightModuleEnabled
Gets a value indicating whether the player has enabled weapon's flashlight module.
public bool HasFlashlightModuleEnabled { get; }
Property Value
HasHint
Gets a value indicating whether the player is viewing a hint.
public bool HasHint { get; }
Property Value
HasReservedSlot
Gets a value indicating whether the player has a reserved slot.
public bool HasReservedSlot { get; }
Property Value
- See Also
Health
Gets or sets the player's health. If the health is greater than the MaxHealth, the MaxHealth will also be changed to match the health.
public float Health { get; set; }
Property Value
HintDisplay
Gets the Hints.HintDisplay of the player.
public HintDisplay HintDisplay { get; }
Property Value
- HintDisplay
HumeShield
Gets or sets the player's Hume Shield.
public float HumeShield { get; set; }
Property Value
Remarks
This value can bypass the role's hume shield maximum. However, this value will only be visible to the end-player as Hume Shield if IsHumeShieldedRole is true. Otherwise, the game will treat the player as though they have the amount of Hume Shield specified, even though they cannot see it.
HumeShieldRegenerationMultiplier
Gets or sets the players multiplier for gaining HumeShield.
public float HumeShieldRegenerationMultiplier { get; set; }
Property Value
HumeShieldStat
Gets the player's PlayerStatsSystem.HumeShieldStat. TODO: Change to CustomHumeShieldStat.
public HumeShieldStat HumeShieldStat { get; }
Property Value
- HumeShieldStat
IPAddress
Gets the player's IP address.
public string IPAddress { get; }
Property Value
Id
Gets or sets the player's id.
public int Id { get; set; }
Property Value
InfoArea
Gets or sets the player's player info area bitmask. This property can be used to hide player name elements, such as the player's name, badges, etc.
public PlayerInfoArea InfoArea { get; set; }
Property Value
- PlayerInfoArea
InfoViewRange
Gets or sets the range at which this player's info can be viewed by others.
public float InfoViewRange { get; set; }
Property Value
Inventory
Gets the player's InventorySystem.Inventory.
public Inventory Inventory { get; }
Property Value
- Inventory
IsAimingDownWeapon
Gets a value indicating whether the player is aiming with a weapon.
public bool IsAimingDownWeapon { get; }
Property Value
IsAlive
Gets a value indicating whether the player is alive.
public bool IsAlive { get; }
Property Value
IsBypassModeEnabled
Gets or sets a value indicating whether the player's bypass mode is enabled.
public bool IsBypassModeEnabled { get; set; }
Property Value
IsCHI
Gets a value indicating whether the player's PlayerRoles.RoleTypeId is any Chaos rank. Equivalent to checking the player's PlayerRoles.Team.
public bool IsCHI { get; }
Property Value
IsConnected
Gets a value indicating whether the player is fully connected to the server.
public bool IsConnected { get; }
Property Value
IsCuffed
Gets a value indicating whether the player is cuffed.
public bool IsCuffed { get; }
Property Value
Remarks
Players can be cuffed without another player being the cuffer.
IsDead
Gets a value indicating whether the player is dead.
public bool IsDead { get; }
Property Value
IsFoundationForces
Gets a value indicating whether the player's PlayerRoles.RoleTypeId is any Foundation Forces. Equivalent to checking the player's PlayerRoles.Team.
public bool IsFoundationForces { get; }
Property Value
IsFriendlyFireEnabled
Gets a value indicating whether the player's friendly fire is enabled.
This property only determines if this player can deal damage to players on the same team;
This player can be damaged by other players on their own team even if this property is false.
public bool IsFriendlyFireEnabled { get; }
Property Value
IsGlobalModerator
Gets a value indicating whether the player is a global moderator.
public bool IsGlobalModerator { get; }
Property Value
IsGlobalMuted
Gets or sets a value indicating whether the player is global muted.
public bool IsGlobalMuted { get; set; }
Property Value
Remarks
This property will NOT persistently mute and unmute the player. For persistent mutes, see Mute(bool) and UnMute(bool).
IsGodModeEnabled
Gets or sets a value indicating whether the player has godmode enabled.
public bool IsGodModeEnabled { get; set; }
Property Value
IsHost
Gets a value indicating whether the player is the host.
public bool IsHost { get; }
Property Value
IsHuman
Gets a value indicating whether the player's PlayerRoles.RoleTypeId is any human rank.
public bool IsHuman { get; }
Property Value
IsInPocketDimension
Gets a value indicating whether the player is in the pocket dimension.
public bool IsInPocketDimension { get; }
Property Value
IsIntercomMuted
Gets or sets a value indicating whether the player is intercom muted.
public bool IsIntercomMuted { get; set; }
Property Value
Remarks
This property will NOT persistently mute and unmute the player. For persistent mutes, see Mute(bool) and UnMute(bool).
IsInventoryEmpty
Gets a value indicating whether the player's inventory is empty.
public bool IsInventoryEmpty { get; }
Property Value
IsInventoryFull
Gets a value indicating whether the player's inventory is full.
public bool IsInventoryFull { get; }
Property Value
IsJumping
Gets a value indicating whether the player is jumping.
public bool IsJumping { get; }
Property Value
IsMuted
Gets or sets a value indicating whether the player is muted.
public bool IsMuted { get; set; }
Property Value
Remarks
This property will NOT persistently mute and unmute the player. For persistent mutes, see Mute(bool) and UnMute(bool).
IsNPC
Gets a value indicating whether the player is a NPC.
public bool IsNPC { get; }
Property Value
IsNTF
Gets a value indicating whether the player's PlayerRoles.RoleTypeId is any NTF rank and not a Facility Guard. Equivalent to checking the player's PlayerRoles.Team.
public bool IsNTF { get; }
Property Value
IsNoclipPermitted
Gets or sets a value indicating whether the player is allowed to enter noclip mode.
public bool IsNoclipPermitted { get; set; }
Property Value
Remarks
For forcing the player into noclip mode, see IsNoclipEnabled.
- See Also
IsNorthwoodStaff
Gets a value indicating whether the player is Northwood staff.
public bool IsNorthwoodStaff { get; }
Property Value
IsOverwatchEnabled
Gets or sets a value indicating whether the player's overwatch is enabled.
public bool IsOverwatchEnabled { get; set; }
Property Value
IsReloading
Gets a value indicating whether the player is reloading a weapon.
public bool IsReloading { get; }
Property Value
IsScp
Gets a value indicating whether the player's PlayerRoles.RoleTypeId is any SCP. Equivalent to checking the player's PlayerRoles.Team.
public bool IsScp { get; }
Property Value
IsSpawnProtected
Gets or sets a value indicating whether the player is spawn protected.
public bool IsSpawnProtected { get; set; }
Property Value
IsSpeaking
Gets a value indicating whether the player is speaking.
public bool IsSpeaking { get; }
Property Value
IsStaffBypassEnabled
Gets a value indicating whether the staff bypass is enabled.
public bool IsStaffBypassEnabled { get; }
Property Value
IsTransmitting
Gets a value indicating whether the player is transmitting on a Radio.
public bool IsTransmitting { get; }
Property Value
IsTutorial
Gets a value indicating whether the player's PlayerRoles.RoleTypeId is equal to PlayerRoles.RoleTypeId.Tutorial.
public bool IsTutorial { get; }
Property Value
IsUsingStamina
Gets or sets a value indicating whether the player should use stamina system.
public bool IsUsingStamina { get; set; }
Property Value
IsVerified
Gets a value indicating whether the player is verified.
public bool IsVerified { get; }
Property Value
Remarks
IsWhitelisted
Gets a value indicating whether the player is in whitelist.
public bool IsWhitelisted { get; }
Property Value
Remarks
It will always return true if a whitelist is disabled on the server.
- See Also
Items
Gets the player's items.
public IReadOnlyCollection<Item> Items { get; }
Property Value
KickPower
Gets a value indicating a player's kick power.
public byte KickPower { get; }
Property Value
LeadingTeam
Gets the player's LeadingTeam.
public LeadingTeam LeadingTeam { get; }
Property Value
Lift
public Lift Lift { get; }
Property Value
List
Gets a list of all Player's on the server.
public static IReadOnlyCollection<Player> List { get; }
Property Value
MaxArtificialHealth
Gets or sets the player's maximum artificial health.
public float MaxArtificialHealth { get; set; }
Property Value
MaxHealth
Gets or sets the player's maximum health.
public float MaxHealth { get; set; }
Property Value
MaxHumeShield
Gets or sets the players maximum Hume Shield.
public float MaxHumeShield { get; set; }
Property Value
NetId
Gets the player's net ID.
public uint NetId { get; }
Property Value
NetworkIdentity
Gets the player's Mirror.NetworkIdentity.
public NetworkIdentity NetworkIdentity { get; }
Property Value
- NetworkIdentity
Nickname
Gets the player's nickname.
public string Nickname { get; }
Property Value
Ping
Gets the player's ping.
public int Ping { get; }
Property Value
Position
Gets or sets the player's position.
public virtual Vector3 Position { get; set; }
Property Value
- Vector3
- See Also
Preferences
Gets a Dictionary<TKey, TValue> which contains all player's preferences.
public Dictionary<FirearmType, AttachmentIdentifier[]> Preferences { get; }
Property Value
PreviousRole
Gets the role that player had before changing role.
public RoleTypeId PreviousRole { get; }
Property Value
- RoleTypeId
RadioPlayback
Gets the ReferenceHub's VoiceChat.Playbacks.PersonalRadioPlayback, can be null.
public PersonalRadioPlayback RadioPlayback { get; }
Property Value
- PersonalRadioPlayback
RankColor
Gets or sets the player's rank color.
public string RankColor { get; set; }
Property Value
RankName
Gets or sets the player's rank name.
public string RankName { get; set; }
Property Value
RawUserId
Gets the player's user id without the authentication.
public string RawUserId { get; }
Property Value
ReferenceHub
Gets the encapsulated ReferenceHub.
public ReferenceHub ReferenceHub { get; }
Property Value
- ReferenceHub
RelativePosition
Gets or sets the relative player's position.
public RelativePosition RelativePosition { get; set; }
Property Value
- RelativePosition
Remarks
The value will be default if the player's role is not an FpcRole.
RemoteAdminAccess
Gets a value indicating whether the player has Remote Admin access.
public bool RemoteAdminAccess { get; }
Property Value
RemoteAdminPermissions
Gets or sets a value indicating the actual RA permissions.
public PlayerPermissions RemoteAdminPermissions { get; set; }
Property Value
- PlayerPermissions
Role
Gets a Role that is unique to this player and this class. This allows modification of various aspects related to the role solely.
The type of the Role is different based on the PlayerRoles.RoleTypeId of the player, and casting should be used to modify the role.
PlayerRoles.RoleTypeId.Spectator = SpectatorRole.
PlayerRoles.RoleTypeId.Overwatch = OverwatchRole.
PlayerRoles.RoleTypeId.None = NoneRole.
PlayerRoles.RoleTypeId.Scp049 = Scp049Role.
PlayerRoles.RoleTypeId.Scp0492 = Scp0492Role.
PlayerRoles.RoleTypeId.Scp079 = Scp079Role.
PlayerRoles.RoleTypeId.Scp096 = Scp096Role.
PlayerRoles.RoleTypeId.Scp106 = Scp106Role.
PlayerRoles.RoleTypeId.Scp173 = Scp173Role.
PlayerRoles.RoleTypeId.Scp3114 = Scp3114Role.
PlayerRoles.RoleTypeId.Scp939 = Scp939Role.
If not listed above, the type of Role will be HumanRole.
If the role object is stored, it may become invalid if the player changes roles. Thus, the IsValid property can be checked. If this property is false, the role should be discarded and this property should be used again to get the new Role. This role is automatically cached until it changes, and it is recommended to use this property directly rather than storing the property yourself.
Roles and RoleTypeIds can be compared directly. Player.Role == RoleTypeId.Scp079
is valid and will return true if the player is SCP-079. To set the player's role, see Set(RoleTypeId, SpawnReason, RoleSpawnFlags).
public Role Role { get; }
Property Value
- See Also
RoleManager
Gets the PlayerRoles.PlayerRoleManager.
public PlayerRoleManager RoleManager { get; }
Property Value
- PlayerRoleManager
Rotation
Gets or sets the player's rotation.
public Quaternion Rotation { get; set; }
Property Value
- Quaternion
Returns the direction the player is looking at.
Scale
Gets or sets the player's scale.
public Vector3 Scale { get; set; }
Property Value
- Vector3
ScpPreferences
Gets or sets the player's SCP preferences.
public ScpSpawnPreferences.SpawnPreferences ScpPreferences { get; set; }
Property Value
- ScpSpawnPreferences.SpawnPreferences
Sender
Gets the player's command sender instance.
public PlayerCommandSender Sender { get; }
Property Value
- PlayerCommandSender
SessionVariables
Gets the dictionary of the player's session variables.
Session variables can be used to save temporary data on players. Data is stored in a Dictionary<TKey, TValue>. The key of the data is always a string, whereas the value can be any object. The data stored in a player's session variables can be accessed by different assemblies; it is recommended to uniquely identify stored data so that it does not conflict with other plugins that may also be using the same name. Data saved with session variables is not being saved on player disconnect. If the data must be saved after the player's disconnects, a database must be used instead.
public Dictionary<string, object> SessionVariables { get; }
Property Value
Stamina
Gets or sets the amount of stamina the player has.
public float Stamina { get; set; }
Property Value
Remarks
This will always be a value between 0-1
, 0
representing no stamina and 1
representing maximum stamina.
StaminaStat
Gets the StaminaStat class.
public StaminaStat StaminaStat { get; }
Property Value
- StaminaStat
Transform
Gets the ReferenceHub's UnityEngine.Transform.
public Transform Transform { get; }
Property Value
- Transform
UniqueRole
Gets or sets a unique custom role that does not abide to base game for this player. Used in conjunction with CustomRoleFriendlyFireMultiplier.
public string UniqueRole { get; set; }
Property Value
UnitId
Gets or sets the player's unit id.
public byte UnitId { get; set; }
Property Value
UnitName
Gets the player's unit name.
public string UnitName { get; }
Property Value
UserId
Gets the player's user id.
public string UserId { get; }
Property Value
UserIdsCache
Gets a Dictionary<TKey, TValue> containing cached Player and their user ids.
public static Dictionary<string, Player> UserIdsCache { get; }
Property Value
Velocity
Gets the Player's current movement speed.
public Vector3 Velocity { get; }
Property Value
- Vector3
VoiceChannel
Gets or sets the player's voice channel.
public VoiceChatChannel VoiceChannel { get; set; }
Property Value
- VoiceChatChannel
VoiceChatMuteFlags
Gets or sets the player's VoiceChat.VcMuteFlags.
public VcMuteFlags VoiceChatMuteFlags { get; set; }
Property Value
- VcMuteFlags
VoiceColor
Gets the player's voice color.
public Color VoiceColor { get; }
Property Value
- Color
Zone
Gets the current zone the player is in.
public ZoneType Zone { get; }
Property Value
Methods
AddAhp(float, float, float, float, float, bool)
Gives a new to the player.
public void AddAhp(float amount, float limit = 75, float decay = 1.2, float efficacy = 0.7, float sustain = 0, bool persistant = false)
Parameters
amount
floatThe amount to give the player.
limit
floatThe maximum AHP for this stat.
decay
floatHow much value is lost per second.
efficacy
floatPercent of incoming damage absorbed by this stat.
sustain
floatThe number of seconds to delay the start of the decay.
persistant
boolWhether the process is removed when the value hits 0.
AddAmmo(AmmoType, ushort)
Adds the amount of a specified ammo type to the player's inventory.
public void AddAmmo(AmmoType ammoType, ushort amount)
Parameters
AddAmmo(FirearmType, ushort)
Adds the amount of a weapon's ammo type to the player's inventory.
public void AddAmmo(FirearmType weaponType, ushort amount)
Parameters
weaponType
FirearmTypeThe ItemType of the weapon.
amount
ushortThe amount of ammo to be added.
AddAmmo(Dictionary<AmmoType, ushort>)
Adds the amount of a specified ammo type to player's inventory.
public void AddAmmo(Dictionary<AmmoType, ushort> ammoBag)
Parameters
ammoBag
Dictionary<AmmoType, ushort>A dictionary of ammo types that will be added.
AddAmmo(Dictionary<ItemType, ushort>)
Adds the amount of a specified ammo to player's inventory.
public void AddAmmo(Dictionary<ItemType, ushort> ammo)
Parameters
ammo
Dictionary<ItemType, ushort>A dictionary of ItemType and ushort of ammo and amount.
AddComponent(Type, string)
Adds a component to the IEntity.
public EActor AddComponent(Type type, string name = "")
Parameters
Returns
AddComponent<T>(string)
Adds a component to the IEntity.
public T AddComponent<T>(string name = "") where T : EActor
Parameters
name
stringThe name of the component.
Returns
- T
The added EActor component.
Type Parameters
T
The
T
EActor to be added.
AddComponent<T>(Type, string)
Adds a component from the IEntity.
public T AddComponent<T>(Type type, string name = "") where T : EActor
Parameters
Returns
- T
The added EActor component.
Type Parameters
T
The
T
cast EActor type.
AddItem(FirearmType, IEnumerable<AttachmentIdentifier>)
Adds an firearm of the specified type with default durability(ammo/charge) and no mods to the player's inventory.
public Item AddItem(FirearmType firearmType, IEnumerable<AttachmentIdentifier> identifiers)
Parameters
firearmType
FirearmTypeThe firearm to be added.
identifiers
IEnumerable<AttachmentIdentifier>The attachments to be added to the item.
Returns
AddItem(FirearmType, int, IEnumerable<AttachmentIdentifier>)
Adds the amount of firearms of the specified type with default durability(ammo/charge) and no mods to the player's inventory.
public IEnumerable<Item> AddItem(FirearmType firearmType, int amount, IEnumerable<AttachmentIdentifier> identifiers)
Parameters
firearmType
FirearmTypeThe item to be added.
amount
intThe amount of items to be added.
identifiers
IEnumerable<AttachmentIdentifier>The attachments to be added to the item.
Returns
- IEnumerable<Item>
An IEnumerable<T> containing the items given.
AddItem(Firearm, IEnumerable<AttachmentIdentifier>)
Adds an item to the player's inventory.
public void AddItem(Firearm item, IEnumerable<AttachmentIdentifier> identifiers)
Parameters
item
FirearmThe item to be added.
identifiers
IEnumerable<AttachmentIdentifier>The attachments to be added to the item.
AddItem(Item)
Adds an item to the player's inventory.
public void AddItem(Item item)
Parameters
item
ItemThe item to be added.
AddItem(FirearmPickup, IEnumerable<AttachmentIdentifier>)
Adds an item to the player's inventory.
public Item AddItem(FirearmPickup pickup, IEnumerable<AttachmentIdentifier> identifiers)
Parameters
pickup
FirearmPickupThe FirearmPickup of the item to be added.
identifiers
IEnumerable<AttachmentIdentifier>The attachments to be added to Pickup of the item.
Returns
AddItem(Pickup, ItemAddReason)
Adds an item to the player's inventory.
public Item AddItem(Pickup pickup, ItemAddReason addReason = ItemAddReason.AdminCommand)
Parameters
pickup
PickupThe Pickup of the item to be added.
addReason
ItemAddReasonThe reason the item was added.
Returns
AddItem(ItemBase, Item, ItemAddReason)
Adds an item to the player's inventory.
public Item AddItem(ItemBase itemBase, Item item = null, ItemAddReason addReason = ItemAddReason.AdminCommand)
Parameters
itemBase
ItemBaseThe item to be added.
item
ItemThe Item object of the item.
addReason
ItemAddReasonThe reason the item was added.
Returns
AddItem(ItemType)
Adds an item of the specified type with default durability(ammo/charge) and no mods to the player's inventory.
public Item AddItem(ItemType itemType)
Parameters
itemType
ItemTypeThe item to be added.
Returns
AddItem(ItemType, int)
Adds the amount of items of the specified type with default durability(ammo/charge) and no mods to the player's inventory.
public IEnumerable<Item> AddItem(ItemType itemType, int amount)
Parameters
itemType
ItemTypeThe item to be added.
amount
intThe amount of items to be added.
Returns
- IEnumerable<Item>
An IEnumerable<T> containing the items given.
AddItem(Dictionary<FirearmType, IEnumerable<AttachmentIdentifier>>)
Adds the list of items of the specified type with default durability(ammo/charge) and no mods to the player's inventory.
public IEnumerable<Item> AddItem(Dictionary<FirearmType, IEnumerable<AttachmentIdentifier>> items)
Parameters
items
Dictionary<FirearmType, IEnumerable<AttachmentIdentifier>>The Dictionary<TKey, TValue> of ItemType and IEnumerable<T> of AttachmentIdentifier to be added.
Returns
- IEnumerable<Item>
An IEnumerable<T> containing the items given.
AddItem(Dictionary<Firearm, IEnumerable<AttachmentIdentifier>>)
Adds the list of items to the player's inventory.
public void AddItem(Dictionary<Firearm, IEnumerable<AttachmentIdentifier>> firearms)
Parameters
firearms
Dictionary<Firearm, IEnumerable<AttachmentIdentifier>>The Dictionary<TKey, TValue> of Firearm and IEnumerable<T> of AttachmentIdentifier to be added.
AddItem(IEnumerable<Item>)
Adds the list of items to the player's inventory.
public void AddItem(IEnumerable<Item> items)
Parameters
items
IEnumerable<Item>The list of items to be added.
AddItem(IEnumerable<ItemType>)
Adds the list of items of the specified type with default durability(ammo/charge) and no mods to the player's inventory.
public IEnumerable<Item> AddItem(IEnumerable<ItemType> items)
Parameters
items
IEnumerable<ItemType>The list of items to be added.
Returns
- IEnumerable<Item>
An IEnumerable<T> containing the items given.
AddReservedSlot(string, bool)
Adds a player's UserId to the list of reserved slots.
public static bool AddReservedSlot(string userId, bool isPermanent)
Parameters
userId
stringThe UserId of the player to add.
isPermanent
boolWhether to add a
userId
permanently. It will write auserId
to UserIDReservedSlots.txt file.
Returns
- bool
true if the slot was successfully added, or false if the provided UserId already has a reserved slot.
- See Also
AddToWhitelist(string, bool)
Adds a player's UserId to the whitelist.
public static bool AddToWhitelist(string userId, bool isPermanent)
Parameters
userId
stringThe UserId of the player to add.
isPermanent
boolWhether to add a
userId
permanently. It will write auserId
to UserIDWhitelist.txt file.
Returns
- bool
true if the record was successfully added, or false if the provided UserId already is in whitelist.
- See Also
ApplyRandomEffect(EffectCategory, byte, float, bool)
Enables a random EffectType on the player.
public EffectType ApplyRandomEffect(EffectCategory category, byte intensity, float duration = 0, bool addDurationIfActive = false)
Parameters
category
EffectCategoryAn optional category to filter the applied effect. Set to None for any effect.
intensity
byteThe intensity of the effect will be active for.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- EffectType
A EffectType that was given to the player.
ApplyRandomEffect(EffectCategory, float, bool)
Enables a random EffectType on the player.
public EffectType ApplyRandomEffect(EffectCategory category = EffectCategory.None, float duration = 0, bool addDurationIfActive = false)
Parameters
category
EffectCategoryAn optional category to filter the applied effect. Set to None for any effect.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- EffectType
A EffectType that was given to the player.
Ban(int, string, Player)
Bans the player.
public void Ban(int duration, string reason, Player issuer = null)
Parameters
duration
intThe ban duration, in seconds.
reason
stringThe ban reason.
issuer
PlayerThe ban issuer.
Ban(TimeSpan, string, Player)
Bans the player.
public void Ban(TimeSpan duration, string reason, Player issuer = null)
Parameters
duration
TimeSpanThe length of time to ban.
reason
stringThe ban reason.
issuer
PlayerThe ban issuer.
BlinkTag()
Blink the player's tag.
public IEnumerator<float> BlinkTag()
Returns
- IEnumerator<float>
Used to wait.
Broadcast(Broadcast, bool)
Broadcasts the given Broadcast to the player.
public void Broadcast(Broadcast broadcast, bool shouldClearPrevious = false)
Parameters
broadcast
BroadcastThe Broadcast to be broadcasted.
shouldClearPrevious
boolClears all player's broadcasts before sending the new one.
Broadcast(ushort, string, BroadcastFlags, bool)
Shows a broadcast to the player. Doesn't get logged to the console and can be monospaced.
public void Broadcast(ushort duration, string message, Broadcast.BroadcastFlags type = BroadcastFlags.Normal, bool shouldClearPrevious = false)
Parameters
duration
ushortThe broadcast duration.
message
stringThe message to be broadcasted.
type
Broadcast.BroadcastFlagsThe broadcast type.
shouldClearPrevious
boolClears all player's broadcasts before sending the new one.
ChangeEffectIntensity(EffectType, byte, float)
Changes the intensity of a CustomPlayerEffects.StatusEffectBase.
public void ChangeEffectIntensity(EffectType type, byte intensity, float duration = 0)
Parameters
type
EffectTypeThe EffectType to change.
intensity
byteThe new intensity to use.
duration
floatThe new duration to add to the effect.
ChangeEffectIntensity(string, byte, float)
Changes the intensity of a status effect.
public void ChangeEffectIntensity(string effectName, byte intensity, float duration = 0)
Parameters
effectName
stringThe name of the CustomPlayerEffects.StatusEffectBase to enable.
intensity
byteThe intensity of the effect.
duration
floatThe new length of the effect. Defaults to infinite length.
ChangeEffectIntensity<T>(byte, float)
Changes the intensity of a status effect.
public void ChangeEffectIntensity<T>(byte intensity, float duration = 0) where T : StatusEffectBase
Parameters
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to change the intensity of.
ClearAmmo()
Clears all ammo in the inventory.
public void ClearAmmo()
- See Also
ClearBroadcasts()
Clears the player's brodcast. Doesn't get logged to the console.
public void ClearBroadcasts()
ClearInventory(bool)
Clears the player's inventory, including all ammo and items.
public void ClearInventory(bool destroy = true)
Parameters
destroy
boolWhether to fully destroy the old items.
- See Also
ClearItems(bool)
Clears the player's items.
public void ClearItems(bool destroy = true)
Parameters
destroy
boolWhether to fully destroy the old items.
- See Also
CountItem(ProjectileType)
Counts how many items of a certain ProjectileType a player has.
public int CountItem(ProjectileType grenadeType)
Parameters
grenadeType
ProjectileTypeThe ProjectileType to search for.
Returns
- int
How many items of that ProjectileType the player has.
- See Also
CountItem(ItemCategory)
Counts how many items of a certain ItemCategory a player has.
public int CountItem(ItemCategory category)
Parameters
category
ItemCategoryThe category to search for.
Returns
- int
How many items of that ItemCategory the player has.
- See Also
CountItem(ItemType)
Counts how many items of a certain ItemType a player has.
public int CountItem(ItemType item)
Parameters
item
ItemTypeThe item to search for.
Returns
- int
How many items of that ItemType the player has.
Remarks
For counting ammo, see GetAmmo(AmmoType).
- See Also
DisableAllEffects()
Disables all currently active status effects.
public void DisableAllEffects()
- See Also
DisableAllEffects(EffectCategory)
Disables all currently active status effects.
public void DisableAllEffects(EffectCategory category)
Parameters
category
EffectCategoryA category to filter the disabled effects.
- See Also
DisableEffect(EffectType)
Disables a specific status effect on the player.
public void DisableEffect(EffectType effect)
Parameters
effect
EffectTypeThe EffectType to disable.
DisableEffect<T>()
Disables a specific status effect on the player.
public void DisableEffect<T>() where T : StatusEffectBase
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to disable.
DisableEffects(IEnumerable<EffectType>)
Disables a IEnumerable<T> of EffectType on the player.
public void DisableEffects(IEnumerable<EffectType> effects)
Parameters
effects
IEnumerable<EffectType>The IEnumerable<T> of EffectType to disable.
Disconnect(string)
Disconnects the player.
public void Disconnect(string reason = null)
Parameters
reason
stringThe disconnection reason.
DropAmmo(AmmoType, ushort, bool)
Drops a specific AmmoType out of the player's inventory.
public bool DropAmmo(AmmoType ammoType, ushort amount, bool checkMinimals = false)
Parameters
ammoType
AmmoTypeThe AmmoType that will be dropped.
amount
ushortThe amount of ammo that will be dropped.
checkMinimals
boolWhether ammo limits will be taken into consideration.
Returns
DropHeldItem()
Drops the held item. Will not do anything if the player is not holding an item.
public Pickup DropHeldItem()
Returns
- See Also
DropHeldItem(bool)
Drops the held item. Will not do anything if the player is not holding an item.
public void DropHeldItem(bool isThrown = false)
Parameters
isThrown
boolIs the item Thrown?.
DropItem(Item)
Drops an item from the player's inventory.
public Pickup DropItem(Item item)
Parameters
Returns
DropItem(Item, bool)
Drops an item from the player's inventory.
public void DropItem(Item item, bool isThrown = false)
Parameters
DropItems()
Drops all items in the player's inventory, including all ammo and items.
public void DropItems()
- See Also
EnableEffect(StatusEffectBase, byte, float, bool)
Enables a status effect on the player.
public bool EnableEffect(StatusEffectBase statusEffect, byte intensity, float duration = 0, bool addDurationIfActive = false)
Parameters
statusEffect
StatusEffectBaseThe name of the CustomPlayerEffects.StatusEffectBase to enable.
intensity
byteThe intensity of the effect will be active for.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- bool
A bool indicating whether the effect was valid and successfully enabled.
EnableEffect(StatusEffectBase, float, bool)
Enables a status effect on the player.
public bool EnableEffect(StatusEffectBase statusEffect, float duration = 0, bool addDurationIfActive = false)
Parameters
statusEffect
StatusEffectBaseThe name of the CustomPlayerEffects.StatusEffectBase to enable.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- bool
A bool indicating whether the effect was valid and successfully enabled.
EnableEffect(EffectType, byte, float, bool)
Enables a status effect on the player.
public bool EnableEffect(EffectType type, byte intensity, float duration = 0, bool addDurationIfActive = false)
Parameters
type
EffectTypeThe EffectType to enable.
intensity
byteThe intensity of the effect will be active for.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- bool
A bool indicating whether the effect was valid and successfully enabled.
EnableEffect(EffectType, float, bool)
Enables a status effect on the player.
public void EnableEffect(EffectType type, float duration = 0, bool addDurationIfActive = false)
Parameters
type
EffectTypeThe EffectType to enable.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
EnableEffect(string, byte, float, bool)
Enables a status effect on the player.
public StatusEffectBase EnableEffect(string effectName, byte intensity, float duration = 0, bool addDurationIfActive = false)
Parameters
effectName
stringThe name of the CustomPlayerEffects.StatusEffectBase to enable.
intensity
byteThe intensity of the effect will be active for.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- StatusEffectBase
The CustomPlayerEffects.StatusEffectBase instance of the activated effect.
EnableEffect(string, float, bool)
Enables a status effect on the player.
public StatusEffectBase EnableEffect(string effectName, float duration = 0, bool addDurationIfActive = false)
Parameters
effectName
stringThe name of the CustomPlayerEffects.StatusEffectBase to enable.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- StatusEffectBase
The CustomPlayerEffects.StatusEffectBase instance of the activated effect.
EnableEffect<T>(byte, float, bool)
Enables a status effect on the player.
public bool EnableEffect<T>(byte intensity, float duration = 0, bool addDurationIfActive = false) where T : StatusEffectBase
Parameters
intensity
byteThe intensity of the effect will be active for.
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- bool
A bool indicating whether the effect was valid and successfully enabled.
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to enable.
EnableEffect<T>(float, bool)
Enables a status effect on the player.
public bool EnableEffect<T>(float duration = 0, bool addDurationIfActive = false) where T : StatusEffectBase
Parameters
duration
floatThe amount of time the effect will be active for.
addDurationIfActive
boolIf the effect is already active, setting to true will add this duration onto the effect.
Returns
- bool
A bool indicating whether the effect was valid and successfully enabled.
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to enable.
EnableEffects(IEnumerable<EffectType>, float, bool)
Enables a IEnumerable<T> of EffectType on the player.
public void EnableEffects(IEnumerable<EffectType> types, float duration = 0, bool addDurationIfActive = false)
Parameters
types
IEnumerable<EffectType>The IEnumerable<T> of EffectType to enable.
duration
floatThe amount of time the effects will be active for.
addDurationIfActive
boolIf an effect is already active, setting to true will add this duration onto the effect.
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
Explode()
Explode the player.
public void Explode()
Explode(ProjectileType, Player)
Explode the player.
public void Explode(ProjectileType projectileType, Player attacker = null)
Parameters
projectileType
ProjectileTypeThe projectile that will create the explosion.
attacker
PlayerThe Player that will causing the explosion.
ExplodeEffect(ProjectileType)
Spawn projectile effect on the player.
public void ExplodeEffect(ProjectileType projectileType)
Parameters
projectileType
ProjectileTypeThe projectile that will create the effect.
~Player()
Finalizes an instance of the Player class.
protected ~Player()
Get(CommandSender)
Gets the Player belonging to the CommandSender, if any.
public static Player Get(CommandSender sender)
Parameters
sender
CommandSenderThe command sender.
Returns
Get(ICommandSender)
Gets the Player belonging to the CommandSystem.ICommandSender, if any.
public static Player Get(ICommandSender sender)
Parameters
sender
ICommandSenderThe command sender.
Returns
Get(Side)
Gets a Player IEnumerable<T> filtered by side. Can be empty.
public static IEnumerable<Player> Get(Side side)
Parameters
side
SideThe players' side.
Returns
- IEnumerable<Player>
The filtered IEnumerable<T>.
Get(Footprint)
Gets the Player belonging to the Footprinting.Footprint, if any.
public static Player Get(Footprint footprint)
Parameters
footprint
FootprintThe Footprint.
Returns
Get(NetworkConnection)
Gets the Player belonging to a specific Mirror.NetworkConnection, if any.
public static Player Get(NetworkConnection conn)
Parameters
conn
NetworkConnectionThe player's Mirror.NetworkConnection.
Returns
Get(NetworkIdentity)
Gets the Player belonging to a specific Mirror.NetworkIdentity, if any.
public static Player Get(NetworkIdentity netIdentity)
Parameters
netIdentity
NetworkIdentityThe player's Mirror.NetworkIdentity.
Returns
Get(RoleTypeId)
Gets a Player IEnumerable<T> filtered by role. Can be empty.
public static IEnumerable<Player> Get(RoleTypeId role)
Parameters
role
RoleTypeIdThe players' role.
Returns
- IEnumerable<Player>
The filtered IEnumerable<T>.
Get(Team)
Gets a Player IEnumerable<T> filtered by team. Can be empty.
public static IEnumerable<Player> Get(Team team)
Parameters
team
TeamThe players' team.
Returns
- IEnumerable<Player>
The filtered IEnumerable<T>.
Get(Player)
Gets the Player from NwPluginAPI class.
public static Player Get(Player apiPlayer)
Parameters
apiPlayer
PlayerThe PluginAPI.Core.Player class.
Returns
Get(ReferenceHub)
Gets the Player belonging to the ReferenceHub, if any.
public static Player Get(ReferenceHub referenceHub)
Parameters
referenceHub
ReferenceHubThe player's ReferenceHub.
Returns
Get(Func<Player, bool>)
Gets a IEnumerable<T> of Player filtered based on a predicate.
public static IEnumerable<Player> Get(Func<Player, bool> predicate)
Parameters
Returns
- IEnumerable<Player>
A IEnumerable<T> of Player which contains elements that satisfy the condition.
Get(int)
Gets the player belonging to the specified id.
public static Player Get(int id)
Parameters
id
intThe player id.
Returns
Get(string)
Gets the Player by identifier.
public static Player Get(string args)
Parameters
args
stringThe player's nickname, ID, steamID64 or Discord ID.
Returns
Get(uint)
Gets the Player belonging to a specific netId, if any.
public static Player Get(uint netId)
Parameters
netId
uintThe player's Mirror.NetworkIdentity.netId.
Returns
Get(Collider)
Gets the Player belonging to the UnityEngine.Collider, if any.
public static Player Get(Collider collider)
Parameters
collider
ColliderUnityEngine.Collider.
Returns
Get(GameObject)
Gets the Player belonging to the UnityEngine.GameObject, if any.
public static Player Get(GameObject gameObject)
Parameters
gameObject
GameObjectThe player's UnityEngine.GameObject.
Returns
GetAmmo(AmmoType)
Gets the ammo count of a specified ammo type in a player's inventory.
public ushort GetAmmo(AmmoType ammoType)
Parameters
Returns
GetAmmoLimit(AmmoType, bool)
Gets the maximum amount of ammo the player can hold, given the ammo AmmoType.
public ushort GetAmmoLimit(AmmoType type, bool ignoreArmor = false)
Parameters
type
AmmoTypeThe AmmoType of the ammo to check.
ignoreArmor
boolIf the method should ignore the armor the player is wearing.
Returns
- ushort
The maximum amount of ammo this player can carry.
GetCategoryLimit(ItemCategory, bool)
Gets the maximum amount of an ItemCategory the player can hold, based on the armor the player is wearing, as well as server configuration.
public sbyte GetCategoryLimit(ItemCategory category, bool ignoreArmor = false)
Parameters
category
ItemCategoryThe ItemCategory to check.
ignoreArmor
boolIf the method should ignore the armor the player is wearing.
Returns
- sbyte
The maximum amount of items in the category that the player can hold.
GetComponent(Type)
Gets a component from the IEntity.
public EActor GetComponent(Type type)
Parameters
Returns
GetComponent<T>()
Gets a component from the IEntity.
public T GetComponent<T>() where T : EActor
Returns
- T
The EActor component.
Type Parameters
T
The
T
EActor to look for.
GetComponent<T>(Type)
Gets a component from the IEntity.
public T GetComponent<T>(Type type) where T : EActor
Parameters
Returns
- T
The EActor component.
Type Parameters
T
The cast
T
EActor.
GetCooldownItem(ItemType)
Get the time cooldown on this ItemType.
public float GetCooldownItem(ItemType itemType)
Parameters
itemType
ItemTypeThe itemtypes to choose for getting cooldown.
Returns
- float
Return the time in seconds of the cooldowns.
GetDanger(DangerType)
Gets an instance of CustomPlayerEffects.Danger.DangerStackBase by DangerType if the Scp1853 effect is enabled or null if it is not enabled.
public DangerStackBase GetDanger(DangerType dangerType)
Parameters
dangerType
DangerTypeThe DangerType.
Returns
- DangerStackBase
The CustomPlayerEffects.Danger.DangerStackBase.
GetEffect(EffectType)
Gets an instance of CustomPlayerEffects.StatusEffectBase by EffectType.
public StatusEffectBase GetEffect(EffectType effectType)
Parameters
effectType
EffectTypeThe EffectType.
Returns
- StatusEffectBase
The CustomPlayerEffects.StatusEffectBase.
GetEffectIntensity<T>()
Gets a byte indicating the intensity of the given CustomPlayerEffects.StatusEffectBase.
public byte GetEffectIntensity<T>() where T : StatusEffectBase
Returns
- byte
The intensity of the effect.
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to check.
Exceptions
- ArgumentException
Thrown if the given type is not a valid CustomPlayerEffects.StatusEffectBase.
GetEffect<T>()
Gets an effect of a player.
public T GetEffect<T>() where T : StatusEffectBase
Returns
- T
The CustomPlayerEffects.StatusEffectBase found.
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to get.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetModule<T>()
Gets a PlayerStatsSystem.StatBase module from the player's PlayerStatsSystem.PlayerStats component.
public T GetModule<T>() where T : StatBase
Returns
- T
The
T
module that was requested.
Type Parameters
T
The returned object type.
GetNearCameras(float)
Gets all the near cameras.
public IEnumerable<Camera> GetNearCameras(float toleration = 15)
Parameters
toleration
floatThe maximum toleration to define the radius from which get the cameras.
Returns
- IEnumerable<Camera>
A IEnumerable<T> of Camera which contains all the found cameras.
GetProcessedData(ArraySegment<string>, int)
Gets an IEnumerable<T> containing all players processed based on the arguments specified.
public static IEnumerable<Player> GetProcessedData(ArraySegment<string> args, int startIndex = 0)
Parameters
args
ArraySegment<string>The array segment of strings representing the input arguments to be processed.
startIndex
intThe starting index within the array segment.
Returns
- IEnumerable<Player>
An IEnumerable<T> representing the processed players.
GetProcessedData(ArraySegment<string>, int, out string[], bool)
Gets an IEnumerable<T> containing all players processed based on the arguments specified.
public static IEnumerable<Player> GetProcessedData(ArraySegment<string> args, int startIndex, out string[] newargs, bool keepEmptyEntries = false)
Parameters
args
ArraySegment<string>The array segment of strings representing the input arguments to be processed.
startIndex
intThe starting index within the array segment.
newargs
string[]Contains the updated arguments after processing.
keepEmptyEntries
boolDetermines whether empty entries should be kept in the result.
Returns
- IEnumerable<Player>
An IEnumerable<T> representing the processed players.
GetScpPreference(RoleTypeId)
Gets a user's SCP preference.
public int GetScpPreference(RoleTypeId roleType)
Parameters
roleType
RoleTypeIdThe SCP RoleType.
Returns
- int
A value from
-5
to5
, representing a player's preference to play as the provided SCP. Will return0
for invalid SCPs.
GiveReservedSlot(bool)
Adds a player's UserId to the list of reserved slots.
public bool GiveReservedSlot(bool isPermanent)
Parameters
isPermanent
boolWhether to add a player's UserId permanently. It will write a player's UserId to UserIDReservedSlots.txt file.
Returns
- bool
true if the slot was successfully added, or false if the provided UserId already has a reserved slot.
- See Also
GrantLoadout()
Grants the player their current role's loadout.
public void GrantLoadout()
GrantLoadout(RoleTypeId)
Grants a player a role's loadout.
public void GrantLoadout(RoleTypeId roleType)
Parameters
roleType
RoleTypeIdThe role loadout to give.
GrantWhitelist(bool)
Adds a player's UserId to the whitelist.
public bool GrantWhitelist(bool isPermanent)
Parameters
isPermanent
boolWhether to add a player's UserId permanently. It will write a player's UserId to UserIDWhitelist.txt file.
Returns
- bool
true if the record was successfully added, or false if the provided UserId already is in whitelist.
- See Also
Handcuff()
Handcuff the player as administrator.
public void Handcuff()
Handcuff(Player)
Handcuff the player.
public void Handcuff(Player cuffer)
Parameters
cuffer
PlayerThe cuffer player.
HasComponent(Type, bool)
Checks if the IEntity has an active component.
public bool HasComponent(Type type, bool depthInheritance = false)
Parameters
type
TypeThe EActor to look for.
depthInheritance
boolA value indicating whether subclasses should be considered.
Returns
HasComponent<T>(bool)
Checks if the IEntity has an active component.
public bool HasComponent<T>(bool depthInheritance = false)
Parameters
depthInheritance
boolA value indicating whether subclasses should be considered.
Returns
Type Parameters
T
The EActor to look for.
HasCustomAmmoLimit(AmmoType)
Check if the player has a custom limit for a specific AmmoType.
public bool HasCustomAmmoLimit(AmmoType ammoType)
Parameters
Returns
HasCustomCategoryLimit(ItemCategory)
Check if the player has a custom limit for a specific ItemCategory.
public bool HasCustomCategoryLimit(ItemCategory category)
Parameters
category
ItemCategoryThe ItemCategory to check.
Returns
- bool
If the player has a custom limit for the specific ItemCategory.
HasItem(Item)
Indicates whether the player has an item.
public bool HasItem(Item item)
Parameters
item
ItemThe item to search for.
Returns
HasItem(ItemType)
Indicates whether the player has an item type.
public bool HasItem(ItemType type)
Parameters
type
ItemTypeThe type to search for.
Returns
Heal(float, bool)
Heals the player.
public void Heal(float amount, bool overrideMaxHealth = false)
Parameters
amount
floatThe amount of health to heal.
overrideMaxHealth
boolWhether healing should exceed their max health.
Hurt(Player, float, DamageType, CassieAnnouncement)
Hurts the player.
public void Hurt(Player attacker, float amount, DamageType damageType = DamageType.Unknown, DamageHandlerBase.CassieAnnouncement cassieAnnouncement = null)
Parameters
attacker
PlayerThe Player attacking player.
amount
floatThe float amount of damage to deal.
damageType
DamageTypeThe DamageType of the damage dealt.
cassieAnnouncement
DamageHandlerBase.CassieAnnouncementThe DamageHandlerBase.CassieAnnouncement cassie announcement to make if the damage kills the player.
Hurt(Player, float, DamageType, CassieAnnouncement, string)
Hurts the player.
public void Hurt(Player attacker, float amount, DamageType damageType = DamageType.Unknown, DamageHandlerBase.CassieAnnouncement cassieAnnouncement = null, string deathText = null)
Parameters
attacker
PlayerThe Player attacking player.
amount
floatThe float amount of damage to deal.
damageType
DamageTypeThe DamageType of the damage dealt.
cassieAnnouncement
DamageHandlerBase.CassieAnnouncementThe DamageHandlerBase.CassieAnnouncement cassie announcement to make if the damage kills the player.
deathText
string
Hurt(Player, float, Vector3, int)
Hurts the player.
public void Hurt(Player attacker, float damage, Vector3 force = default, int armorPenetration = 0)
Parameters
attacker
PlayerThe Player attacking player.
damage
floatThe float amount of damage to deal.
force
Vector3The throw force.
armorPenetration
intThe armor penetration amount.
Hurt(DamageHandlerBase)
Hurts the player.
public void Hurt(DamageHandlerBase damageHandlerBase)
Parameters
damageHandlerBase
DamageHandlerBaseThe PlayerStatsSystem.DamageHandlerBase used to deal damage.
Hurt(float, DamageType, string)
Hurts the player.
public void Hurt(float amount, DamageType damageType = DamageType.Unknown, string cassieAnnouncement = "")
Parameters
amount
floatThe float amount of damage to deal.
damageType
DamageTypeThe DamageType of the damage dealt.
cassieAnnouncement
stringThe string cassie announcement to make if the damage kills the player.
Hurt(float, string, string)
Hurts the player.
public void Hurt(float damage, string damageReason, string cassieAnnouncement = "")
Parameters
damage
floatThe amount of damage to deal.
damageReason
stringThe reason for the damage being dealt.
cassieAnnouncement
stringThe cassie announcement to make.
IsEffectActive<T>()
Gets a bool describing whether the given status effect is currently enabled.
public bool IsEffectActive<T>() where T : StatusEffectBase
Returns
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to check.
Kick(string, Player)
Kicks the player.
public void Kick(string reason, Player issuer = null)
Parameters
Kill(DamageType, string)
Kills the player.
public void Kill(DamageType damageType, string cassieAnnouncement = "")
Parameters
damageType
DamageTypeThe DamageType the player has been killed.
cassieAnnouncement
stringThe cassie announcement to make upon death.
Kill(DamageHandlerBase)
Kills the player.
public void Kill(DamageHandlerBase damageHandlerBase)
Parameters
damageHandlerBase
DamageHandlerBaseThe PlayerStatsSystem.DamageHandlerBase.
Kill(string, string)
Kills the player.
public void Kill(string deathReason, string cassieAnnouncement = "")
Parameters
deathReason
stringThe reason the player has been killed.
cassieAnnouncement
stringThe cassie announcement to make upon death.
Mute(bool)
Persistently mutes the player. For temporary mutes, see IsMuted and IsIntercomMuted.
public void Mute(bool isIntercom = false)
Parameters
isIntercom
boolWhether this mute is for the intercom only.
OpenReportWindow(string)
Opens the report window.
public void OpenReportWindow(string text)
Parameters
text
stringThe text to send.
PlaceBlood(Vector3)
Places a blood decal.
public void PlaceBlood(Vector3 direction)
Parameters
direction
Vector3The direction of the blood decal.
PlaceTantrum(bool)
Places a Tantrum (SCP-173's ability) under the player.
public TantrumHazard PlaceTantrum(bool isActive = true)
Parameters
Returns
- TantrumHazard
The TantrumHazard instance..
Remarks
If isActive
is true, the tantrum is moved slightly up from its original position. Otherwise, the collision will not be detected and the slowness will not work.
PlayGunSound(ItemType, byte, byte)
Plays a gun sound that only the player
can hear.
public void PlayGunSound(ItemType type, byte volume, byte audioClipId = 0)
Parameters
type
ItemTypevolume
byteSound's volume to set.
audioClipId
byteGunAudioMessage's audioClipId to set (default = 0).
PlayShieldBreakSound()
Plays the Hume Shield break sound effect from the player.
public void PlayShieldBreakSound()
Remarks
This will only function if the player's IsHumeShieldedRole is true.
RandomTeleport(IEnumerable<Type>)
Teleports the player to a random object.
public void RandomTeleport(IEnumerable<Type> types)
Parameters
types
IEnumerable<Type>The list of object types to choose from.
RandomTeleport(Type)
Teleports player to a random object of a specific type.
public void RandomTeleport(Type type)
Parameters
type
TypeObject for teleport.
RandomTeleport<T>()
Teleports player to a random object of a specific type.
public void RandomTeleport<T>()
Type Parameters
T
Object for teleport.
Reconnect(ushort, float, bool, RoundRestartType)
Reconnects the player to the server. Can be used to redirect them to another server on a different port but same IP.
public void Reconnect(ushort newPort = 0, float delay = 5, bool reconnect = true, RoundRestartType roundRestartType = RoundRestartType.FullRestart)
Parameters
newPort
ushortNew port.
delay
floatPlayer reconnection delay.
reconnect
boolWhether player should be reconnected.
roundRestartType
RoundRestartTypeType of round restart.
ReloadReservedSlots()
Reloads the reserved slot list, clearing all reserved slot changes made with add/remove methods and reverting to the reserved slots files.
public static void ReloadReservedSlots()
ReloadWeapon()
Forces the player to reload their current weapon.
public bool ReloadWeapon()
Returns
ReloadWhitelist()
Reloads the whitelist, clearing all whitelist changes made with add/remove methods and reverting to the whitelist files.
public static void ReloadWhitelist()
RemoteAdminMessage(string, bool, string)
Sends a message to the player's Remote Admin console.
public void RemoteAdminMessage(string message, bool success = true, string pluginName = null)
Parameters
message
stringThe message to be sent.
success
boolIndicates whether the message should be highlighted as success.
pluginName
stringThe plugin name.
RemoveHandcuffs()
Removes the player's handcuffs.
public void RemoveHandcuffs()
RemoveHeldItem(bool)
Removes the held InventorySystem.Items.ItemBase from the player's inventory.
public bool RemoveHeldItem(bool destroy = true)
Parameters
destroy
boolWhether to destroy the item.
Returns
- bool
Returns a value indicating whether the InventorySystem.Items.ItemBase was removed.
RemoveItem(Item, bool)
Removes an Item from the player's inventory.
public bool RemoveItem(Item item, bool destroy = true)
Parameters
Returns
RemoveItem(Func<Item, bool>, bool)
Removes all Item's that satisfy the condition from the player's inventory.
public int RemoveItem(Func<Item, bool> predicate, bool destroy = true)
Parameters
Returns
RemoveItem(ushort, bool)
Removes an Item from the player's inventory.
public bool RemoveItem(ushort serial, bool destroy = true)
Parameters
Returns
ResetAmmoLimit(AmmoType)
Reset a custom AmmoType limit.
public void ResetAmmoLimit(AmmoType ammoType)
Parameters
ResetCategoryLimit(ItemCategory)
Reset a custom ItemCategory limit. Only works with ItemCategory.Keycard, ItemCategory.Medical, ItemCategory.Firearm, ItemCategory.Grenade and ItemCategory.SCPItem.
public void ResetCategoryLimit(ItemCategory category)
Parameters
category
ItemCategoryThe ItemCategory of the category to reset.
ResetInventory(IEnumerable<Item>)
Resets the player's inventory to the provided list of items, clearing any items it already possess.
public void ResetInventory(IEnumerable<Item> newItems)
Parameters
newItems
IEnumerable<Item>The new items that have to be added to the inventory.
ResetInventory(IEnumerable<ItemType>)
Resets the player's inventory to the provided list of items, clearing any items it already possess.
public void ResetInventory(IEnumerable<ItemType> newItems)
Parameters
newItems
IEnumerable<ItemType>The new items that have to be added to the inventory.
ResetStamina()
Resets the Player's stamina.
public void ResetStamina()
SendConsoleMessage(string, string)
Sends a console message to the player's console.
public void SendConsoleMessage(string message, string color)
Parameters
SendStaffMessage(string, EncryptedChannel)
Sends a message to the player's Remote Admin Chat.
public bool SendStaffMessage(string message, EncryptedChannelManager.EncryptedChannel channel = EncryptedChannel.AdminChat)
Parameters
message
stringThe message to be sent.
channel
EncryptedChannelManager.EncryptedChannelIndicates whether the message should be highlighted as success.
Returns
SendStaffPing(string, EncryptedChannel)
Sends a message to the player's Remote Admin Chat.
public bool SendStaffPing(string message, EncryptedChannelManager.EncryptedChannel channel = EncryptedChannel.AdminChat)
Parameters
message
stringThe message to be sent.
channel
EncryptedChannelManager.EncryptedChannelIndicates whether the message should be highlighted as success.
Returns
SetAmmo(AmmoType, ushort)
Sets the amount of a specified ammo type to the player's inventory.
public void SetAmmo(AmmoType ammoType, ushort amount)
Parameters
SetAmmo(Dictionary<AmmoType, ushort>)
Sets the amount of a specified ammo type to player's inventory.
public void SetAmmo(Dictionary<AmmoType, ushort> ammoBag)
Parameters
ammoBag
Dictionary<AmmoType, ushort>A dictionary of ammo types that will be added.
SetAmmoLimit(AmmoType, ushort)
Gets the maximum amount of ammo the player can hold, given the ammo AmmoType. This limit will scale with the armor the player is wearing. For armor ammo limits, see AmmoLimits.
public void SetAmmoLimit(AmmoType ammoType, ushort limit)
Parameters
ammoType
AmmoTypeThe AmmoType of the ammo to check.
limit
ushortThe ushort number that will define the new limit.
SetCategoryLimit(ItemCategory, sbyte)
Set the maximum amount of an ItemCategory the player can hold. Only works with ItemCategory.Keycard, ItemCategory.Medical, ItemCategory.Firearm, ItemCategory.Grenade and ItemCategory.SCPItem. This limit will scale with the armor the player is wearing. For armor category limits, see CategoryLimits.
public void SetCategoryLimit(ItemCategory category, sbyte limit)
Parameters
category
ItemCategoryThe ItemCategory to check.
limit
sbyteThe int number that will define the new limit.
SetCooldownItem(float, ItemType)
Set the time cooldown on this ItemType.
public void SetCooldownItem(float time, ItemType itemType)
Parameters
time
floatThe times for the cooldown.
itemType
ItemTypeThe itemtypes to choose for being cooldown.
SetCustomRoleFriendlyFire(string, RoleTypeId, float)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules.
public void SetCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, float ffMult)
Parameters
roleTypeId
stringRole associated for CustomFF.
roleToAdd
RoleTypeIdRole to add.
ffMult
floatFriendly fire multiplier.
SetCustomRoleFriendlyFire(string, KeyValuePair<RoleTypeId, float>)
Wrapper to call SetCustomRoleFriendlyFire(string, RoleTypeId, float).
public void SetCustomRoleFriendlyFire(string roleTypeId, KeyValuePair<RoleTypeId, float> roleFf)
Parameters
roleTypeId
stringRole associated for CustomFF.
roleFf
KeyValuePair<RoleTypeId, float>Role with FF to add even if it exists.
SetFakeScale(Vector3, IEnumerable<Player>)
Sets the scale of the player for other players.
public void SetFakeScale(Vector3 fakeScale, IEnumerable<Player> viewers)
Parameters
fakeScale
Vector3The scale to set to.
viewers
IEnumerable<Player>Who should see the fake scale.
SetFriendlyFire(RoleTypeId, float)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules.
public void SetFriendlyFire(RoleTypeId roleToAdd, float ffMult)
Parameters
roleToAdd
RoleTypeIdRole to add.
ffMult
floatFriendly fire multiplier.
SetFriendlyFire(KeyValuePair<RoleTypeId, float>)
Wrapper to call SetFriendlyFire(RoleTypeId, float).
public void SetFriendlyFire(KeyValuePair<RoleTypeId, float> roleFF)
Parameters
roleFF
KeyValuePair<RoleTypeId, float>Role with FF to add even if it exists.
SetRank(string, UserGroup)
Sets the player's rank.
public void SetRank(string name, UserGroup group)
Parameters
name
stringThe rank name to be set.
group
UserGroupThe group to be set.
SetScale(Vector3, IEnumerable<Player>)
Sets the scale of a player on the server side.
public void SetScale(Vector3 scale, IEnumerable<Player> viewers)
Parameters
scale
Vector3The scale to set.
viewers
IEnumerable<Player>Who should see the updated scale.
ShowHint(Hint)
Show a hint to the player.
public void ShowHint(Hint hint)
Parameters
hint
HintThe hint to be shown.
ShowHint(string, float)
Shows a hint to the player.
public void ShowHint(string message, float duration = 3)
Parameters
ShowHitMarker(float)
Sends a HitMarker to the player.
public void ShowHitMarker(float size = 1)
Parameters
size
floatThe size of the hitmarker, ranging from
0
toHitmarker.MaxSize
).
SyncEffect(Effect)
Syncs the status effect on the player.
public void SyncEffect(Effect effect)
Parameters
SyncEffects(IEnumerable<Effect>)
Syncs a IEnumerable<T> of Effect on the player.
public void SyncEffects(IEnumerable<Effect> effects)
Parameters
effects
IEnumerable<Effect>The IEnumerable<T> of Effect to enable.
Teleport(object)
Teleports the player to the given object, with no offset.
public void Teleport(object obj)
Parameters
obj
objectThe object to teleport to.
Teleport(object, Vector3)
Teleports the player to the given object, offset by the defined offset value.
public void Teleport(object obj, Vector3 offset)
Parameters
obj
objectThe object to teleport the player to.
offset
Vector3The offset to teleport.
Teleport(Vector3)
Teleports the player to the given UnityEngine.Vector3 coordinates.
public void Teleport(Vector3 position)
Parameters
position
Vector3The UnityEngine.Vector3 coordinates to move the player to.
ThrowGrenade(ProjectileType, bool)
Forces the player to throw a grenade.
public Throwable ThrowGrenade(ProjectileType type, bool fullForce = true)
Parameters
type
ProjectileTypeThe ProjectileType to be thrown.
fullForce
boolWhether to throw with full or half force.
Returns
ThrowItem(Throwable, bool)
Forcefully throws a throwable
item.
public void ThrowItem(Throwable throwable, bool fullForce = true)
Parameters
throwable
ThrowableThe Throwable to be thrown.
fullForce
boolWhether to throw with full or half force.
ToString()
Converts the player in a human-readable format.
public override string ToString()
Returns
- string
A string containing Player-related data.
TryAddCandy(CandyKindID)
Gives the player a specific candy. Will give the player a bag if they do not already have one.
public bool TryAddCandy(CandyKindID candyType)
Parameters
candyType
CandyKindIDThe InventorySystem.Items.Usables.Scp330.CandyKindID to give.
Returns
TryAddCustomRoleFriendlyFire(Dictionary<string, Dictionary<RoleTypeId, float>>)
Adds the Custom role to the CustomRoleFriendlyFireMultiplier if they did not already exist.
public void TryAddCustomRoleFriendlyFire(Dictionary<string, Dictionary<RoleTypeId, float>> customRoleFriendlyFireMultiplier)
Parameters
customRoleFriendlyFireMultiplier
Dictionary<string, Dictionary<RoleTypeId, float>>Custom role with FF role rules.
TryAddCustomRoleFriendlyFire(string, RoleTypeId, float)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules for CustomRole.
public bool TryAddCustomRoleFriendlyFire(string roleTypeId, RoleTypeId roleToAdd, float ffMult)
Parameters
roleTypeId
stringRole associated for CustomFF.
roleToAdd
RoleTypeIdRole to add.
ffMult
floatFriendly fire multiplier.
Returns
- bool
Whether the item was able to be added.
TryAddCustomRoleFriendlyFire(string, Dictionary<RoleTypeId, float>, bool)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules.
public bool TryAddCustomRoleFriendlyFire(string customRoleName, Dictionary<RoleTypeId, float> ffRules, bool overwrite = false)
Parameters
customRoleName
stringRole associated for CustomFF.
ffRules
Dictionary<RoleTypeId, float>Roles to add with friendly fire values.
overwrite
boolWhether to overwrite current values if they exist - does NOT delete previous entries if they are not in provided rules.
Returns
- bool
Whether the item was able to be added.
TryAddCustomRoleFriendlyFire(string, KeyValuePair<RoleTypeId, float>)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules for CustomRole.
public bool TryAddCustomRoleFriendlyFire(string roleTypeId, KeyValuePair<RoleTypeId, float> roleFf)
Parameters
roleTypeId
stringRole associated for CustomFF.
roleFf
KeyValuePair<RoleTypeId, float>Role to add and FF multiplier.
Returns
- bool
Whether the item was able to be added.
TryAddFriendlyFire(RoleTypeId, float)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules.
public bool TryAddFriendlyFire(RoleTypeId roleToAdd, float ffMult)
Parameters
roleToAdd
RoleTypeIdRole to add.
ffMult
floatFriendly fire multiplier.
Returns
- bool
Whether the item was able to be added.
TryAddFriendlyFire(Dictionary<RoleTypeId, float>, bool)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules.
public bool TryAddFriendlyFire(Dictionary<RoleTypeId, float> ffRules, bool overwrite = false)
Parameters
ffRules
Dictionary<RoleTypeId, float>Roles to add with friendly fire values.
overwrite
boolWhether to overwrite current values if they exist.
Returns
- bool
Whether the item was able to be added.
TryAddFriendlyFire(KeyValuePair<RoleTypeId, float>)
Tries to add PlayerRoles.RoleTypeId to FriendlyFire rules.
public bool TryAddFriendlyFire(KeyValuePair<RoleTypeId, float> pairedRoleFF)
Parameters
pairedRoleFF
KeyValuePair<RoleTypeId, float>Role FF multiplier to add.
Returns
- bool
Whether the item was able to be added.
TryGet(CommandSender, out Player)
Try-get a player given a CommandSender.
public static bool TryGet(CommandSender sender, out Player player)
Parameters
sender
CommandSenderThe CommandSender.
player
PlayerThe player that matches the given CommandSender, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(ICommandSender, out Player)
Try-get a player given a CommandSystem.ICommandSender.
public static bool TryGet(ICommandSender sender, out Player player)
Parameters
sender
ICommandSenderThe CommandSystem.ICommandSender.
player
PlayerThe player that matches the given CommandSystem.ICommandSender, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(Footprint, out Player)
Try-get a player given a Footprinting.Footprint.
public static bool TryGet(Footprint footprint, out Player player)
Parameters
footprint
FootprintThe Footprinting.Footprint.
player
PlayerThe player that matches the given Footprinting.Footprint, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(NetworkConnection, out Player)
Try-get a player given a Mirror.NetworkConnection.
public static bool TryGet(NetworkConnection conn, out Player player)
Parameters
conn
NetworkConnectionThe Mirror.NetworkConnection.
player
PlayerThe player that matches the given Mirror.NetworkConnection, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(NetworkIdentity, out Player)
Try-get a player given a Mirror.NetworkIdentity.
public static bool TryGet(NetworkIdentity netIdentity, out Player player)
Parameters
netIdentity
NetworkIdentityThe Mirror.NetworkIdentity.
player
PlayerThe player that matches the given Mirror.NetworkIdentity, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(Player, out Player)
Try-get the Player from NwPluginAPI class.
public static bool TryGet(Player apiPlayer, out Player player)
Parameters
apiPlayer
PlayerThe PluginAPI.Core.Player class.
player
PlayerThe player found or null if not found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(ReferenceHub, out Player)
Try-get a player given a ReferenceHub.
public static bool TryGet(ReferenceHub referenceHub, out Player player)
Parameters
referenceHub
ReferenceHubThe ReferenceHub.
player
PlayerThe player that matches the given ReferenceHub, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(int, out Player)
Try-get a player given an ID.
public static bool TryGet(int id, out Player player)
Parameters
id
intThe user ID.
player
PlayerThe player that matches the given ID, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(string, out Player)
Try-get a player by identifier.
public static bool TryGet(string args, out Player player)
Parameters
args
stringThe player's nickname, ID, steamID64 or Discord ID.
player
PlayerThe player found or null if not found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(uint, out Player)
Try-get a player given a network ID.
public static bool TryGet(uint netId, out Player player)
Parameters
netId
uintThe network ID.
player
PlayerThe player that matches the given net ID, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGet(Collider, out Player)
Try-get player by UnityEngine.Collider.
public static bool TryGet(Collider collider, out Player player)
Parameters
Returns
- bool
A boolean indicating whether a player was found.
TryGet(GameObject, out Player)
Try-get a player given a UnityEngine.GameObject.
public static bool TryGet(GameObject gameObject, out Player player)
Parameters
gameObject
GameObjectThe UnityEngine.GameObject.
player
PlayerThe player that matches the given UnityEngine.GameObject, or null if no player is found.
Returns
- bool
A boolean indicating whether a player was found.
TryGetComponent(Type, out EActor)
Tries to get a component from the IEntity.
public bool TryGetComponent(Type type, out EActor component)
Parameters
Returns
TryGetComponent<T>(Type, out T)
Tries to get a component from the IEntity.
public bool TryGetComponent<T>(Type type, out T component) where T : EActor
Parameters
Returns
Type Parameters
T
The cast
T
EActor.
TryGetComponent<T>(out T)
Tries to get a component from the IEntity.
public bool TryGetComponent<T>(out T component) where T : EActor
Parameters
component
TThe
T
EActor.
Returns
Type Parameters
T
The
T
EActor to look for.
TryGetDanger(DangerType, out DangerStackBase)
Tries to get an instance of CustomPlayerEffects.StatusEffectBase by EffectType (does not work if the Scp1853 effect is not enabled).
public bool TryGetDanger(DangerType type, out DangerStackBase danger)
Parameters
type
DangerTypeThe EffectType.
danger
DangerStackBaseThe CustomPlayerEffects.StatusEffectBase.
Returns
- bool
A bool indicating whether the
danger
was successfully gotten.
TryGetEffect(EffectType, out StatusEffectBase)
Tries to get an instance of CustomPlayerEffects.StatusEffectBase by EffectType.
public bool TryGetEffect(EffectType type, out StatusEffectBase statusEffect)
Parameters
type
EffectTypeThe EffectType.
statusEffect
StatusEffectBaseThe CustomPlayerEffects.StatusEffectBase.
Returns
- bool
A bool indicating whether the
statusEffect
was successfully gotten.
TryGetEffect<T>(out T)
Tries to get an instance of CustomPlayerEffects.StatusEffectBase by EffectType.
public bool TryGetEffect<T>(out T statusEffect) where T : StatusEffectBase
Parameters
statusEffect
TThe CustomPlayerEffects.StatusEffectBase.
Returns
- bool
A bool indicating whether the
statusEffect
was successfully gotten.
Type Parameters
T
The CustomPlayerEffects.StatusEffectBase to get.
TryGetItem(ushort, out Item)
Tries to get an item from a player's inventory.
public bool TryGetItem(ushort serial, out Item item)
Parameters
Returns
TryGetSessionVariable<T>(string, out T)
Safely gets an object from SessionVariables, then casts it to T
.
public bool TryGetSessionVariable<T>(string key, out T result)
Parameters
key
stringThe key of the object to get.
result
TWhen this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter is used.
Returns
Type Parameters
T
The returned object type.
TryRemoveCustomeRoleFriendlyFire(string)
Tries to remove PlayerRoles.RoleTypeId from FriendlyFire rules.
public bool TryRemoveCustomeRoleFriendlyFire(string role)
Parameters
role
stringRole to add.
Returns
- bool
Whether the item was able to be added.
TryRemoveFriendlyFire(RoleTypeId)
Tries to remove PlayerRoles.RoleTypeId from FriendlyFire rules.
public bool TryRemoveFriendlyFire(RoleTypeId role)
Parameters
role
RoleTypeIdRole to add.
Returns
- bool
Whether the item was able to be added.
TrySetCustomRoleFriendlyFire(Dictionary<string, Dictionary<RoleTypeId, float>>)
Sets the CustomRoleFriendlyFireMultiplier.
public void TrySetCustomRoleFriendlyFire(Dictionary<string, Dictionary<RoleTypeId, float>> customRoleFriendlyFireMultiplier)
Parameters
customRoleFriendlyFireMultiplier
Dictionary<string, Dictionary<RoleTypeId, float>>New rules for CustomeRoleFriendlyFireMultiplier to set to.
TrySetCustomRoleFriendlyFire(string, Dictionary<RoleTypeId, float>)
Sets the CustomRoleFriendlyFireMultiplier.
public void TrySetCustomRoleFriendlyFire(string roleTypeId, Dictionary<RoleTypeId, float> customRoleFriendlyFireMultiplier)
Parameters
roleTypeId
stringRole to associate FF rules to.
customRoleFriendlyFireMultiplier
Dictionary<RoleTypeId, float>New rules for CustomeRoleFriendlyFireMultiplier to set to.
UnMute(bool)
Revokes a persistent mute. For temporary mutes, see IsMuted and IsIntercomMuted.
public void UnMute(bool isIntercom = false)
Parameters
isIntercom
boolWhether this un-mute is for the intercom only.
UseItem(Item)
Forces the player to use an item.
public bool UseItem(Item item)
Parameters
item
ItemThe item to be used.
Returns
UseItem(Usable)
Forces the player to use an item.
public void UseItem(Usable usable)
Parameters
usable
UsableThe item to be used.
UseItem(ItemType)
Forces the player to use an item.
public bool UseItem(ItemType usableItem)
Parameters
usableItem
ItemTypeThe ItemType to be used.
Returns
Vaporize(Player, string)
Kills the player and vaporizes the body.
public void Vaporize(Player attacker = null, string cassieAnnouncement = "")
Parameters
attacker
PlayerThe Player attacking player.
cassieAnnouncement
stringThe cassie announcement to make upon death.
Operators
operator ==(Player, Player)
Returns whether the two players are the same.
public static bool operator ==(Player player1, Player player2)
Parameters
Returns
implicit operator Player(Player)
Converts NwPluginAPI player to EXILED player.
public static implicit operator Player(Player player)
Parameters
player
PlayerThe NwPluginAPI player.
Returns
- Player
EXILED player.
operator !=(Player, Player)
Returns whether the two players are different.
public static bool operator !=(Player player1, Player player2)