> For the complete documentation index, see [llms.txt](https://pellix-1.gitbook.io/pellix-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pellix-1.gitbook.io/pellix-docs/callbacks/player.md). Agents can also search and read this documentation through its [MCP server](https://pellix-1.gitbook.io/pellix-docs/~gitbook/mcp).

# player

Executes every time when basic player data was retrieved, player references in-game `CCSPlayerController` and almost always has entire class cached into the memory.

```lua
pre_players()
player(player: entity)
post_players()
```

This callback can be registered by calling [set\_callback](https://pellix-1.gitbook.io/pellix-docs/functions/set_callback.md).

**Example:**

```lua
local teamnum_offset = schema.get("C_BaseEntity", "m_iTeamNum")

local player_teams = {}

local function on_pre_players()
    for i, v in next, player_teams 
        print(i, ": ", v)    
    end

    player_teams = {}
end

local function on_player(player)
    player_teams[player:get_index()] = player:get_int(teamnum_offset)
end

set_callback("pre_players", on_pre_players)
set_callback("player", on_player)
```
