GET_PLAYER_IDENTIFIER_BY_TYPE
Get an identifier from a player by the type of the identifier.
Signature
char* GET_PLAYER_IDENTIFIER_BY_TYPE(char* playerSrc, char* identifierType);Parameters
| Name | Type | Description |
|---|---|---|
playerSrc | char* | The player to get the identifier for |
identifierType | char* | The string to match in an identifier, this can be |
Returns char* — The identifier that matches the string provided
Description
Get an identifier from a player by the type of the identifier. Known Identifiers
Usage
local retval = GetPlayerIdentifierByType(playerSrc, identifierType)
-- always works, by hash
local retval = Citizen.InvokeNative(0xa61c8fc6, playerSrc, identifierType, Citizen.ResultAsString())JavaScript and C#
const retval = GetPlayerIdentifierByType(playerSrc, identifierType);
// by hash
const retval = Citizen.invokeNative('0xa61c8fc6', playerSrc, identifierType, Citizen.returnResultAnyway(), Citizen.resultAsString());string retval = Function.Call<string>((Hash)0xa61c8fc6, playerSrc, identifierType);Examples
local playerLicenses = {}
AddEventHandler('playerJoining', function()
playerLicenses[source] = GetPlayerIdentifierByType(source, 'license')
end)let playerLicenses = {};
on('playerJoining', () => {
playerLicenses[source] = GetPlayerIdentifierByType(source, 'license');
});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
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.