RedM Natives

GET_PLAYER_IDENTIFIER_BY_TYPE

Get an identifier from a player by the type of the identifier.

Hash0xA61C8FC6
Runtime nameGetPlayerIdentifierByType
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

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

Parameters

NameTypeDescription
playerSrcchar*

The player to get the identifier for

identifierTypechar*

The string to match in an identifier, this can be "license" for example.

Returns char* — The identifier that matches the string provided

Description

Cfx.re native reference

Get an identifier from a player by the type of the identifier. Known Identifiers

Usage

Lua
local retval = GetPlayerIdentifierByType(playerSrc, identifierType)

-- always works, by hash
local retval = Citizen.InvokeNative(0xa61c8fc6, playerSrc, identifierType, Citizen.ResultAsString())
JavaScript and C#
JavaScript
const retval = GetPlayerIdentifierByType(playerSrc, identifierType);

// by hash
const retval = Citizen.invokeNative('0xa61c8fc6', playerSrc, identifierType, Citizen.returnResultAnyway(), Citizen.resultAsString());
C#
string retval = Function.Call<string>((Hash)0xa61c8fc6, playerSrc, identifierType);

Examples

LUA · Cfx.re native reference
local playerLicenses = {}

AddEventHandler('playerJoining', function()
    playerLicenses[source] = GetPlayerIdentifierByType(source, 'license')
end)
JS · Cfx.re native reference
let playerLicenses = {};

on('playerJoining', () => {
    playerLicenses[source] = GetPlayerIdentifierByType(source, 'license');
});
CS · Cfx.re native reference
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

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.