# Identifier

## Identifier resolution

If your server uses a non-standard primary identifier (custom `citizenid`, Discord ID, account UUID, etc.) you can override how the script resolves players.

### Default behavior

The default lookup order, configurable in `shared/config.lua`:

```lua
Framework = {
  IdentifierPriority = { "license2", "license", "fivem", "discord", "steam" }
}
```

The script tries each of these on the player's identifiers and uses the first match.

### Override resolveIdentifier(source)

Edit `server/framework/hooks.lua`:

```lua
VarShop = VarShop or {}
VarShop.FrameworkOverrides = VarShop.FrameworkOverrides or {}

function VarShop.FrameworkOverrides.resolveIdentifier(source)
  -- Use QBCore citizenid as the primary key
  local Player = QBCore.Functions.GetPlayer(source)
  if Player then
    return Player.PlayerData.citizenid
  end
  return nil -- nil = fall back to the default resolver
end
```

### Override resolveIdentifierInput(input)

Used when an admin types something like `/addcoins #ABC1234 500` and you want the hash-prefix shorthand to resolve to a citizenid:

```lua
function VarShop.FrameworkOverrides.resolveIdentifierInput(input)
  if type(input) == "string" and input:match("^#") then
    local Player = QBCore.Functions.GetPlayerByCitizenId(input:sub(2))
    return Player and Player.PlayerData.citizenid or nil
  end
  return nil -- fall back to the default resolver
end
```

The default resolver already accepts:

* Online server ID (`42`)
* Online player by any framework identifier (`steam:xxx`, `fivem:xxx`, etc.)
* An existing account in the database
* An alias previously registered for an offline player
* A raw string as last resort

{% hint style="info" %}
Returning `nil` from a hook means "I have nothing to say, use the default". Returning a string means "this is the canonical identifier, use it".
{% endhint %}


---

# 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://doc.var-fivem.com/coins-shop/configuration/identifier.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.
