Exports
- Added
- Updated
These let your own scripts read and set prices, so a shop, a heist payout or a crafting recipe can use the same numbers the panel shows.
Server side
getCost
Gives you what an item is worth to the server.
| Argument | Type | Description |
|---|---|---|
itemName | string | Item name to look up |
Returns integer? — nil if the item is not registered.
exports.REC_ItemManager:getCost(itemName)
getPrice
Gives you what a shop charges for an item, market movement included.
| Argument | Type | Description |
|---|---|---|
itemName | string | Item name to look up |
Returns integer? — nil if the item is not registered.
exports.REC_ItemManager:getPrice(itemName)
RegisterCommand("cigsprice", function()
local price = exports.REC_ItemManager:getPrice("cigarette")
if price == nil then
return
end
print(("The shop sells one cigarette for %d today."):format(price))
end, true)
getItem
Gives you everything known about one item.
| Argument | Type | Description |
|---|---|---|
itemName | string | Item name to look up |
Returns MetaData? — nil if the item is not registered. Same fields as getItems.
exports.REC_ItemManager:getItem(itemName)
getItems
Gives you every item at once, keyed by item name.
Takes no arguments. Returns table<string, MetaData>:
| Field | Type | Description |
|---|---|---|
name | string | Item name |
type | ItemTypes | general or weapon |
label | string | Display label |
image | string | Picture file name |
cost | integer | What the item is worth |
markup | number | What the shop adds on top |
marketFactor | number | How far the market has nudged it. 1.0 is untouched |
marketCirculation | integer? | The count the last review compared against |
excludeFromMarket | boolean | This item is priced by hand |
price | integer | The shop price |
circulation | integer | How many are out there |
updatedAt | integer? | Last updated |
createdAt | integer? | Created |
exports.REC_ItemManager:getItems()
setCost
Changes what an item is worth. Shop prices follow immediately.
| Argument | Type | Description |
|---|---|---|
itemName | string | Item name |
cost | integer | A whole number, 0 or above |
Returns boolean — false if the item is unknown or the value was refused.
exports.REC_ItemManager:setCost(itemName, cost)
setMarkup
Changes what the shop adds on top.
| Argument | Type | Description |
|---|---|---|
itemName | string | Item name |
markup | number | Above 0 and up to 100 |
Returns boolean — false if the item is unknown or the value was refused.
exports.REC_ItemManager:setMarkup(itemName, markup)
