From 395629af1778841cc382926dc1644f1a95118626 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Thu, 12 Jun 2025 06:49:41 -0400 Subject: [PATCH] GetAccountBalace (client) fixed for esx This will return the players money by type, I recommend not using this as its the client and not secure or to be trusted. Use case is for a ui or a menu I guess? --- modules/framework/es_extended/client.lua | 11 ++++++++--- modules/framework/qb-core/client.lua | 1 + modules/framework/qbx_core/client.lua | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/framework/es_extended/client.lua b/modules/framework/es_extended/client.lua index ad3089b..31ced11 100644 --- a/modules/framework/es_extended/client.lua +++ b/modules/framework/es_extended/client.lua @@ -131,15 +131,20 @@ Framework.GetPlayerInventory = function() end ---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted. ----UNTESTED ON ESX (Should work?) +---Use case is for a ui or a menu I guess. ---@param _type string ---@return number Framework.GetAccountBalance = function(_type) local player = Framework.GetPlayerData() if not player then return 0 end - local account = player.accounts + local accounts = player.accounts if _type == 'cash' then _type = 'money' end - return account[_type].money or 0 + for _, account in ipairs(accounts) do + if account.name == _type then + return account.money or 0 + end + end + return 0 end ---This will return the vehicle properties for the specified vehicle. diff --git a/modules/framework/qb-core/client.lua b/modules/framework/qb-core/client.lua index 26b2a95..f50eb57 100644 --- a/modules/framework/qb-core/client.lua +++ b/modules/framework/qb-core/client.lua @@ -74,6 +74,7 @@ Framework.HideHelpText = function() end ---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted. +---Use case is for a ui or a menu I guess. ---@param _type string ---@return number Framework.GetAccountBalance = function(_type) diff --git a/modules/framework/qbx_core/client.lua b/modules/framework/qbx_core/client.lua index 5cf2b66..edd8eaf 100644 --- a/modules/framework/qbx_core/client.lua +++ b/modules/framework/qbx_core/client.lua @@ -109,6 +109,7 @@ Framework.GetPlayerInventory = function() end ---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted. +---Use case is for a ui or a menu I guess. ---@param _type string ---@return number Framework.GetAccountBalance = function(_type)