# Accepting player and data

## Accepting the player

Next up is calling `user_is_allowed_to_play`. It is ideal to verify user status as early as possible after the player has been authenticated and the unique identifier is known.

In the example code we send a small response to the client if it is not allowed to play, but for timeouts and bans, simply dropping the connection will work just as well.

{% tabs %}
{% tab title="C/C++" %}

```cpp
if(packet_type::connect == p->id)
{
    const std::string &unique_id = 
        static_cast<const packet_connect *>(p)->name;
    
    uint32_t status = equ8_sm_user_status(unique_id.c_str());
    if(!user_is_allowed_to_play(from, unique_id, status))
    {
        std::cout << "Client '" << unique_id
            << "' not allowed to play (action: "
            << status << ")" << std::endl;
        return;
    }
```

{% endtab %}

{% tab title="C#" %}

```csharp
if(packet_type.connect == p.id)
{
    string unique_id = ((packet_connect)p).name;
    var status = equ8.session_manager.user_status(unique_id);

    if(!user_is_allowed_to_play(from, unique_id, status))
    {
        Console.WriteLine(
            "Client '{0}' not allowed to play (status: {1})",
            unique_id, status);
        return;
    }
```

{% endtab %}
{% endtabs %}

Receiving data from the client

While the vast majority of Anti-Cheat data is sent directly from the client to the ![EQU8](https://dash.equ8.com/docs/images/logo.svg) Anti-Cheat servers, a few packets need to be sent over the game’s existing data channel.

For instance, after the game server registers a client, an access token must be delivered to the game client so that it can connect to the Anti-Cheat servers directly.

Add a new packet to your game protocol for EQU8 data delivery, and feed the data to EQU8 as you receive the packet.

**EQU8 will NEVER send more than `256` (`0x100`) bytes in a single packet.**

{% tabs %}
{% tab title="C/C++" %}

```c
switch(p->id)
{
    case packet_type::equ8_data:
        std::cout << "EQU8 Received Data from user: '"
            << it->unique_id() << "' size: "
            << static_cast<const packet_equ8_data *>(p)->size
            << std::endl;
        equ8_sm_on_data_received(it->unique_id(),
            static_cast<const packet_equ8_data *>(p)->data,
            static_cast<const packet_equ8_data *>(p)->size);
        return;
```

{% endtab %}

{% tab title="C#" %}

```csharp
switch (p.id)
{
    case packet_type.equ8_data:
        var payload = ((packet_equ8_data)p).data;
        Console.WriteLine("EQU8 Received Data: user: '{0}' size: {1}",
            gc.unique_id(), payload.Length);
        equ8.session_manager.on_data_received(gc.unique_id(), payload);
        break;
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://equ8.gitbook.io/documentation/integration-guide/accepting-player-and-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
