# CFX::GET_PLAYER_IDENTIFIER_BY_TYPE

- **Hash:** `0xA61C8FC6`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `GetPlayerIdentifierByType`
- **Side:** server (Cfx runtime native)
- **Name status:** official
- **Documentation:** described with examples
- **URL:** https://natives.borderlinerp.com/natives/CFX/GET_PLAYER_IDENTIFIER_BY_TYPE

## Signature

```c
char* GET_PLAYER_IDENTIFIER_BY_TYPE(char* playerSrc, char* identifierType);
```

## Parameters

- `playerSrc` (`char*`) — The player to get the identifier for
- `identifierType` (`char*`) — The string to match in an identifier, this can be `"license"` for example.

## Returns

`char*` — The identifier that matches the string provided

## Description

*Source: Cfx.re native reference*

Get an identifier from a player by the type of the identifier.
Known [Identifiers](https://docs.fivem.net/docs/scripting-reference/runtimes/lua/functions/GetPlayerIdentifiers/#identifier-types)

## Usage

### Lua

```lua
local retval = GetPlayerIdentifierByType(playerSrc, identifierType)

-- always available, by hash
local retval = Citizen.InvokeNative(0xa61c8fc6, playerSrc, identifierType, Citizen.ResultAsString())
```

### JavaScript

```js
const retval = GetPlayerIdentifierByType(playerSrc, identifierType);

// by hash
const retval = Citizen.invokeNative('0xa61c8fc6', playerSrc, identifierType, Citizen.returnResultAnyway(), Citizen.resultAsString());
```

### C#

```csharp
string retval = Function.Call<string>((Hash)0xa61c8fc6, playerSrc, identifierType);
```

## Examples

*Source: Cfx.re native reference*

```lua
local playerLicenses = {}

AddEventHandler('playerJoining', function()
    playerLicenses[source] = GetPlayerIdentifierByType(source, 'license')
end)
```

*Source: Cfx.re native reference*

```js
let playerLicenses = {};

on('playerJoining', () => {
    playerLicenses[source] = GetPlayerIdentifierByType(source, 'license');
});
```

*Source: Cfx.re native reference*

```cs
using System.Collections.Generic;
using static CitizenFX.Core.Native.API;
// ...

// In class
private Dictionary<int, string> PlayerLicenses = new Dictionary<int, string>();

// In class constructor
EventHandlers["playerJoining"] += new Action<Player>(SetLicense);

// Delegate method
private void SetLicense([FromSource]Player player) {
    PlayerLicenses.Add(player.Handle, GetPlayerIdentifierByType(player.Handle, "license"));
}
```

*Sources: Cfx.re native reference.*
