feat(classes/player) Add "getAccountMoney" method
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
nilif the account does not exist. - This method internally calls the existing
getAccountmethod and safely accesses themoneyfield.
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.
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.