Player||doc135318

September 20, 2022

Player

This Object cannot be created. Player-controlled entities are created by the engine and converted to the Player object.

Introduction

Player is inherited from Entity (Player Object). All player-controlled entities are Player, which includes additional user-related functions, whereas all other entities are Entity. On the client-side, the global variable 'Me' can be used to access the client's Player Object.

Properties

int platformUserId

User platform ID, the unique identifier of the user account

boolean isMainPlayer

Determine whether the object is the main player of the client

Inherited from Object:

int objID

Object ID

int ownerId

owner object id

Map map

Current object location map

boolean isEntity

Determine whether an object is an entity object

boolean isPlayer

Determine if the object is a player

Function

void addCurrency (  string coinName,  int count,  string reason  )

Add in-game currency

boolean payCurrency (  string coinName,  int count,  boolean clear,  boolean check,  string reason  )

Pay in-game currency

int getWalletBalance (  string coinName  )

Return currency balance

void sendTip (  int tipType,  string textKey,  int keepTime  )

Display informative text on the client

void setForceMoveToAll (  vector3 pos, int time  )

According to the time parameter, make the player move towards the specified target point

void changeToAppAppearance (  )

Switch the model of player entity to platform appearance

Inherited from Object:

config cfg (  )

Get object configuration information

variant data (  string key  )

get some data

void setData (  string key,  variant val  )

set some data

function timer (  int time,  function function,  args …  )

Starts a timer and returns a function that stops the timer

function lightTimer (  string stack,  int time,  function func,  any …  )

Start a timer with custom error output content and return a function to stop the timer

float distance (  Object obj  )

Returns the distance to the target object

boolean isValid (  )

Determine if you are still a valid object

boolean setMap (  Map map  )

Move the object to the specified map

void setRotationYaw (  float yaw  )

Set the orientation of the object's yaw axis

void setRotationPitch (  float pitch  )

Set the pitch axis rotation angle

float getRotationYaw (  )

Get the current yaw angle value

float getRotationPitch (  )

Get the current pitch angle value

Vector3 getPosition (  )

Get current location coordinates

void setPosition (  Vector3 pos  )

Set object to position coordinates

void delayCall (  function func,  int time  )

Delay calling function

void destroy (  )

destroy object

void GetUserData (  function callback )

Get the platform user information of the current player

void RequestFriendList (  function callback, int firstIndex, int lastIndex )

Get the current player's platform friend information

void RequestIsFriendWith (  int userID, function callback )

Get whether the current player and another user are platform friends

Event

trigger ENTITY_ENTER

Triggered when player logs in

trigger ENTITY_LEAVE

Triggered when the player logs out

trigger PRE_CHECK_PICK_ITEM

Pre-check events before players pick up drops