local buyItem = 0
local price = 0
function onUse(cid, item, frompos, topos)
local money = crystalCoins * 10000 + platinumCoins * 100 + goldCoins
if item.actionId == 12345 then
buyItem = ITEMID --(CHANGE)
price = 1000 -- 1000 gp (CHANGE)
elseif item.actionId == 12346 then
buyItem = ITEMID2 --(CHANGE)
price = 1000 -- 1000 gp (CHANGE)
elseif item.actionId == 12347
buyItem = ITEMID3 --(CHANGE)
price = 1000 -- 1000 gp (CHANGE)
end
if item.itemid == 1945 then
if money >= price then
doPlayerAddItem(cid,buyItem,1)
doPlayerRemoveMoney(cid,price)
doTransformItem(item.uid,item.itemid + 1)
else
doPlayerSendTextMessage(cid,22,"You can't afford this.")
end
else
doTransformItem(item.uid,item.itemid - 1)
end
end