Ir para conteúdo

Featured Replies

Postado
  • Este é um post popular.

Olá pessoal, como to mexendo em um servidor "baiak" tive a ideia de fazer esse sistema de alavanca (pedi ajuda para o MaXwEllDeN, que foi quem fez praticamente o script inteiro), o script é formado por 2 alavancas., onde uma é para life e outra para mana, e essas alavancas vendem potions em cargas de 100x, a diferença dela é que ela verifica a vocation e o level do player, e vendi o potion em função disso. Por exemplo: Knight com level inferior a 50 só pode usar health potion, então se ele clicar na alavanca de life, ele irá receber o health potion, mas se este knight estiver em um level supior a 50 e inferior a 80 irá receber um strong potion, e assim sucessivamente.

Faça pelo seu RME algo parecido com isso:

Y4LRbNt.png


Agora coloque a actionid 20001 na alavanca de life e 20002 na alavanca de mana ... 

 

FIs8tQg.png

 

Depois vá em actions/actions.xml e add a tag: 

<!-- Alavanca Potions -->
<action actionid="20001" script="alavanca_potions.lua"/>
<action actionid="20002" script="alavanca_potions.lua"/>

E por fim, em actions/scripts/ crie um arquivo chamado alavanca_potions.lua e adicione isso dentro: 

Spoiler

local potions = {
	[20001] = { -- Health
		[1] = { -- Mage
			[1] = {id = 7618, price = 5000, level = {1, math.huge}}, -- health_potion
		},
		[2] = { -- Paladin
			[1] = {id = 7618, price = 5000, level = {1, 50}}, -- health_potion
			[2] = {id = 7588, price = 10000, level = {50, 80}}, -- strong potion
			[3] = {id = 8472, price = 19000, level = {80, math.huge}}, -- spirit potion
		},
		[3] = { -- Knight
			[1] = {id = 7618, price = 5000, level = {1, 50}}, -- health_potion
			[2] = {id = 7588, price = 10000, level = {50, 80}}, -- strong potion
			[3] = {id = 7591, price = 19000, level = {80, 130}}, -- great potion
			[4] = {id = 8473, price = 31000, level = {130, math.huge}}, -- ultimate potion
		},
	},

	[20002] = { -- Mana
		[1] = { -- Mage
			[1] = {id = 7620, price = 5000, level = {1, 50}}, -- mana potion
			[2] = {id = 7589, price = 8000, level = {50, 80}}, -- strong potion
			[3] = {id = 7590, price = 12000, level = {80, math.huge}}, -- great potion
		},
		[2] = { -- Paladin
			[1] = {id = 7620, price = 5000, level = {1, 50}}, -- mana potion
			[2] = {id = 7589, price = 8000, level = {50, math.huge}}, -- strong potion
		},
		[3] = { -- Knight
			[1] = {id = 7620, price = 5000, level = {1, math.huge}}, -- mana potion
		},
	}
}

function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)

	item:transform(item.itemid == 1945 and 1946 or 1945)
	
	local group = 0
	if player:isMage() then 
		group = 1
	elseif player:isPaladin() then 
		group = 2
	elseif player:isKnight() then
		group = 3
	end

	local pot = potions[item.actionid][group]
	if not pot then
		return true
	end

	for _, v in ipairs(pot) do
		if player:getLevel() >= v.level[1] and player:getLevel() < v.level[2] then
			if player:getMoney() >= v.price then
				if player:removeMoney(v.price) then
					player:addItem(v.id, 100)
				end
			else
				return player:sendCancelMessage("You do not have enough money.")
			end
		end
	end

	item:transform(item.itemid == 1945 and 1946 or 1945)
	
	return true
end

 

 

 

É isso pessoal, os créditos são todos do MaXwEllDeN. Até mais!

  • Respostas 7
  • Visualizações 3.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Thiago Rulexz
    Thiago Rulexz

    @luanluciano93, chego a não ter o que fla de vc xD ótimo conteúdo '-' tu é foda jovem

  • 2 months later...
  • 3 months later...

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