[Resolvido] [RESOLVIDO] Melhorar meu sistema de orb

JS Lotus
em Resolvidos

JS Lotus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/09/18Posts: 21

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.

lSainty

xd
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 509Gênero: Masculino

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

 

 

re2JIBH.jpg

JS Lotus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/09/18Posts: 21
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+

lSainty

xd
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 509Gênero: Masculino
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.

re2JIBH.jpg

JS Lotus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/09/18Posts: 21
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!

lSainty

xd
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 509Gênero: Masculino
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

 

 

 

re2JIBH.jpg

JS Lotus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/09/18Posts: 21
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

lSainty

xd
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 509Gênero: Masculino

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

 

 

re2JIBH.jpg

JS Lotus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/09/18Posts: 21
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!

JS Lotus

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 21/09/18Posts: 21
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?

 

Benny

nvr gv p
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 22/12/12Posts: 1958Gênero: MasculinoChar no Tibia: Marley
O pedido neste tópico de foi atendido e/ou o autor do tópico resolveu sua duvida. Este tópico está fechado e foi movido para Pedidos - Resolvidos. Se você tiver outros pedidos, crie um novo tópico.
?