Skip to content

Shop

Shop is the client-side in-match shop API. The global is nil in a Reflex server.

The command methods BuyItem(), BuyAndDropItem(), and SellItem() return nil. Check inventory and the query methods to confirm an operation instead of relying on a return value.

A client call creates a shop-operation request. The server checks current match rules—buy availability, money, limits, side, slot, and sale eligibility—before changing economy, inventory, or spawning a drop. nil therefore only means the call was submitted, not that a purchase succeeded.

CanSellItem(), HasBoughtItem(), and IsBuyLimitReachedForItem() read current shop state for the local agent. They reserve nothing and cannot guarantee conditions will remain unchanged until the next request is processed.

  • When the server accepts BuyItem(), the inventory and the item’s purchase state change.
  • SellItem() removes an eligible item and changes the related shop state.
  • BuyAndDropItem() requests a purchase that creates an item in the world, but the call does not return the created Drop.

These methods do not show a separate confirmation on behalf of the module. Check the inventory, HasBoughtItem(), CanSellItem(), and Drops lists; show your own feedback through NotificationController or ChatManager when needed.

local itemName = "FragGrenade"
if not Shop:IsBuyLimitReachedForItem(itemName) then
Shop:BuyItem(itemName)
end
if Shop:CanSellItem(itemName) then
Shop:SellItem(itemName)
end

A successful purchase adds the item to Agents:GetLocalAgent().Inventory. After buying, HasBoughtItem() becomes true, while CanSellItem() reports whether it can be refunded right now.

Shop:BuyItem(itemName: string)

Buys an item by its internal name. The operation depends on the round stage, buy zone, available money, item availability, and purchase limit.

Shop:SellItem(itemName: string)

Sells a previously purchased item when CanSellItem(itemName) returns true.

Shop:BuyAndDropItem(itemName: string)

Requests a purchase that should place the item in the world.

Shop:CanSellItem(itemName: string): bool

Returns true when the local player can sell the item right now.

Shop:HasBoughtItem(itemName: string): bool

Returns true when the item is recorded as purchased by the local player in the current round.

Shop:IsBuyLimitReachedForItem(itemName: string): bool

Returns true when the purchase limit for the item has been reached.