- Joined
- Feb 20, 2014
- Messages
- 1,073
- Solutions
- 4
- Reaction score
- 177
I need help to make my buy function,
i have this:
and have one variable with this named t:
i have this:
Code:
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
doPlayerRemoveMoney(cid, t[item].buyprice*amount)
doPlayerAddItem(cid, [t]item, amount)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought " .. amount .. "x " .. getItemName(item) .. " for " .. t[item].price*amount .. " gold.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dont have money")
end
and have one variable with this named t:
Code:
local t = {
[7493] = {price = 750},{buyprice = 9999}}