Ir para conteúdo
  • 0

[Resolvido] [RESOLVIDO] Melhorar meu sistema de orb


JS Lotus

Pergunta

Eae galera, hoje venho pedir uma ajudinha não muito complexa de vocês.

Não tenho muita noção de script, e tô sem ideias do que fazer pra conseguir isso.

 

É o seguinte: Esse sistema é de orb, ao clicar na orb, você pode receber 1 fire stone e 1 orb vazia, ou ela pode quebrar assim recebendo apenas 1 orb vazia.

Está funcionando normalmente como falei, só que preciso que verifique se o player tem 175 itens (2132) e caso tenha remova-os, caso não, aparece uma mensagem falando que não tem os materiais necessários. Obrigado!

 

Spoiler

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doPlayerAddItem(cid,k.fruit,random)
            doPlayerAddItem(cid,k.EmptyOrb,1)
            doPlayerRemoveItem(cid,15061,1)
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
            else
                doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                doPlayerRemoveItem(cid,k.fruit,1)
            end
        end
    end
return true
end

 

Quem puder ajudar, agradeço.

Editado por JS Lotus
Link para o comentário
Compartilhar em outros sites

10 respostass a esta questão

Posts Recomendados

  • 0

Tenta assim:

Spoiler

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 2132) < 175 then
		doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!")
	else
		for i, k in pairs(config) do
			if (isInArray(i, item.itemid) == true) then
				random = math.random(k.quantity[1],k.quantity[2])
				doPlayerAddItem(cid,k.fruit,random)
				doPlayerAddItem(cid,k.EmptyOrb,1)
				doPlayerRemoveItem(cid,15061,1)
				doPlayerRemoveItem(cid,2132,175)
				if random > 0 then
					doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
				else
					doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
					doPlayerRemoveItem(cid,k.fruit,1)
				end
			end
		end
	end
return true
end

 

 

Editado por SirDubstep
Edição do script
Link para o comentário
Compartilhar em outros sites

  • 1
1 hora atrás, SirDubstep disse:

Testa ai:

  Ocultar conteúdo


-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 2132) < 175 then
		doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!")
		return false
	end
	if getPlayerStorageValue(cid, stoTempo) >= os.time() then
		doPlayerSendTextMessage(cid,27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
		return false
	end
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doPlayerAddItem(cid,k.fruit,random)
            doPlayerAddItem(cid,k.EmptyOrb,1)
            doPlayerRemoveItem(cid,15061,1)
			doPlayerRemoveItem(cid,2132,175)
			if isPremium(cid) then
				setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
			else
				setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
			end
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
            else
                doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                doPlayerRemoveItem(cid,k.fruit,1)
            end
        end
    end
return true
end

 

 

Funcionou, obrigado!

Link para o comentário
Compartilhar em outros sites

  • 0
5 minutos atrás, SirDubstep disse:

Tenta assim:

  Ocultar conteúdo


-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 2132) < 175 then
		doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!")
	else
		for i, k in pairs(config) do
			if (isInArray(i, item.itemid) == true) then
				random = math.random(k.quantity[1],k.quantity[2])
				doPlayerAddItem(cid,k.fruit,random)
				doPlayerAddItem(cid,k.EmptyOrb,1)
				doPlayerRemoveItem(cid,15061,1)
				doPlayerRemoveItem(cid,2132,175)
				if random > 0 then
					doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
				else
					doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
					doPlayerRemoveItem(cid,k.fruit,1)
				end
			end
		end
	end
return true
end

 

 

Opa, funcionou perfeitamente!

Muito obrigado mesmo! REP+

Link para o comentário
Compartilhar em outros sites

  • 0
5 minutos atrás, JS Lotus disse:

Opa, funcionou perfeitamente!

Muito obrigado mesmo! REP+

De nada, só não esquece de marcar como melhor resposta para algum moderador poder marcar como pedido solucionado.

Link para o comentário
Compartilhar em outros sites

  • 0
Em 21/09/2018 em 11:32, SirDubstep disse:

De nada, só não esquece de marcar como melhor resposta para algum moderador poder marcar como pedido solucionado.

Certo, já marquei!

Se não for muito incômodo, poderia fazer uma outra alteração no sistema?

 

Queria que tivesse um certo cooldown para utilizar o item. Ex: Utilizei a orb agora, poderei utilizar somente daqui há 10 minutos.

E que jogadores premium terem que esperar a metade do tempo, 5 minutos. Obrigado!

Editado por JS Lotus
Link para o comentário
Compartilhar em outros sites

  • 0
9 horas atrás, JS Lotus disse:

Certo, já marquei!

Se não for muito incômodo, poderia fazer uma outra alteração no sistema?

 

Queria que tivesse um certo cooldown para utilizar o item. Ex: Utilizei a orb agora, poderei utilizar somente daqui há 10 minutos.

E que jogadores premium account. Obrigado!

Spoiler

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}

local tempo = 600 -- tempo em segundos
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 2132) < 175 then
		doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!")
		return false
	end
	if not isPremium(cid) then
		doPlayerSendTextMessage(cid,27,"You need premium account to use this item.")
		return false
	end
	if getPlayerStorageValue(cid, stoTempo) >= os.time() then
		doPlayerSendTextMessage(cid,27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
		return false
	end
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doPlayerAddItem(cid,k.fruit,random)
            doPlayerAddItem(cid,k.EmptyOrb,1)
            doPlayerRemoveItem(cid,15061,1)
			doPlayerRemoveItem(cid,2132,175)
			setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
            else
                doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                doPlayerRemoveItem(cid,k.fruit,1)
            end
        end
    end
return true
end

 

 

 

Link para o comentário
Compartilhar em outros sites

  • 0
1 hora atrás, SirDubstep disse:
  Mostrar conteúdo oculto


-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}

local tempo = 600 -- tempo em segundos
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 2132) < 175 then
		doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!")
		return false
	end
	if not isPremium(cid) then
		doPlayerSendTextMessage(cid,27,"You need premium account to use this item.")
		return false
	end
	if getPlayerStorageValue(cid, stoTempo) >= os.time() then
		doPlayerSendTextMessage(cid,27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
		return false
	end
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doPlayerAddItem(cid,k.fruit,random)
            doPlayerAddItem(cid,k.EmptyOrb,1)
            doPlayerRemoveItem(cid,15061,1)
			doPlayerRemoveItem(cid,2132,175)
			setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
            else
                doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                doPlayerRemoveItem(cid,k.fruit,1)
            end
        end
    end
return true
end

 

 

 

Perdão, o xtibia tinha bugado aqui no meu PC e n eenviou a mensagem por completar, atualizei ela

Link para o comentário
Compartilhar em outros sites

  • 0

Testa ai:

Spoiler

-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 2132) < 175 then
		doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!")
		return false
	end
	if getPlayerStorageValue(cid, stoTempo) >= os.time() then
		doPlayerSendTextMessage(cid,27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
		return false
	end
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doPlayerAddItem(cid,k.fruit,random)
            doPlayerAddItem(cid,k.EmptyOrb,1)
            doPlayerRemoveItem(cid,15061,1)
			doPlayerRemoveItem(cid,2132,175)
			if isPremium(cid) then
				setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
			else
				setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
			end
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
            else
                doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                doPlayerRemoveItem(cid,k.fruit,1)
            end
        end
    end
return true
end

 

 

Link para o comentário
Compartilhar em outros sites

  • 0
7 horas atrás, SirDubstep disse:

Testa ai:

  Mostrar conteúdo oculto


-- Elemental Orb System --
-- Developed by Rigby --
-- Edited by JS Lotus --
 
local config = {
-- [ID DA ORB] = {ID DA STONE, QUANTIDADE{minimo, maximo},
    [15061] = {fruit = 2283, quantity = {0,1}, EmptyOrb = 15166, CommomM = 2132},
    [8637] = {fruit = 14036, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8634] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8638] = {fruit = 14039, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8635] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8639] = {fruit = 14037, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8636] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
    [8640] = {fruit = 14038, quantity = {0,1}, EmptyOrb = 2148, CommomM = 2132},
}

local tempo = 600 -- tempo em segundos
local tempoVip = 300
local stoTempo = 8120
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerItemCount(cid, 2132) < 175 then
		doPlayerSendTextMessage(cid,27,"Você não possui os materiais necessários!")
		return false
	end
	if getPlayerStorageValue(cid, stoTempo) >= os.time() then
		doPlayerSendTextMessage(cid,27, "You have to wait "..(getPlayerStorageValue(cid, stoTempo) - os.time()).." seconds to use this item again.")
		return false
	end
    for i, k in pairs(config) do
        if (isInArray(i, item.itemid) == true) then
            random = math.random(k.quantity[1],k.quantity[2])
            doPlayerAddItem(cid,k.fruit,random)
            doPlayerAddItem(cid,k.EmptyOrb,1)
            doPlayerRemoveItem(cid,15061,1)
			doPlayerRemoveItem(cid,2132,175)
			if isPremium(cid) then
				setPlayerStorageValue(cid, stoTempo, os.time() + tempoVip)
			else
				setPlayerStorageValue(cid, stoTempo, os.time() + tempo)
			end
            if random > 0 then
                doPlayerSendTextMessage(cid,27,"Parabéns! O processo de transformação foi realizado com sucesso, assim se transformando em "..getItemNameById(k.fruit)..".")
            else
                doPlayerSendTextMessage(cid,27,"A orb quebrou durante o processo!")
                doPlayerRemoveItem(cid,k.fruit,1)
            end
        end
    end
return true
end

 

 

Funcionou, obrigado!

Acho que tô abusando demais, mas se tiver algum tempinho livre pode me ajudar nisso?

 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...