Player
Summary
A server player. Represents a server-side player instance.
Properties
| Name | Type |
|---|---|
| name | string |
| playerId | integer |
| team | integer |
| battlepoints | integer |
| score | integer |
| kills | integer |
| assists | integer |
| deaths | integer |
| afkTime | number |
| characterEntity | Entity |
| vehicleEntity | Entity |
| activeKit | DataContainer |
| isBot | boolean |
| isAlive | boolean |
Methods
| Method | Returns |
|---|---|
| SetTeam(team: integer) | void |
| SetWeapon(weaponName: string) | void |
| GetWeapon() | DataContainer |
| SetScore(amount: integer) | void |
| SetKills(amount: integer) | void |
| SetAssists(amount: integer) | void |
| SetDeaths(amount: integer) | void |
| SetBattlepoints(amount: integer) | void |
| GiveBattlepoints(amount: integer) | void |
| SetCustomizationAsset(assetName: string) | void |
| SetUnlock(assetGuid: string, grant: boolean) | void |
| Kick(reason: string) | void |
| SetInvisible(invisible: boolean) | void |
| SetHealth(amount: integer) | void |
| SetMaxHealth(amount: integer) | void |
| SetAbility(abilityId: integer) | void |
| ForceSendChatMessage(channel: integer, message: string) | void |
| SendChatMessage(message: string) | void |
| SetInputEnabled(actionId: integer, enabled: boolean) | void |
| SendSyncedSettings() | void |
| SetImmortal(isImmortal: boolean) | void |
| SetFakeImmortal(isFakeImmortal: boolean) | void |
| SetExplosionDamageModifier(modifier: number) | void |
| SetMoveSpeedMultiplier(modifier: number) | void |
| SetCooldownModifier(modifier: number) | void |
Properties
name
string
Player's username.
playerId
integer
Player's EA player id.
team
integer
Player's current team.
battlepoints
integer
Player's battlepoint count.
score
integer
The player's current score.
kills
integer
The player's current kill count.
assists
integer
The player's current assist count.
deaths
integer
The player's current death count.
afkTime
number
How long it has been since the player has inputted anything in seconds.
characterEntity
The character entity the player is currently occupying, or nil if not spawned on foot.
vehicleEntity
The vehicle entity the player is currently occupying, or nil if not in a vehicle.
activeKit
The active kit/loadout asset for the player, or nil if none is set.
isBot
boolean
If player is a bot.
isAlive
boolean
If player is actively spawned as a character or vehicle.
Methods
SetTeam
Player:SetTeam(team: integer): voidSets the player's team.
Parameters
| Name | Type | Description |
|---|---|---|
| team | integer | The team id to set. |
SetWeapon
Player:SetWeapon(weaponName: string): voidSets the player's primary weapon by asset name. Does nothing if the player has no soldier extent or the asset cannot be found.
Parameters
| Name | Type | Description |
|---|---|---|
| weaponName | string | The resource name of the weapon asset to equip. |
GetWeapon
Player:GetWeapon(): DataContainerReturns the player's currently equipped primary weapon as a DataContainer asset. Returns nothing if the player has no soldier extent or no weapon assigned.
Returns
| Type | Description |
|---|---|
| DataContainer | weapon The weapon asset. |
SetScore
Player:SetScore(amount: integer): voidSets the player's score to an exact amount.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The score value to set. |
SetKills
Player:SetKills(amount: integer): voidSets the player's kill count to an exact amount.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The kill count to set. |
SetAssists
Player:SetAssists(amount: integer): voidSets the player's assist count to an exact amount.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The assist count to set. |
SetDeaths
Player:SetDeaths(amount: integer): voidSets the player's death count to an exact amount.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The death count to set. |
SetBattlepoints
Player:SetBattlepoints(amount: integer): voidSets player's battlepoints.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The amount desired. |
GiveBattlepoints
Player:GiveBattlepoints(amount: integer): voidGive player battlepoints
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The amount desired. |
SetCustomizationAsset
Player:SetCustomizationAsset(assetName: string): void[EXPERIMENTAL] Sets the player's customization asset by resource name. Does nothing if the asset cannot be found.
Parameters
| Name | Type | Description |
|---|---|---|
| assetName | string | The resource name of the customization asset. |
SetUnlock
Player:SetUnlock(assetGuid: string, grant: boolean): voidGrants or revokes a specific unlock on the player by GUID string. Does nothing if the GUID string or boolean argument is missing.
Parameters
| Name | Type | Description |
|---|---|---|
| assetGuid | string | The string representation of the unlock's GUID. |
| grant | boolean | true to grant the unlock, false to revoke it. |
Kick
Player:Kick(reason: string): voidKick server player from the server.
Parameters
| Name | Type | Description |
|---|---|---|
| reason | string | Set reason for the kick. |
SetInvisible
Player:SetInvisible(invisible: boolean): voidSets the player's character entity visibility. Does nothing if the player has no character entity.
Parameters
| Name | Type | Description |
|---|---|---|
| invisible | boolean | true to force the player invisible, false to restore visibility. |
SetHealth
Player:SetHealth(amount: integer): voidSets the player's current health value. Does nothing if the player has no character entity or health component.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The health value to set. |
SetMaxHealth
Player:SetMaxHealth(amount: integer): voidSets the player's maximum health value. Only works if the player's health component is a WSServerSoldierHealthComponent. Does nothing if the player has no character entity or the health component is of an incompatible type.
Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | The maximum health value to set. |
SetAbility
Player:SetAbility(abilityId: integer): voidSets the player's character (notably not vehicle) active ability by ability ID. Does nothing if the ability asset cannot be loaded for the given ID.
Parameters
| Name | Type | Description |
|---|---|---|
| abilityId | integer | The ID of the ability to assign. |
ForceSendChatMessage
Player:ForceSendChatMessage(channel: integer, message: string): voidForces the player to send a chat message on a specified channel.
Parameters
| Name | Type | Description |
|---|---|---|
| channel | integer | The chat channel ID (maps to ChatChannel enum). |
| message | string | The message content to send. |
SendChatMessage
Player:SendChatMessage(message: string): voidSends chat message to the player.
Parameters
| Name | Type | Description |
|---|---|---|
| message | string | The message content to send. |
SetInputEnabled
Player:SetInputEnabled(actionId: integer, enabled: boolean): voidEnables or disables a specific input action for the player.
Parameters
| Name | Type | Description |
|---|---|---|
| actionId | integer | The ID of the input action to control. |
| enabled | boolean | true to enable the input, false to disable it. |
SendSyncedSettings
Player:SendSyncedSettings(): voidResends synced game settings to the player's connection. Useful after modifying server-side settings that need to be re-synced to the client.
SetImmortal
Player:SetImmortal(isImmortal: boolean): voidSet if the player's character (notably not vehicle) is damageable.
Parameters
| Name | Type | Description |
|---|---|---|
| isImmortal | boolean |
SetFakeImmortal
Player:SetFakeImmortal(isFakeImmortal: boolean): voidSet if the player's character (notably not vehicle) is fake damageable.
Parameters
| Name | Type | Description |
|---|---|---|
| isFakeImmortal | boolean |
SetExplosionDamageModifier
Player:SetExplosionDamageModifier(modifier: number): voidSet how much the player's character (notably not vehicle) takes explosion damage
Parameters
| Name | Type | Description |
|---|---|---|
| modifier | number | The value multiplied with the damage. |
SetMoveSpeedMultiplier
Player:SetMoveSpeedMultiplier(modifier: number): voidSet how fast the player's character (notably not vehicle) is.
Parameters
| Name | Type | Description |
|---|---|---|
| modifier | number | The value to set. |
SetCooldownModifier
Player:SetCooldownModifier(modifier: number): voidSets the player's character (notably not vehicle) total cooldown timer is. Higher values is slower, lower values is faster.
Parameters
| Name | Type | Description |
|---|---|---|
| modifier | number | The value to set. |