Skip to content

feat(es_extended): add static ESX.ExtendedPlayers#1705

Merged
Kenshiin13 merged 1 commit intodevfrom
extended-players
Aug 19, 2025
Merged

feat(es_extended): add static ESX.ExtendedPlayers#1705
Kenshiin13 merged 1 commit intodevfrom
extended-players

Conversation

@Kenshiin13
Copy link
Copy Markdown
Contributor

Description

Adds ESX.ExtendedPlayers as a lightweight wrapper for ESX.GetExtendedPlayers. Returns tables of StaticPlayer objects (method-only wrappers) for multiple players, following the same pattern as the existing ESX.Player function.


Motivation

ESX.Player provides a minimal interface for a single player by exposing only methods via StaticPlayer. This reduces bloat and avoids exposing full xPlayer properties. ESX.ExtendedPlayers extends this approach to multiple players, making it easier to work with groups of players while keeping the same clean, method-only interface.


Implementation Details

  • Introduces StaticPlayer class.
  • Implements ESX.ExtendedPlayers(key?, val?) which:
    • Returns an array of StaticPlayer objects for a single filter.
    • Returns a table mapping groups to arrays of StaticPlayer objects for multi-group filters.
  • Uses ESX.GetExtendedPlayers internally.
  • Fully type-annotated for better IDE support and autocomplete.

Usage Example

local groupedPlayers = ESX.ExtendedPlayers("job", { "ambulance", "police" }) --[[@as table<string, StaticPlayer[]>]]
for group, players in pairs(groupedPlayers) do
    for i, xPlayer in ipairs(players) do
        print(group, xPlayer.getName())
    end
end

local xPlayers = ESX.ExtendedPlayers() --[=[@as StaticPlayer[]]=]
for i, xPlayer in ipairs(xPlayers) do
    print(xPlayer.getName())
end

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

As a wrapper for ESX.GetExtendedPlayers
@Kenshiin13
Copy link
Copy Markdown
Contributor Author

@Kenshiin13 Kenshiin13 requested a review from Zykem August 17, 2025 14:13
Copy link
Copy Markdown
Contributor

@Zykem Zykem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks.

@Kenshiin13 Kenshiin13 merged commit 0805ac0 into dev Aug 19, 2025
3 of 4 checks passed
@Kenshiin13 Kenshiin13 deleted the extended-players branch August 19, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants