esx_core icon indicating copy to clipboard operation
esx_core copied to clipboard

feat(classes/player) Add "getAccountMoney" method

Open Zykem opened this issue 4 months ago • 1 comments

Description

Adds a new method getAccountMoney to the xPlayer object to retrieve the current money amount of a specified account. This simplifies fetching account balances directly from the player object.


Motivation

Currently, retrieving the money of a player’s account requires calling getAccount and then accessing the money field. Adding getAccountMoney provides a more straightforward, readable, and convenient way to get account balances, improving code clarity.


Implementation Details

  • Added a new function xPlayer.getAccountMoney(accountName) that returns the money value of the specified account.
  • The method returns nil if the account does not exist.
  • This method internally calls the existing getAccount method and safely accesses the money field.

Usage Example

local money = xPlayer.getAccountMoney("bank")
if money then
    print(("Player has %d in bank account"):format(money))
else
    print("Account not found")
end

PR Checklist

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

Zykem avatar Sep 07 '25 15:09 Zykem

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 4 committers have signed the CLA.

:white_check_mark: Kenshiin13
:x: Kr3mu
:x: Zykem
:x: github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Nov 16 '25 20:11 CLAassistant