The SD.GetPlayer module provides a unified method to retrieve player objects across different frameworks by abstracting the framework-specific functionalities into a single interface. This standardization simplifies developer interactions with player objects, enhancing code portability and maintainability.


Purpose: Facilitates the retrieval of player objects using a server ID, regardless of the underlying gaming framework, by providing a consistent interface.

Returns: Player|nil: Returns the player object if available, or nil if the player is not found or in case of an error due to unsupported frameworks.

  • ESX: Utilizes ESX.GetPlayerFromId to fetch the player object using the server ID.

  • QB: Uses QBCore.Functions.GetPlayer to obtain the player object.

  • QBX: Employs exports.qbx_core:GetPlayer for QBX-specific data retrieval.


  • source (number): The server ID of the player to retrieve. Returns:

Usage Example

local player = SD.GetPlayer(source)
if player then
    print('Player name:', player)
    print('Player not found or framework not supported.')

Last updated