Postado Fevereiro 11, 2019 6 anos @BilauX Configura na tabela. [actionID da alavanca] = {itemBuy = Id do item que o player vai comprar, amountBuy = Quantidade que o player vai comprar por vez, pointsCost = Quantos pontos vai custar}
Postado Fevereiro 11, 2019 6 anos Solução galera ele só quer poder adicionar mais itens conforme os points, digamos que com 12 points vem aquela porrada de itens... exemplo assim: local lever = { [7200] = {amount = 12, items = {{2474,1},{12568,1},{2469,1},{11114,1},{2181,1},{7365,1},{8905,1},{12001,1}}}, [7138] = {amount = 200, items = {{7903,1},{7884,1},{7885,1},{7886,1},{8911,1},{7363,1},{7460,1},{7390,1}}}, [7146] = {amount = 300, items = {{7900,1},{7899,1},{7894,1},{7891,1},{12597,1},{12391,1},{3974,1},{2446,1}}} } function getItemsLevers(cid, items) local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID for _, i_i in ipairs(items) do local item, amount = i_i[1],i_i[2] if isItemStackable(item) or amount == 1 then doAddContainerItem(backpack, item, amount) else for i = 1, amount do doAddContainerItem(backpack, item, 1) end end end end function getItemsFromList(items) local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end local storage,exausted = 98762, 2 function onUse(cid,item,fromPosition,itemEx,toPosition) if not lever[item.actionid] then return true end local var = lever[item.actionid] if getotfunPoints(cid) < var.amount then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..var.amount.." Ot Fun points.") elseif getPlayerStorageValue(cid, storage) >= os.time() then return doPlayerSendCancel(cid, "espere " .. getPlayerStorageValue(cid, storage) - os.time() .. " alguns segundos e tente novamente.") end getItemsLevers(cid, var.items) doPlayerSendTextMessage(cid,22,"Você Acaba De Adquirir: " .. getItemsFromList(var.items)) doPlayerRemoveotfunPoints(cid,var.amount) setPlayerStorageValue(cid, storage, os.time()+exausted) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) doTransformItem(item.uid, item.itemid == 1740 and 1740 or 1740) -- troque aqui o id da alavanca return true end -------------------------------- agora você pode adicionar quantos items quiser, só colocar {itemid, amount} exemplo: items = {{2173,1},{2160,10}} ai para adicionar mais itens ficaria: items = {{2173,1},{2160,10},{2494,1}}
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.