function onUse(cid, item)
local t = {
{actionala = 29182, gainitemid = {12123, 4343, 1212}, lostitemid = {2160, 2152}},
{actionala = 29182, gainitemid = {12123, 4343, 1212}, lostitemid = {2160, 2152}},
{actionala = 29182, gainitemid = {12123, 4343, 1212}, lostitemid = {2160, 2152}}
}
for _, push in ipairs(t) do
if item.actionid == push.actionala then
if doPlayerRemoveItem(cid, push.lostitemid[1], 1) == TRUE then
for i = 1, #push.gainitemid then
doPlayerAddItem(cid, push.gainitemid, 1)
doPlayerSendCancel(cid, "You bought the items.")
doSendMagicEffect(getPlayerPosition(cid), 12)
end
elseif doPlayerRemoveItem(cid, push.lostitemid[2], 1) == TRUE then
for i = 1, #push.gainitemid then
doPlayerAddItem(cid, push.gainitemid, 1)
doPlayerSendCancel(cid, "You bought the items.")
doSendMagicEffect(getPlayerPosition(cid), 12)
end
else
doPlayerSendCancel(cid, "You dont have the request items.")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
end
end
return true
end