Module sv_market
Market System
Functions
| AddMarketItem (marketName, itemName, minSellPrice, maxSellPrice) | AddMarketItem function. |
| GetPrice (item, marketName) | GetPrice function. |
| SellItem (item, amount, marketName) | SellItem function. |
Callbacks
| jones_market:server:getprice | GetPrice Callback This callback returns the price of an item. |
Functions
- AddMarketItem (marketName, itemName, minSellPrice, maxSellPrice)
-
AddMarketItem function.
This function adds an item to a market.
Parameters:
- marketName The market name. string
- itemName The item name. string
- minSellPrice The minimum sell price. number
- maxSellPrice The maximum sell price. number
Usage:
exports.jones_util:AddMarketItem("blackmarket", "weed", 100, 200)
- GetPrice (item, marketName)
-
GetPrice function.
This function returns the price of an item.
Parameters:
- item The item name. string
- marketName The market name. string
Returns:
-
number
Usage:
local price = exports.jones_util:GetPrice("weed", "blackmarket")
- SellItem (item, amount, marketName)
-
SellItem function.
This function sells an item.
Parameters:
- item The item name. string
- amount The amount of items to sell. number
- marketName The market name. string
Returns:
-
number
Usage:
local money = exports.jones_util:SellItem("weed", 1, "blackmarket")
Callbacks
- jones_market:server:getprice
-
GetPrice Callback
This callback returns the price of an item.
param:
- cb The callback function.
- item The item name. string
- marketName The market name. string
Usage:
exports.jones_util:TriggerServerCallback("jones_market:server:getprice", function(price) print(price) end, "weed", "blackmarket")