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?
This commit is contained in:
1 parent
ebdaf5be94
commit
395629af17
3 files changed
+10
-3
No files matched your search
@@ -131,15 +131,20 @@ Framework.GetPlayerInventory = function()
|
|||||||
end
|
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.
|
---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
|
---@param _type string
|
||||||
---@return number
|
---@return number
|
||||||
Framework.GetAccountBalance = function(_type)
|
Framework.GetAccountBalance = function(_type)
|
||||||
local player = Framework.GetPlayerData()
|
local player = Framework.GetPlayerData()
|
||||||
if not player then return 0 end
|
if not player then return 0 end
|
||||||
local account = player.accounts
|
local accounts = player.accounts
|
||||||
if _type == 'cash' then _type = 'money' end
|
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
|
end
|
||||||
|
|
||||||
---This will return the vehicle properties for the specified vehicle.
|
---This will return the vehicle properties for the specified vehicle.
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ Framework.HideHelpText = function()
|
|||||||
end
|
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.
|
---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
|
---@param _type string
|
||||||
---@return number
|
---@return number
|
||||||
Framework.GetAccountBalance = function(_type)
|
Framework.GetAccountBalance = function(_type)
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ Framework.GetPlayerInventory = function()
|
|||||||
end
|
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.
|
---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
|
---@param _type string
|
||||||
---@return number
|
---@return number
|
||||||
Framework.GetAccountBalance = function(_type)
|
Framework.GetAccountBalance = function(_type)
|
||||||
|
|||||||
Reference in new issue
Block a user