getStocks
exports["RiP-Invest"]:getStocks(filter, cb)
This function returns all stocks (with filter)
Arguments
Name | Type | Optional | Explenation |
---|---|---|---|
filter | Integer/String | Yes | Stock filter (playerId/stockSymbol) |
cb | Function | Yes | Callback function |
Returned Table
Name | Type | Explenation |
---|---|---|
id | Integer | Stock id |
type | String | Stock type (crypto/stock) |
name | String | Stock name |
symbol | String | Stock symbol |
amount | Integer | Stock amount (when player stocks) |
price | Integer | Stock price |
Example
local xPlayer = ESX.GetPlayerFromId(source)
exports['RiP-Invest]:getStocks(xPlayer.source, function(xStocks)
for r,p in pairs(xStocks) do
print(p.id)
end
end)