Player
Associated namespace: sm.player
A userdata object representing a player in the game.
Values:
Functions:
- getCarry
- getCarryColor
- getCharacter
- getClientPublicData
- getHotbar
- getId
- getInventory
- getName
- getPublicData
- isFemale
- isMale
- placeLift
- removeLift
- sendCharacterEvent
- setCharacter
- setClientPublicData
- setPublicData
Operations:
Operation | Description |
---|---|
Player == Player | Checks if two instances of Player refer to the same Player. |
character Character
Get:
Returns the character the player is controlling.
clientPublicData table
Get:
Client only
Returns client public data from a player.
Set:
Client only
Sets client public data on a player.
id integer
Get:
Returns the id of a player.
name string
Get:
Returns the name of a player.
publicData table
Get:
Server only
Returns (server) public data from a player.
Set:
Server only
Sets (server) public data on a player.
getCarry(player)
Returns the carry container of the player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
Container | The player's carry. |
getCarryColor()
Server only
Returns the color of the shape the player is carrying.
Returns:
Type | Description |
---|---|
Color | The color of the shape the player is carrying. |
getCharacter(player)
Returns the character the player is controlling.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
Character | The player's character. |
getClientPublicData(player)
Client only
Returns client public data from a player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
table | The client public data. |
getHotbar(player)
Returns the hotbar container of the player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
Container | The player's hotbar. |
getId(player)
Returns the id of a player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
integer | The player's id. |
getInventory(player)
Returns the inventory container of the player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
Container | The player's inventory. |
getName(player)
Returns the name of a player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
string | The player's name. |
getPublicData(player)
Server only
Returns (server) public data from a player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Returns:
Type | Description |
---|---|
table | The public data. |
isFemale(player)
Check if the player is female
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player |
Returns:
Type | Description |
---|---|
boolean | True if female |
isMale(player)
Check if the player is male
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player |
Returns:
Type | Description |
---|---|
boolean | True if male |
placeLift(player, creation, position, level, rotation)
Server only
Place down a lift game object
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player to own the lift. |
table | creation | The bodies to place on the lift. {Body, ..} |
Vec3 | position | The lift position. |
integer | level | The lift level. |
integer | rotation | The rotation of the creation on the lift. |
removeLift(player)
Server only
Remove the player's lift, if the lift exists.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player that owns the lift. |
sendCharacterEvent(player, event)
Server only
Sends an event to a given player
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player to send to |
string | event | The event to send |
setCharacter(player, character)
Server only
Sets the character the player is controlling.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
Character | character | The character. |
setClientPublicData(player, data)
Client only
Sets client public data on a player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
table | data | The client public data. |
setPublicData(player, data)
Server only
Sets (server) public data on a player.
Parameters:
Type | Name | Description |
---|---|---|
Player | player | The player. |
table | data | The public data. |