Through this, I request that the developers add the following global callbacks to the LuaAPI so that we can create custom scripts that allow us to perform trades with other currencies. Currently, I am trying to perform this action with `onUseCommand`, but the way I am doing it is not very effective since I am basing everything on caching.
In practice, these callbacks fulfill 3 different roles in the trade flow:
Handshake / Lock the offer (anti-snipe / anti-swap with another)
`onTradeRequest(seller, buyer)` and/or `onTradeAccept(seller, buyer)`
Here we identify who the seller is (who opened the shop), inform the price/currency to the buyer, and lock that offer for that buyer for a few seconds.
Finalization (exact moment to charge)
onTradeConfirm(seller, buyer) and/or onTradeOk(seller, buyer)
- This allows us to:
- validate the buyer's balance,
- debit the buyer,
- credit the seller,
- and block the trade if there is insufficient balance (returning 1).
Cancellation / Clearing
onTradeCancel(seller, buyer)
Releases locks, cancels the session, and avoids state garbage.

Recommended Comments
There are no comments to display.