GetIdentifier

The SD.GetIdentifier module standardizes the process of retrieving unique player identifiers across various frameworks by providing a unified interface. This functionality is crucial for operations requiring identification of players uniquely and consistently regardless of the backend game server framework.

Overview

Purpose: To provide a uniform method to retrieve the unique identifier of a player, which is essential for tracking, managing, and associating data with individual players in a multiplayer environment.

Returns: string: The primary identifier for the player, typically used for database operations and other player-specific tracking.

  • ESX: Fetches the primary identifier directly from the ESX player object.

  • QB/QBX: Retrieves the citizenid, a common identifier used within the QB framework.

  • Fallback Method: For servers not using ESX or QB/QBX, or where these frameworks are not detected, the module uses the native GetPlayerIdentifiers function, which is standard in FiveM for obtaining a list of all identifiers associated with a player.

Parameters

  • source (any): The server ID or similar identifier used to fetch the player data.

Usage Example

local identifier = SD.GetIdentifier(source)
print("Player Identifier:", identifier)

Last updated