> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-pt/runtime-da-scene/modulos-de-runtime/players.md).

# Jogadores

O `Jogadores` módulo permite [cenas](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/scenes/README.md) para procurar jogadores no seu ambiente e obter informações sobre a sua identidade e [perfis](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/profiles/README.md).

```ts
const Players = require("~system/Players");
```

Contém os seguintes métodos e tipos:

* [`function getPlayersInScene`](#getPlayersInScene)
* [`function getConnectedPlayers`](#getPlayersInScene)
* [`function getPlayerData`](#getPlayerData)
* [`interface Player`](#Player)
* [`interface UserData`](#UserData)

### Métodos

Há dois métodos neste módulo para descobrir jogadores na cena e um para obter os seus perfis.

**`getPlayersInScene`**

Retorna um [`Player`](#Player) array, cada um com um `userId` que pode ser usado em [getPlayerData](#getPlayerData).

```ts
interface Request {}

interface Response {
  players: Player[];
}

function getPlayersInScene(Request): Promise<Response>;
```

**`getConnectedPlayers`**

```ts
interface Request {}

interface Response {
  players: Player[];
}

function getConnectedPlayers(Request): Promise<Response>;
```

**`getPlayerData`**

Retorna o [`UserData`](#UserData) para um utilizador, se conhecido para o `userId`.

```ts
interface Request {
  // O identificador do utilizador, (para não convidados, o seu endereço Ethereum).
  userId: string;
}

interface Response {
  // As informações de perfil deste utilizador, se disponíveis.
  data?: UserData;
}

function getPlayerData(Request): Promise<Response>;
```

### Tipos

Há apenas dois tipos neste módulo: [`Player`](#Player) e [`UserData`](#UserData).

**`Player`**

Contém uma referência a um `userId`.

```ts
interface Player {
  // O identificador do utilizador, (para não convidados, o seu endereço Ethereum).
  userId: string;
}
```

**`UserData`**

Armazena informações (possivelmente parciais) sobre um usuário, sua identidade e avatar.

World Explorers obtêm estas informações através da [sistema de conteúdo](https://github.com/decentraland/docs/tree/main/contributor/content/overview/README.md).

O [definição da entidade de perfil](https://github.com/decentraland/docs/tree/main/contributor/content/entity-types/profiles/README.md) detalha todos esses campos e muito mais. Embora a estrutura e as chaves de `UserData` sejam ligeiramente diferentes, o significado de cada campo é o mesmo.

```ts
export interface UserData {
  // O identificador do utilizador (ou seja, o seu endereço Ethereum).
  userId: string;

  // Um nome para chamá-lo na UI.
  displayName: string;

  // A chave pública Ethereum com a qual ele assina.
  publicKey?: string;

  // Se a funcionalidade web3 está ativada.
  hasConnectedWeb3: boolean;

  // A versão sequencial dessas informações, incrementada a cada atualização do usuário.
  version: number;

  // Informações sobre seu avatar, se disponíveis.
  avatar?: {
    // Ponteiros para os ativos necessários para renderizar este avatar.
    bodyShape: string;
    wearables: string[];

    // Tons de cor RGB/RGBA codificados em hexadecimal para diferentes partes do corpo.
    skinColor: string;
    hairColor: string;
    eyeColor: string;

    // Identificadores de arquivo para as "fotos" deste avatar.
    snapshots?: {
      face256: string;
      body: string;
    };
  };
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/contributor/contributor-pt/runtime-da-scene/modulos-de-runtime/players.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
