diff --git a/modules/framework/es_extended/client.lua b/modules/framework/es_extended/client.lua index 7b42719..ad3089b 100644 --- a/modules/framework/es_extended/client.lua +++ b/modules/framework/es_extended/client.lua @@ -130,6 +130,18 @@ Framework.GetPlayerInventory = function() return playerData.inventory 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?) +---@param _type string +---@return number +Framework.GetAccountBalance = function(_type) + local player = Framework.GetPlayerData() + if not player then return 0 end + local account = player.accounts + if _type == 'cash' then _type = 'money' end + return account[_type].money or 0 +end + ---This will return the vehicle properties for the specified vehicle. ---@param vehicle number ---@return table diff --git a/modules/framework/qb-core/client.lua b/modules/framework/qb-core/client.lua index be6e3f9..26b2a95 100644 --- a/modules/framework/qb-core/client.lua +++ b/modules/framework/qb-core/client.lua @@ -73,6 +73,17 @@ Framework.HideHelpText = function() return exports['qb-core']:HideText() 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. +---@param _type string +---@return number +Framework.GetAccountBalance = function(_type) + local player = Framework.GetPlayerData() + if not player then return 0 end + local account = player.money + if _type == 'money' then _type = 'cash' end + return account[_type] or 0 +end + ---This will return the item data for the specified item. ---@param item string ---@return table diff --git a/modules/framework/qbx_core/client.lua b/modules/framework/qbx_core/client.lua index f1cadd2..5cf2b66 100644 --- a/modules/framework/qbx_core/client.lua +++ b/modules/framework/qbx_core/client.lua @@ -108,6 +108,17 @@ Framework.GetPlayerInventory = function() return Framework.GetPlayerData().items 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. +---@param _type string +---@return number +Framework.GetAccountBalance = function(_type) + local player = Framework.GetPlayerData() + if not player then return 0 end + local account = player.money + if _type == 'money' then _type = 'cash' end + return account[_type] or 0 +end + ---This will return the vehicle properties for the specified vehicle. ---@param vehicle number ---@return table