Lua:
local function onSell(cid, item, subType, amount, ignoreCap, inBackpacks)
local player = Player(cid)
if not player then
return false
end
if not getTable(player) then
return false
end
local items = setNewTradeTable(getTable(player))
if items[item].sellPrice and player:removeItem(items[item].itemId, amount) then
player:addMoney(items[item].sellPrice * amount)
return player:sendTextMessage(MESSAGE_INFO_DESCR, 'Sold '..amount..'x '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.')
else
selfSay("You don't have item to sell.", cid)
end
return true
end
using this function is selling the equipped item