Ir para conteúdo

Featured Replies

Postado

@BilauX Presta bastante atenção na hora de configurar para não fazer errado

local lever = { -- [Alavanca ID] = { [quantida de pontos] = { {itemID, count}, {itemID, count} }, Todas elas podem ser criadas quantas vezes quiser
        
   [7130] = { [100] = { {2150, 5}, {2160, 30}, {3310, 10} },  [200] = { 2150, 5}, {2160, 30} }, 

   [7120] = { [100] = { {2150, 5}, {2160, 30}, {3310, 10} },  [200] = { 2150, 5}, {2160, 30} },
        
}
    
local storage = 34316 -- Storage
local exhaust = 5 -- Segundos de exhaust    
    
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if exhaustion.check(cid, storage) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar essa alavanca novamente!!")
        return false
    end
    exhaustion.set(cid, storage, exhaust)
    local check = lever[item.itemid]
    if check then
        for index, table in pairs(check) do
            if getotfunPoints(cid) >= tonumber(index) then
                doPlayerRemoveotfunPoints(cid, tonumber(index))
                for _, var in pairs(table) do
                    doPlayerAddItem(cid, var[1], var[2])
                    doPlayerSendTextMessage(cid, 22, "Você comprou ".. var[2] .." ".. getItemInfo(var[1]).name ..".")
                end 
            end  
        end
    end 
    return true
end

 

  • Respostas 11
  • Visualizações 1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • 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 = {{2

Postado
  • Autor

assim tu usa, nada acontece nenhum erro na distro, só q aparece you cannot use this object, ai aparece o delay no console, ai tu espera o delay de tempo, e aparece a you cannot use this object e fica nesse loop infinito, delay e a mensagem you cannot..

 

7 minutos atrás, Storm disse:

@BilauX Presta bastante atenção na hora de configurar para não fazer errado


local lever = { -- [Alavanca ID] = { [quantida de pontos] = { {itemID, count}, {itemID, count} }, Todas elas podem ser criadas quantas vezes quiser
        
   [7130] = { [100] = { {2150, 5}, {2160, 30}, {3310, 10} },  [200] = { 2150, 5}, {2160, 30} }, 

   [7120] = { [100] = { {2150, 5}, {2160, 30}, {3310, 10} },  [200] = { 2150, 5}, {2160, 30} },
        
}
    
local storage = 34316 -- Storage
local exhaust = 5 -- Segundos de exhaust    
    
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if exhaustion.check(cid, storage) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar essa alavanca novamente!!")
        return false
    end
    exhaustion.set(cid, storage, exhaust)
    local check = lever[item.itemid]
    if check then
        for index, table in pairs(check) do
            if getotfunPoints(cid) >= tonumber(index) then
                doPlayerRemoveotfunPoints(cid, tonumber(index))
                for _, var in pairs(table) do
                    doPlayerAddItem(cid, var[1], var[2])
                    doPlayerSendTextMessage(cid, 22, "Você comprou ".. var[2] .." ".. getItemInfo(var[1]).name ..".")
                end 
            end  
        end
    end 
    return true
end

 

 

 

  • 2 weeks later...
Postado

@BilauX Testa ai.

 

Spoiler

local lever = {

--	[actionid] = {item que vai comprar, quantidade do item, quantos pontos vai custar}
	[8421] = {itemBuy = 2261, amountBuy = 10, pointsCost = 10},
	[8422] = {itemBuy = 2262, amountBuy = 12, pointsCost = 12},
	[8423] = {itemBuy = 2263, amountBuy = 15, pointsCost = 14},
	[8424] = {itemBuy = 2264, amountBuy = 20, pointsCost = 12}
}
    
local storage = 34316 -- Storage
local exhaust = 5 -- Segundos de exhaust    
    
function onUse(cid, item, fromPosition, itemEx, toPosition)

if exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..exhaustion.get(cid, storage).." segundos para usar essa alavanca novamente!!")

	return false

end

exhaustion.set(cid, storage, exhaust)

local check = lever[item.actionid]

if check then

if getotfunPoints(cid) >= check.pointsCost then

doPlayerRemoveotfunPoints(cid, check.pointsCost)

doPlayerAddItem(cid, check.itemBuy, check.amountBuy)

doPlayerSendTextMessage(cid, 22, "Voce comprou "..check.amountBuy.." "..getItemNameById(check.itemBuy)..".")

doSendMagicEffect(getCreaturePosition(cid), 12)

else

doPlayerSendTextMessage(cid, 27, "Voce precisa de "..check.pointsCost.." pontos.")

doSendMagicEffect(getCreaturePosition(cid), 2)

end

end

return true

end

 

 

Postado
  • Autor

funciono, mais eu quero q usa um action id e vem 8 itens, por x pontos,e depois usa mais outro actionid e vem 8 items e por aí vai...

 

 

Em 10/02/2019 em 10:52, JoviM disse:

@BilauX Testa ai.

 

  Ocultar conteúdo


local lever = {

--	[actionid] = {item que vai comprar, quantidade do item, quantos pontos vai custar}
	[8421] = {itemBuy = 2261, amountBuy = 10, pointsCost = 10},
	[8422] = {itemBuy = 2262, amountBuy = 12, pointsCost = 12},
	[8423] = {itemBuy = 2263, amountBuy = 15, pointsCost = 14},
	[8424] = {itemBuy = 2264, amountBuy = 20, pointsCost = 12}
}
    
local storage = 34316 -- Storage
local exhaust = 5 -- Segundos de exhaust    
    
function onUse(cid, item, fromPosition, itemEx, toPosition)

if exhaustion.check(cid, storage) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Aguarde "..exhaustion.get(cid, storage).." segundos para usar essa alavanca novamente!!")

	return false

end

exhaustion.set(cid, storage, exhaust)

local check = lever[item.actionid]

if check then

if getotfunPoints(cid) >= check.pointsCost then

doPlayerRemoveotfunPoints(cid, check.pointsCost)

doPlayerAddItem(cid, check.itemBuy, check.amountBuy)

doPlayerSendTextMessage(cid, 22, "Voce comprou "..check.amountBuy.." "..getItemNameById(check.itemBuy)..".")

doSendMagicEffect(getCreaturePosition(cid), 12)

else

doPlayerSendTextMessage(cid, 27, "Voce precisa de "..check.pointsCost.." pontos.")

doSendMagicEffect(getCreaturePosition(cid), 2)

end

end

return true

end

 

 

 

 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo