# Unique identifier & reading user

Choosing a unique identifier.


EQU8 needs an identifier that is unique across all players. This identifier is used to correlate events in our database with your database. The identifier can be anything from a user name to a database integer; so long as it is unique it will work. So, before we continue, decide on what identifier to use.

## Reading the EQU8 user status

Before allowing a client to play, we want to verify that she is well behaved (not banned etc).

In the example server we write a function named `user_is_allowed_to_play` that talks to the EQU8 user validation API.

Initially, let us just use the predefined actions (`ban` and `timeout 15 minutes`). However, using EQU8 you can implement whatever actions you see fit! Be it an all-cheaters server or a virtual jail :)

### C/C++

{% tabs %}
{% tab title="C/C++" %}
```cpp
bool user_is_allowed_to_play(const sockaddr_in &from,
    const std::string &unique_id, uint32_t action)
{
    auto from_sa = reinterpret_cast<const sockaddr *>(&from);

    if(equ8_action_ban == action)
    {
        packet_violation pv{ "You are banned." };
        send_packet(from_sa, sizeof(from), &pv);
        return false;
    }
    else if(equ8_action_timeout_15m == action)
    {
        packet_violation pv{ "You are timed-out." };
        send_packet(from_sa, sizeof(from), &pv);
        return false;
    }
    return true;
}
```
{% endtab %}

{% tab title="C#" %}
```csharp
bool user_is_allowed_to_play(IPEndPoint from, string id, UInt32 ac)
{
    var action = (equ8.equ8_action)ac;
    if (equ8.equ8_action.ban == action)
    {
        send_packet(from, new packet_violation("You are banned."));
        return false;
    }
    else if (equ8.equ8_action.timeout_15m == action)
    {
        send_packet(from, new packet_violation("You are timed-out."));
        return false;
    }
    return true;
}
```
{% endtab %}
{% endtabs %}
