The SD.GetPlayers module offers a unified approach to retrieving lists of online players within various frameworks. This functionality is crucial for operations and scripts that need to interact with or manage player data across different multiplayer environments.


Purpose: Provides a list of all currently online players, encapsulating the complexity of framework-specific data retrieval into a straightforward and easy-to-use function.

Returns: A table containing player identifiers or extended player objects, depending on the framework.

  • ESX: Uses ESX.GetExtendedPlayers() to fetch an array of all connected players with extended ESX properties.

  • QB: Utilizes QBCore.Functions.GetPlayers() for retrieving an array of player identifiers.

  • QBX: Employs exports.qbx_core:GetQBPlayers() to obtain player data, showcasing integration with custom QBX extensions.

Usage Example

local onlinePlayers = SD.GetPlayers()
for _, player in ipairs(onlinePlayers) do
    print('Player ID:', player)

Last updated